@Test public void testFindUserDetailsByUsername() throws Exception { mockMvc.perform(get("/users/search/findUserDetailsByUsername").param("username", testUser.getEmail().get()) .accept(HAL_JSON)).andDo(new ResultHandler() { @Override public void handle(MvcResult findResult) throws Exception { String body = findResult.getResponse().getContentAsString(); UserIdAwareUserDetails userDetails = OBJECT_MAPPER.readValue(body, UserIdAwareUserDetails.class); assertEquals(authority.getRole().name(), userDetails.getAuthorities().iterator().next().getAuthority()); } }); }
@RequestMapping(value = "/findUserDetailsByUsername", method = GET) ResponseEntity<Resource<UserDetails>> findUserDetailsByUsername(@RequestParam("username") String username) { UserDetails userDetails = authorityRepository.loadUserByUsername(username); Resource<UserDetails> userDetailsResource = new Resource<>(userDetails); return new ResponseEntity<>(userDetailsResource, OK); }
UserController { @RequestMapping(value = "/findUserDetailsByUsername", method = GET) ResponseEntity<Resource<UserDetails>> findUserDetailsByUsername(@RequestParam("username") String username) { UserDetails userDetails = authorityRepository.loadUserByUsername(username); Resource<UserDetails> userDetailsResource = new Resource<>(userDetails); return new ResponseEntity<>(userDetailsResource, OK); } }
UserController { @RequestMapping(value = "/findUserDetailsByUsername", method = GET) ResponseEntity<Resource<UserDetails>> findUserDetailsByUsername(@RequestParam("username") String username) { UserDetails userDetails = authorityRepository.loadUserByUsername(username); Resource<UserDetails> userDetailsResource = new Resource<>(userDetails); return new ResponseEntity<>(userDetailsResource, OK); }  }
UserController { @RequestMapping(value = "/findUserDetailsByUsername", method = GET) ResponseEntity<Resource<UserDetails>> findUserDetailsByUsername(@RequestParam("username") String username) { UserDetails userDetails = authorityRepository.loadUserByUsername(username); Resource<UserDetails> userDetailsResource = new Resource<>(userDetails); return new ResponseEntity<>(userDetailsResource, OK); }   }
UserController { @RequestMapping(value = "/findUserDetailsByUsername", method = GET) ResponseEntity<Resource<UserDetails>> findUserDetailsByUsername(@RequestParam("username") String username) { UserDetails userDetails = authorityRepository.loadUserByUsername(username); Resource<UserDetails> userDetailsResource = new Resource<>(userDetails); return new ResponseEntity<>(userDetailsResource, OK); }    }