예제 #1
0
  @Test
  public void services() throws Exception {
    Service s = makeService("serviceName", "http://abc123456.com", "message", ServiceStatus.Ok);
    when(serviceService.all()).thenReturn(Arrays.asList(s));

    mockMvc
        .perform(get("/service"))
        .andExpect(status().isOk())
        .andExpect(jsonPath("$", hasSize(1)))
        .andExpect(jsonPath("$[0].id", is(s.getId().toString())))
        .andExpect(jsonPath("$[0].dashboardId", is(s.getDashboardId().toString())))
        .andExpect(jsonPath("$[0].lastUpdated", is(s.getLastUpdated())))
        .andExpect(jsonPath("$[0].applicationName", is(s.getApplicationName())))
        .andExpect(jsonPath("$[0].name", is(s.getName())))
        .andExpect(jsonPath("$[0].url", is(s.getUrl())))
        .andExpect(jsonPath("$[0].message", is(s.getMessage())))
        .andExpect(jsonPath("$[0].status", is(s.getStatus().toString())));
  }