UserMetricsController { @Secured({Roles.ROLE_USER}) @RequestMapping(method = RequestMethod.GET) public UserMetrics getUserMetrics() { List<UserEntity> users = userRepository.findAll(); return new UserMetrics(users); }  @Secured({Roles.ROLE_USER}) @RequestMapping(method = RequestMethod.GET) UserMetrics getUserMetrics();  }
@Test public void testGetUserMetrics() throws Exception { final MvcResult mvcResult = mockMvc.perform(get("/users/metrics")) .andExpect(status().isOk()) .andReturn(); assertThat(mvcResult.getResponse().getContentAsString(), is("{\"count\":3,\"remainingBudget\":33}")); verify(userRepository).findAll(); }