@Test public void testGetAllUser() throws Exception { _dbInjecter.injectUser("Adam"); _dbInjecter.injectUser("Bert"); _dbInjecter.injectUser("Claus"); String userToken = _tokenAuthenticationService.getTokenFromUser(_userRepository.findById(1L).orElse(null)); mockMvc.perform(get("/users").accept("application/json").header("X-AUTH-TOKEN", userToken)).andExpect(status().isOk()).andExpect(jsonPath("$.[0].name").value("Adam")) .andExpect(jsonPath("$.[1].name").value("Bert")).andExpect(jsonPath("$.[2].name").value("Claus")); }
@RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) public Iterable<User> getAllUser() { return _userRepository.findAllByOrderByNameAsc(); }
UserController { @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) public Iterable<User> getAllUser() { return _userRepository.findAllByOrderByNameAsc(); } }
UserController { @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) public Iterable<User> getAllUser() { return _userRepository.findAllByOrderByNameAsc(); }  }
UserController { @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) public Iterable<User> getAllUser() { return _userRepository.findAllByOrderByNameAsc(); }  @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) Iterable<User> getAllUser(); @RequestMapping(value = Uris.USERNAME_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateUsername(@RequestParam long userId, @RequestParam String newUsername); @RequestMapping(value = Uris.MAIL_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateMailaddress(@RequestParam long userId, @RequestParam String newMail); @RequestMapping(value = Uris.ACTIVE_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateActiveFlag(@RequestParam long userId, @RequestParam boolean activeFlag); @RequestMapping(value = Uris.BANNED_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateBannedFlag(@RequestParam long userId, @RequestParam boolean bannedFlag); @RequestMapping(value = Uris.ROLE_ADMIN_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateAdminRole(@RequestParam long userId, @RequestParam boolean shouldBeAdmin); @RequestMapping(value = Uris.ROLE_ARTICLE_MANAGER_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateArticleManagerRole(@RequestParam long userId, @RequestParam boolean shouldBeArticleManager); }
UserController { @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) public Iterable<User> getAllUser() { return _userRepository.findAllByOrderByNameAsc(); }  @RequestMapping(value = "/users", method = RequestMethod.GET) @JsonView(Views.OverviewUser.class) Iterable<User> getAllUser(); @RequestMapping(value = Uris.USERNAME_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateUsername(@RequestParam long userId, @RequestParam String newUsername); @RequestMapping(value = Uris.MAIL_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateMailaddress(@RequestParam long userId, @RequestParam String newMail); @RequestMapping(value = Uris.ACTIVE_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateActiveFlag(@RequestParam long userId, @RequestParam boolean activeFlag); @RequestMapping(value = Uris.BANNED_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateBannedFlag(@RequestParam long userId, @RequestParam boolean bannedFlag); @RequestMapping(value = Uris.ROLE_ADMIN_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateAdminRole(@RequestParam long userId, @RequestParam boolean shouldBeAdmin); @RequestMapping(value = Uris.ROLE_ARTICLE_MANAGER_CHANGE, method = RequestMethod.POST) ResponseEntity<?> updateArticleManagerRole(@RequestParam long userId, @RequestParam boolean shouldBeArticleManager);  }