EmployeeRestController { @RequestMapping(value = "/count", method = RequestMethod.GET) @ResponseBody public long getEmployeeCount() { return presentationEmployeeRepository.getEmployeeCount(); }  @RequestMapping(method = RequestMethod.GET) @ResponseBody List<EmployeeTo> getEmployees(@RequestParam int page, @RequestParam int pageSize); @RequestMapping(value = "/count", method = RequestMethod.GET) @ResponseBody long getEmployeeCount(); @RequestMapping(value = "/{employeeId}/details", method = RequestMethod.GET) @ResponseBody EmployeeTo getEmployeeDetails(@PathVariable(value = "employeeId") Long employeeId); @RequestMapping(value = "/{employeeId}/taxes", method = RequestMethod.GET) @ResponseBody List<EmployeeTaxTo> getEmployeeTaxes(@PathVariable(value = "employeeId") Long employeeId);  }
@Test public void givenOneEmployee_whenGetEmployeeCount_thenReturnCorrectJson() throws Exception { when(presentationEmployeeRepository.getEmployeeCount()).thenReturn(1L); MvcResult mvcResult = mockMvc.perform(get("/employees/count").contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andReturn(); String actualResult = mvcResult.getResponse().getContentAsString(); assertThat(actualResult).isEqualTo("1"); }