org.springframework.test.web.servlet.result.MockMvcResultMatchers Java Examples
The following examples show how to use
org.springframework.test.web.servlet.result.MockMvcResultMatchers.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CdmrControllerTest.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void cdmRemoteRequestHeaderTest() throws Exception { RequestBuilder rb = MockMvcRequestBuilders.get(path).servletPath(path).param("req", "header"); MvcResult result = this.mockMvc.perform(rb).andExpect(MockMvcResultMatchers.status().is(200)) .andExpect(MockMvcResultMatchers.content().contentType(ContentType.binary.getContentHeader())).andReturn(); // We want this statement to succeed without exception. // Throws NullPointerException if header doesn't exist // Throws IllegalArgumentException if header value is not a valid date. result.getResponse().getDateHeader("Last-Modified"); // response is a ncstream ByteArrayInputStream bais = new ByteArrayInputStream(result.getResponse().getContentAsByteArray()); CdmRemote cdmr = new CdmRemote(bais, "test"); cdmr.close(); }
Example #2
Source File: InstanceManageControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 4 * 新增灰度组时查询推送实例 * * @throws Exception */ @Test public void test_instance_manage_4_appointList() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/instanceManage/appointList") .param("project", "qq") .param("cluster", "qq") .param("service", "qq") .param("version", "1.0") .param("versionId", "3783219485607985152") .param("grayId", "0") .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #3
Source File: ServiceConfigControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 推送配置 * * @throws Exception */ @Test public void test_service_config_4_push() throws Exception { PushServiceConfigRequestBody body = new PushServiceConfigRequestBody(); body.setId("3753486267610824705"); List<String> regionIds = new ArrayList<>(); regionIds.add("3777763353183649792"); body.setRegionIds(regionIds); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/service/config/push") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #4
Source File: ServiceConfigControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 编辑配置 * * @throws Exception */ @Test public void test_service_config_2_edit() throws Exception { EditServiceConfigRequestBody body = new EditServiceConfigRequestBody(); body.setId("3753486267568881664"); body.setContent("my friend xiBigBig"); body.setDesc("修改配置后的描述"); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/service/config/edit") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #5
Source File: UserControllerTests.java From spring-boot-study with MIT License | 6 votes |
/** * 测试 Hello World 方法 * hello 方法是一个 get 方法,使用了 url 参数传递参数 所以使用了 .param 来传递参数 * accept(MediaType.TEXT_HTML_VALUE) 来设置传递值接收类型 * */ @Test public void hello() throws Exception{ MvcResult mvcResult= mockMvc.perform(MockMvcRequestBuilders.get("/api/user/hello") .param("name","fishpro") .accept(MediaType.TEXT_HTML_VALUE)) //perform 结束 .andExpect(MockMvcResultMatchers.status().isOk()) //添加断言 .andExpect(MockMvcResultMatchers.content().string("Hello fishpro"))//添加断言 .andDo(MockMvcResultHandlers.print()) //添加执行 .andReturn();//添加返回 //下面部分等等与 addExcept 部分 //int status=mvcResult.getResponse().getStatus(); //得到返回代码 //String content=mvcResult.getResponse().getContentAsString(); //得到返回结果 //Assert.assertEquals(200,status); //等于 andExpect(MockMvcResultMatchers.status().isOk()) //添加断言 //Assert.assertEquals("Hello World",content); //andExpect(MockMvcResultMatchers.content().string("Hello World"))//添加断言 }
Example #6
Source File: CdmrControllerTest.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void cdmRemoteRequestNcmlTest() throws Exception { RequestBuilder rb = MockMvcRequestBuilders.get(path).servletPath(path).param("req", "ncml"); MvcResult result = this.mockMvc.perform(rb).andExpect(MockMvcResultMatchers.status().is(200)) .andExpect(MockMvcResultMatchers.content().contentType(ContentType.xml.getContentHeader())).andReturn(); // We want this statement to succeed without exception. // Throws NullPointerException if header doesn't exist // Throws IllegalArgumentException if header value is not a valid date. result.getResponse().getDateHeader("Last-Modified"); Document doc = XmlUtil.getStringResponseAsDoc(result.getResponse()); int hasDims = NcmlParserUtil.getNcMLElements("netcdf/dimension", doc).size(); int hasAtts = NcmlParserUtil.getNcMLElements("netcdf/attribute", doc).size(); int hasVars = NcmlParserUtil.getNcMLElements("//variable", doc).size(); // Not really checking the content just the number of elements assertEquals(this.ndims, hasDims); assertEquals(this.natts, hasAtts); assertEquals(this.nvars, hasVars); }
Example #7
Source File: ServiceConfigControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 批量删除配置 * * @throws Exception */ @Test public void test_service_config_7_batchdelete() throws Exception { IdsRequestBody body = new IdsRequestBody(); List<String> ids = new ArrayList<>(); ids.add("3697214230441754624"); ids.add("3708849106630737920"); body.setIds(ids); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/service/config/batchDelete") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #8
Source File: FrontControllerTest.java From WeBASE-Node-Manager with Apache License 2.0 | 6 votes |
@Test public void testNewFront() throws Exception { FrontInfo param = new FrontInfo(); param.setFrontIp("localhost"); param.setFrontPort(8081); param.setAgency("1fe"); ResultActions resultActions = mockMvc.perform(MockMvcRequestBuilders.post( "/front/new"). content(JsonTools.toJSONString(param)). contentType(MediaType.APPLICATION_JSON_UTF8) ); resultActions. andExpect(MockMvcResultMatchers.status().isOk()). andDo(MockMvcResultHandlers.print()); System.out.println("response:"+resultActions.andReturn().getResponse().getContentAsString()); }
Example #9
Source File: GrayConfigControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 更新反馈 * * @throws Exception */ @Test public void test_gray_config_10_feedback() throws Exception { ServiceConfigFeedBackRequestBody body = new ServiceConfigFeedBackRequestBody(); body.setPushId("3717229737668509696"); body.setProject("project3"); body.setGroup("cluster1"); body.setService("service1"); body.setVersion("1.0.0.0"); body.setConfig("1.yml"); body.setAddr("192.168.0.2"); body.setUpdateStatus(1); body.setUpdateTime(new Date()); body.setLoadStatus(1); body.setLoadTime(new Date()); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/service/config/feedback") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #10
Source File: EventControllerTest.java From WeBASE-Front with Apache License 2.0 | 6 votes |
@Test public void testUnregisterContractEvent() throws Exception { String eventInfoId = "8aba82b570768afd0170768b2cc50001"; ReqContractEventRegister param = new ReqContractEventRegister(); param.setExchangeName("group001"); param.setQueueName("user1"); param.setAppId("app1"); param.setGroupId(1); param.setInfoId(eventInfoId); ResultActions resultActions = mockMvc .perform(MockMvcRequestBuilders.delete("/event/contractEvent"). content(JsonUtils.toJSONString(param)). contentType(MediaType.APPLICATION_JSON) ); resultActions. andExpect(MockMvcResultMatchers.status().isOk()). andDo(MockMvcResultHandlers.print()); }
Example #11
Source File: ServiceConfigControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 回滚配置 * * @throws Exception */ @Test public void test_service_config_9_rollback() throws Exception { IdsRequestBody body = new IdsRequestBody(); List<String> ids = new ArrayList<>(); ids.add("3731673452474531840"); ids.add("3731673452474531841"); body.setIds(ids); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/service/config/rollback") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #12
Source File: ProjectControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 删除项目成员 * * @throws Exception */ @Test public void test_project_7_member_delete() throws Exception { DeleteProjectMemberRequestBody body = new DeleteProjectMemberRequestBody(); body.setId("3714708188751200256"); body.setUserId("3688919024172793856"); String result = this.mockMvc.perform(MockMvcRequestBuilders.post("/api/v1/project/member/delete") .content(JSON.toJSONString(body)) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #13
Source File: TrackControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 查询最近的服务发现推送轨迹列表 * * @throws Exception */ @Test public void test_track_5_discovery_lastestList() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/track/discovery/lastestList") .param("project", "project3") .param("cluster", "cluster1") .param("service", "service1") .param("version", "1.0.0.0") .param("currentPage", "1") .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #14
Source File: GrayGroupControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 查询最近的灰度组列表(取消) * * @throws Exception */ @Test public void test_gray_group_4_lastestList() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/gray/lastestList") .param("project", "project3") .param("cluster", "cluster1") .param("service", "service1") .param("version", "1.0.0.1") .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #15
Source File: MacControllerTest.java From alcor with Apache License 2.0 | 6 votes |
@Test public void test_releaseMacStateByMacAddress() throws Exception { String strRangeId = "range0"; String strMac = "AA-BB-CC-01-01-01"; String strProjectId = "project1"; String strVpc = "vpc1"; String strPort = "port1"; String strState = "Active"; MacAddress macAddress = new MacAddress("AA-BB-CC", "00-00-00"); long nNicLength = (long) Math.pow(2, macAddress.getNicLength()); String strFrom = MacAddress.longToNic(0, macAddress.getNicLength()); String strTo = MacAddress.longToNic(nNicLength - 1, macAddress.getNicLength()); BitSet bitSet = new BitSet((int) nNicLength); MacRange macRange = new MacRange("range0", "AA-BB-CC-00-00-00", "AA-BB-CC-FF-FF-FF", "Active"); macRange.setBitSet(bitSet); MacState macState = new MacState("", strProjectId, strVpc, strPort, strState); when(mockMacStateRepository.findItem(strMac)).thenReturn(macState); doNothing().when(mockMacStateRepository).deleteItem(strMac); doNothing().when(mockMacRangeRepository).addItem(macRange); when(mockMacRangeRepository.findItem(strRangeId)).thenReturn(macRange); MvcResult result = this.mockMvc.perform(delete("/macs/" + strMac)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.mac_address").doesNotExist()) .andReturn(); }
Example #16
Source File: GrayGroupControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 查询灰度配置订阅者列表 * * @throws Exception */ @Test public void test_gray_group_7_consumer() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/gray/consumer") .param("project", "project1") .param("cluster", "cluster1") .param("service", "service1") .param("version", "version") .param("region", "R1") .param("grayId", "3740064022783852544") .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #17
Source File: UserControllerTest.java From java-master with Apache License 2.0 | 6 votes |
@Test @WithMockUser(username = "1050106266", password = "123456", authorities = "ROLE_ADMIN") public void testUpdatePassword() throws Exception { UpdatePasswordReqVo reqVo = new UpdatePasswordReqVo(); reqVo.setUsername("1050106158"); reqVo.setNewPassword("654321"); System.out.println(objectMapper.writeValueAsString(reqVo)); mockMvc.perform(MockMvcRequestBuilders.post("/admin/user/updatePassword") .contentType(MediaType.APPLICATION_JSON) .content(objectMapper.writeValueAsString(reqVo)) .accept(MediaType.APPLICATION_JSON)) .andDo(MockMvcResultHandlers.print()) .andExpect(MockMvcResultMatchers.status().isOk()); }
Example #18
Source File: QuickStartControllerTest.java From AthenaServing with Apache License 2.0 | 6 votes |
/** * 新增服务配置 * * @throws Exception */ @Test public void test_quick_start_3_addserviceConfig() throws Exception { ClassPathResource classPathResource1 = new ClassPathResource("config/application.yml"); MockMultipartFile multipartFile1 = new MockMultipartFile("file", "application.yml", "application/octet-stream", classPathResource1.getInputStream()); // ClassPathResource classPathResource2 = new ClassPathResource("2.yml"); // MockMultipartFile multipartFile2 = new MockMultipartFile("file", "2.yml", "application/octet-stream", classPathResource2.getInputStream()); // // ClassPathResource classPathResource3 = new ClassPathResource("3.yml"); // MockMultipartFile multipartFile3 = new MockMultipartFile("file", "3.yml", "application/octet-stream", classPathResource3.getInputStream()); String result = this.mockMvc.perform(MockMvcRequestBuilders.fileUpload("/api/v1/quickStart/addServiceConfig") .file(multipartFile1) // .file(multipartFile2) // .file(multipartFile3) .param("project", "测试项目") .param("cluster", "测试集群") .param("service", "测试服务") .param("version", "测试版本") .param("desc", "测试服务配置") .contentType(MediaType.MULTIPART_FORM_DATA) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)).andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #19
Source File: CdmrControllerTest.java From tds with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void cdmRemoteRequestCapabilitiesTest() throws Exception { RequestBuilder rb = MockMvcRequestBuilders.get(path).servletPath(path).param("req", "capabilities"); logger.debug("{}?req=capabilities", path); MvcResult result = this.mockMvc.perform(rb).andExpect(MockMvcResultMatchers.status().is(200)) .andExpect(MockMvcResultMatchers.content().contentType(ContentType.xml.getContentHeader())).andReturn(); /* * String content = * "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+ * "<cdmRemoteCapabilities location=\"http://localhost:80/cdmremote/NCOF/POLCOMS/IRISH_SEA/files/20060925_0600.nc\">" * + * " <featureDataset type=\"GRID\" url=\"http://localhost:80/cdmremote/NCOF/POLCOMS/IRISH_SEA/files/20060925_0600.nc\" />" * + * "</cdmRemoteCapabilities>"; // LAME * * assert content.equals(result.getResponse().getContentAsString()); */ }
Example #20
Source File: GrayGroupControllerTest.java From AthenaServing with Apache License 2.0 | 5 votes |
/** * 查询灰度组明细 * * @throws Exception */ @Test public void test_gray_group_3_detail() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/gray/detail") .param("id", "3781019715757932544") .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #21
Source File: TestStationFCController.java From tds with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void getDataForTimeRange() throws Exception { RequestBuilder rb = MockMvcRequestBuilders.get(dataset).servletPath(dataset).param("accept", "netcdf") .param("time_start", "2006-03-02T00:00:00Z").param("time_end", "2006-03-28T00:00:00Z").param("stns", "BJC,DEN") .param("var", "air_temperature,dew_point_temperature,precipitation_amount_24,precipitation_amount_hourly,visibility_in_air"); this.mockMvc.perform(rb).andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.content().contentType(ContentType.netcdf.getContentHeader())); }
Example #22
Source File: RecordControllerTest.java From singleton with Eclipse Public License 2.0 | 5 votes |
@Test public void test000getRecoredModel() throws Exception { MockMvc mockMvc = MockMvcBuilders.webAppContextSetup( webApplicationContext).build(); String urlStr = GATEWAYPREF+L10NAPIV1.API_L10N+"/records"; MvcResult mvcRS = mockMvc.perform(MockMvcRequestBuilders.get(urlStr)).andExpect(MockMvcResultMatchers.status().isOk()).andReturn(); String resultStr = mvcRS.getResponse().getContentAsString(); logger.info(resultStr); }
Example #23
Source File: ParticleTest.java From Milkomeda with MIT License | 5 votes |
@Test public void testNotify() throws Exception { val ret = mockMvc.perform(MockMvcRequestBuilders.get("/particle/notify") .content("{\"orderId\":\"12345676543456\",\"state\": 12}") .contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andReturn().getResponse().getContentAsString(); System.out.println(ret); }
Example #24
Source File: SegmentControllerTests.java From alcor with Apache License 2.0 | 5 votes |
@Test public void updateSegmentBySegmentId_update_pass () throws Exception { Mockito.when(segmentDatabaseService.getBySegmentId(UnitTestConfig.segmentId)) .thenReturn(new SegmentEntity(UnitTestConfig.projectId, UnitTestConfig.segmentId, UnitTestConfig.name, UnitTestConfig.cidr, UnitTestConfig.vpcId)) .thenReturn(new SegmentEntity(UnitTestConfig.projectId, UnitTestConfig.segmentId, UnitTestConfig.updateName, UnitTestConfig.cidr, UnitTestConfig.vpcId)); this.mockMvc.perform(put(updateUri).contentType(MediaType.APPLICATION_JSON).content(UnitTestConfig.segmentResource)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.segment.name").value(UnitTestConfig.updateName)); }
Example #25
Source File: UpdatePortTest.java From alcor with Apache License 2.0 | 5 votes |
@Test public void updateNameTest() throws Exception { mockRestClientsAndRepositoryOperations(); this.mockMvc.perform(put(updatePortUrl) .content(UnitTestConfig.updateName) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.port.id").value(UnitTestConfig.portId1)) .andExpect(MockMvcResultMatchers.jsonPath("$.port.name").value(UnitTestConfig.portName2)); }
Example #26
Source File: MetaConstDetailControllerTest.java From youran with Apache License 2.0 | 5 votes |
@Test public void list() throws Exception { generateHelper.saveConstDetailExample(metaConst.getConstId()); restMockMvc.perform(get(getApiPath() + "/meta_const_detail/list") .param("constId", metaConst.getConstId() + "")) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(jsonPath("$.length()").value(is(1))); }
Example #27
Source File: ServiceControllerTest.java From AthenaServing with Apache License 2.0 | 5 votes |
/** * 查询最近的服务列表 * * @throws Exception */ @Test public void test_service_4_lastestList() throws Exception { String result = this.mockMvc.perform(MockMvcRequestBuilders.get("/api/v1/service/lastestList") // .param("project", null) // .param("cluster", null) .contentType(MediaType.APPLICATION_JSON) .session((MockHttpSession) Utils.getLoginSession(this.mockMvc)) .accept(MediaType.APPLICATION_JSON)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()) .andReturn().getResponse().getContentAsString(); Utils.assertResult(result); }
Example #28
Source File: UpdatePortTest.java From alcor with Apache License 2.0 | 5 votes |
@Test public void updateQosPolicyIdTest() throws Exception { mockRestClientsAndRepositoryOperations(); this.mockMvc.perform(put(updatePortUrl) .content(UnitTestConfig.updateQosPolicyId) .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()) .andExpect(MockMvcResultMatchers.jsonPath("$.port.id").value(UnitTestConfig.portId1)) .andExpect(MockMvcResultMatchers.jsonPath("$.port.qos_policy_id").value(UnitTestConfig.qosPolicyId2)); }
Example #29
Source File: ServerGroupControllerTest.java From das with Apache License 2.0 | 5 votes |
@Test public void serversNoGroup() throws Exception { mockMvc.perform(MockMvcRequestBuilders.post("/serverGroup/serversNoGroup") .contentType(MediaType.APPLICATION_JSON_UTF8) .param("appGroupId", "1") .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }
Example #30
Source File: GroupControllerTest2.java From das with Apache License 2.0 | 5 votes |
@Test public void check() throws Exception { mockMvc.perform(MockMvcRequestBuilders.post("/groupdbSetEntry/data") .contentType(MediaType.APPLICATION_JSON_UTF8) .param("id", "1") .accept(MediaType.APPLICATION_JSON_UTF8)) .andExpect(MockMvcResultMatchers.status().isOk()) .andDo(MockMvcResultHandlers.print()); }