From a6982bec2ed82e66d1639686248a4f4f7a306a3f Mon Sep 17 00:00:00 2001 From: lijinxing Date: Sat, 9 May 2020 16:39:41 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=20=E6=B7=BB=E5=8A=A0p1=E7=BA=A7?= =?UTF-8?q?=E5=88=AB=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B:=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=AD=98=E5=9C=A8=E7=9A=84=E4=B8=80=E4=B8=AA=E8=83=BD?= =?UTF-8?q?=E5=8A=9B=E8=8A=82=E7=82=B9=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeviceNodeInfoControllerSmokeTest.java | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/dispose/controller/DeviceNodeInfoControllerSmokeTest.java b/src/test/java/com/dispose/controller/DeviceNodeInfoControllerSmokeTest.java index 4d859a49..111e674a 100644 --- a/src/test/java/com/dispose/controller/DeviceNodeInfoControllerSmokeTest.java +++ b/src/test/java/com/dispose/controller/DeviceNodeInfoControllerSmokeTest.java @@ -2,6 +2,7 @@ package com.dispose.controller; import com.dispose.Global.InitTestEnvironment; import com.dispose.common.ErrorCode; +import com.dispose.pojo.vo.information.DisposeNodeListRsp; import com.dispose.pojo.vo.information.NodeTaskRsp; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; @@ -17,9 +18,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - import javax.annotation.Resource; - import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @@ -43,7 +42,7 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment { private ObjectMapper objectMapper; /** - * A 1 login normal login test. + * A 1 get all task Normal Test. * * @throws Exception the exception */ @@ -80,4 +79,30 @@ public class DeviceNodeInfoControllerSmokeTest extends InitTestEnvironment { //Assert.assertEquals(Long.valueOf(rspInfo.getStatus()), Long.valueOf(ErrorCode.ERR_OK.getCode())); } + + /** + * C 1 get Node Details Normal Test. + * + * @throws Exception the exception + */ + @Test + public void c1_getNodeDetailsNormalTest() throws Exception { + String reqData = "{\"ver\":2,\"cryptoType\":0,\"timeStamp\":1587604310504,\"msgContent\":\"{\\\"id\\\":[\\\"476\\\"]}\"}"; + + String ret = mockMvc.perform(MockMvcRequestBuilders + .post("/information/node_details") + .contentType(MediaType.APPLICATION_JSON) + .header("Authorization", "Bearer " + getLogToken()) + .content(reqData)) + .andDo(print()).andExpect(status().isOk()) + .andExpect(jsonPath("$.code").value(ErrorCode.ERR_OK.getHttpCode())) + .andReturn() + .getResponse() + .getContentAsString(); + + DisposeNodeListRsp rspInfo = objectMapper.readValue(verifyResp(ret), DisposeNodeListRsp.class) ; + + Assert.assertNotNull(rspInfo); + Assert.assertNotEquals(rspInfo.getItems().size(), 0); + } }