package com.demo.wjj.controller; import org.junit.Test; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * @author wangqing * @date 2018.11.11 */ public class DictionaryControllerTest extends BaseTest { @Test public void queryDeviceType() throws Exception { this.mockMvc.perform(get("/dic/getDeviceType")) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.length()").value(1)) .andExpect(jsonPath("$.data[0].code").value("DT01")) .andExpect(jsonPath("$.data[0].name").value("挖掘机")); } @Test public void queryConfigInstructions() throws Exception { this.mockMvc.perform(get("/dic/getConfigInstructions")) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.length()").value(2)) .andExpect(jsonPath("$.data[0].code").value("CI01")) .andExpect(jsonPath("$.data[0].name").value("铲斗")) .andExpect(jsonPath("$.data[1].code").value("CI02")) .andExpect(jsonPath("$.data[1].name").value("破碎锤")); } @Test public void queryJobResume() throws Exception { this.mockMvc.perform(get("/dic/getJobResume")) .andExpect(status().isOk()) .andExpect(jsonPath("$.data.length()").value(2)) .andExpect(jsonPath("$.data[0].code").value("JR01")) .andExpect(jsonPath("$.data[0].name").value("挖掘作业")) .andExpect(jsonPath("$.data[1].code").value("JR02")) .andExpect(jsonPath("$.data[1].name").value("破碎作业")); } }