UserRegistrationRestController implements ResourceProcessor<RepositoryLinksResource> { @RequestMapping(RestApiConstants.SEARCH_RESOURCE) public ResponseEntity<UserRegistrationResource> searchRegistration(@RequestParam String token) { User user = userService.findByRegistrationConfirmationToken(token); if (user == null) { return new ResponseEntity<>(HttpStatus.NOT_FOUND); } return new ResponseEntity<>(new UserRegistrationResource(user), HttpStatus.OK); }  @RequestMapping(RestApiConstants.SEARCH_RESOURCE) ResponseEntity<UserRegistrationResource> searchRegistration(@RequestParam String token); @RequestMapping(method = RequestMethod.GET) RegistrationsResource getResource(); @RequestMapping(method = RequestMethod.POST) ResponseEntity<UserRegistrationResource> registerUser(@RequestBody UserRegistrationApiData
                                                                             userRegistration); @RequestMapping(value = "{token}/confirm", method = RequestMethod.POST) ResponseEntity confirmRegistration(@PathVariable("token") String registrationConfirmationToken); @Override RepositoryLinksResource process(RepositoryLinksResource resource);  }
@Test public void testSearchRegistration() { ResponseEntity<UserRegistrationApiData> registrationResponse = executeTestRegistration(); UserRegistrationsResource.UserRegistrationSearchResultResource registrationSearchResultResource = service() .userRegistrations() .findByToken(registrationResponse.getBody().getRegistrationConfirmationToken()); UserRegistrationApiData registrationData = registrationSearchResultResource.read(); assertThat(registrationData, is(notNullValue())); assertThat(registrationData.getUsername(), is("test")); }