@Test public void testCustomerOrdersShip() { DefaultRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/customerCenter/orders/customerOrdersShip"); requestBuilder .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .characterEncoding("UTF-8"); try { ResultActions action = this.mockMvc.perform(requestBuilder).andExpect(new StatusResultMatchers().isOk()); System.out.println(action.andReturn().getResponse().getContentAsString()); System.out.println(action.toString()); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testUrPayOrdersLogList() { DefaultRequestBuilder req = MockMvcRequestBuilders.post("/customerCenter/orders/urPayOrdersLogList") .param("currPage", "1") .param("pageSize", "10") .param("dpId", "a") .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .characterEncoding("UTF-8"); try { ResultActions actions = this.mockMvc.perform(req).andExpect(new StatusResultMatchers().isOk()); System.out.println(actions.andReturn().getResponse().getContentAsString()); } catch (Exception e) { e.printStackTrace(); } }
@Test public void testQuery() { DefaultRequestBuilder requestBuilder = MockMvcRequestBuilders.post("/traderate/query") .body( "{\"content\":\"内容\",\"isExplainFlag\":\"true\",\"currPage\":\"1\",\"pageSize\":\"1\"}" .getBytes()) .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON) .characterEncoding("UTF-8"); try { ResultActions action = this.mockMvc.perform(requestBuilder).andExpect(new StatusResultMatchers().isOk()); action.andReturn().getResponse().setCharacterEncoding("UTF-8"); System.out.println(action.andReturn().getResponse().getContentAsString()); } catch (Exception e) { e.printStackTrace(); } }
@Test public void getAutoSetTest() { String dp_id = "100571094"; DefaultRequestBuilder requestBuilder = MockMvcRequestBuilders.get("/ordermonitor/orders/orderMonitor30"); requestBuilder.characterEncoding("UTF-8"); requestBuilder.param("dpId", dp_id); requestBuilder.contentType(MediaType.APPLICATION_JSON); requestBuilder.accept(MediaType.APPLICATION_JSON); try { ResultActions action = this.mockMvc.perform(requestBuilder).andExpect(new StatusResultMatchers().isOk()); action.andReturn().getResponse().setCharacterEncoding("UTF-8"); System.out.println(action.andReturn().getResponse().getContentAsString()); } catch (Exception e) { e.printStackTrace(); } }