DictionaryControllerTest.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.demo.wjj.controller;
  2. import org.junit.Test;
  3. import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
  4. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
  5. /**
  6. * @author wangqing
  7. * @date 2018.11.11
  8. */
  9. public class DictionaryControllerTest extends BaseTest {
  10. @Test
  11. public void queryDeviceType() throws Exception {
  12. this.mockMvc.perform(get("/dic/getDeviceType"))
  13. .andExpect(status().isOk())
  14. .andExpect(jsonPath("$.data.length()").value(1))
  15. .andExpect(jsonPath("$.data[0].code").value("DT01"))
  16. .andExpect(jsonPath("$.data[0].name").value("挖掘机"));
  17. }
  18. @Test
  19. public void queryConfigInstructions() throws Exception {
  20. this.mockMvc.perform(get("/dic/getConfigInstructions"))
  21. .andExpect(status().isOk())
  22. .andExpect(jsonPath("$.data.length()").value(2))
  23. .andExpect(jsonPath("$.data[0].code").value("CI01"))
  24. .andExpect(jsonPath("$.data[0].name").value("铲斗"))
  25. .andExpect(jsonPath("$.data[1].code").value("CI02"))
  26. .andExpect(jsonPath("$.data[1].name").value("破碎锤"));
  27. }
  28. @Test
  29. public void queryJobResume() throws Exception {
  30. this.mockMvc.perform(get("/dic/getJobResume"))
  31. .andExpect(status().isOk())
  32. .andExpect(jsonPath("$.data.length()").value(2))
  33. .andExpect(jsonPath("$.data[0].code").value("JR01"))
  34. .andExpect(jsonPath("$.data[0].name").value("挖掘作业"))
  35. .andExpect(jsonPath("$.data[1].code").value("JR02"))
  36. .andExpect(jsonPath("$.data[1].name").value("破碎作业"));
  37. }
  38. }