@Test public void shouldNotFinalizeRegistration() { FinalizeRegistrationInput input = new FinalizeRegistrationInput().token("token").password("P4s5vv0Rd") .firstname("Firstname").lastname("LASTNAME"); RegisterUserEntity registerUserEntity = new RegisterUserEntity(); doReturn(registerUserEntity).when(userMapper).convert(input); doReturn(null).when(userService).finalizeRegistration(registerUserEntity); final Response response = target("registration/_finalize").request().post(Entity.json(input)); assertEquals(HttpStatusCode.INTERNAL_SERVER_ERROR_500, response.getStatus()); Mockito.verify(userMapper).convert(input); Mockito.verify(userService).finalizeRegistration(registerUserEntity); }
@POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput) { UserEntity newUser = userService.finalizeRegistration(userMapper.convert(finalizeRegistrationInput)); if (newUser != null) { return Response.ok().entity(userMapper.convert(newUser)).build(); } return Response.serverError().build(); }
UsersResource extends AbstractResource { @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput) { UserEntity newUser = userService.finalizeRegistration(userMapper.convert(finalizeRegistrationInput)); if (newUser != null) { return Response.ok().entity(userMapper.convert(newUser)).build(); } return Response.serverError().build(); } }
UsersResource extends AbstractResource { @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput) { UserEntity newUser = userService.finalizeRegistration(userMapper.convert(finalizeRegistrationInput)); if (newUser != null) { return Response.ok().entity(userMapper.convert(newUser)).build(); } return Response.serverError().build(); }  }
UsersResource extends AbstractResource { @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput) { UserEntity newUser = userService.finalizeRegistration(userMapper.convert(finalizeRegistrationInput)); if (newUser != null) { return Response.ok().entity(userMapper.convert(newUser)).build(); } return Response.serverError().build(); }  @POST @Path("/registration") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerUser(@Valid @NotNull(message = "Input must not be null.") RegisterUserInput registerUserInput); @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput); @POST @Path("_reset_password") @Consumes(MediaType.APPLICATION_JSON) Response resetUserPassword(@NotNull(message = "Input must not be null.") @Valid ResetUserPasswordInput resetUserPasswordInput); @POST @Path("_search") @Produces(MediaType.APPLICATION_JSON) @Permissions({ @Permission(value = RolePermission.ORGANIZATION_USERS, acls = READ) }) Response getUsers(@QueryParam("q") String query, @BeanParam PaginationParam paginationParam); @GET @Path("/{userId}/avatar") Response getUserAvatar(@Context Request request, @PathParam("userId") String userId); }
UsersResource extends AbstractResource { @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput) { UserEntity newUser = userService.finalizeRegistration(userMapper.convert(finalizeRegistrationInput)); if (newUser != null) { return Response.ok().entity(userMapper.convert(newUser)).build(); } return Response.serverError().build(); }  @POST @Path("/registration") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response registerUser(@Valid @NotNull(message = "Input must not be null.") RegisterUserInput registerUserInput); @POST @Path("/registration/_finalize") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response finalizeRegistration(@Valid @NotNull(message = "Input must not be null.") FinalizeRegistrationInput finalizeRegistrationInput); @POST @Path("_reset_password") @Consumes(MediaType.APPLICATION_JSON) Response resetUserPassword(@NotNull(message = "Input must not be null.") @Valid ResetUserPasswordInput resetUserPasswordInput); @POST @Path("_search") @Produces(MediaType.APPLICATION_JSON) @Permissions({ @Permission(value = RolePermission.ORGANIZATION_USERS, acls = READ) }) Response getUsers(@QueryParam("q") String query, @BeanParam PaginationParam paginationParam); @GET @Path("/{userId}/avatar") Response getUserAvatar(@Context Request request, @PathParam("userId") String userId);  }