@Test @WithMockUser public void test_should_update_password_for_non_logged_in_user() throws Exception { mockMvc.perform(post("/password/nologin/_update") .contentType(MediaType.APPLICATION_JSON_UTF8) .content(resources.getFileContents("nonLoggedInUserUpdatePasswordRequest.json"))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) .andExpect(content().json(resources.getFileContents("updatePasswordResponse.json"))); final NonLoggedInUserUpdatePasswordRequest expectedRequest = NonLoggedInUserUpdatePasswordRequest.builder() .tenantId("tenant") .newPassword("newPassword") .otpReference("otpReference") .userName("userName") .build(); verify(userService).updatePasswordForNonLoggedInUser(expectedRequest); }
@PostMapping("/nologin/_update") public UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request) { userService.updatePasswordForNonLoggedInUser(request.toDomain()); return new UpdatePasswordResponse(ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build()); }
PasswordController { @PostMapping("/nologin/_update") public UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request) { userService.updatePasswordForNonLoggedInUser(request.toDomain()); return new UpdatePasswordResponse(ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build()); } }
PasswordController { @PostMapping("/nologin/_update") public UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request) { userService.updatePasswordForNonLoggedInUser(request.toDomain()); return new UpdatePasswordResponse(ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build()); } PasswordController(UserService userService); }
PasswordController { @PostMapping("/nologin/_update") public UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request) { userService.updatePasswordForNonLoggedInUser(request.toDomain()); return new UpdatePasswordResponse(ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build()); } PasswordController(UserService userService); @PostMapping("/_update") UpdatePasswordResponse updatePassword(@RequestBody LoggedInUserUpdatePasswordRequest request); @PostMapping("/nologin/_update") UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request); }
PasswordController { @PostMapping("/nologin/_update") public UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request) { userService.updatePasswordForNonLoggedInUser(request.toDomain()); return new UpdatePasswordResponse(ResponseInfo.builder().status(String.valueOf(HttpStatus.OK.value())).build()); } PasswordController(UserService userService); @PostMapping("/_update") UpdatePasswordResponse updatePassword(@RequestBody LoggedInUserUpdatePasswordRequest request); @PostMapping("/nologin/_update") UpdatePasswordResponse updatePasswordForNonLoggedInUser(@RequestBody NonLoggedInUserUpdatePasswordRequest request);  }