@Test public void test_should_return_error_response_when_user_not_found_for_sending_forgot_password_otp() throws Exception { final OtpRequest expectedOtpRequest = new OtpRequest("", "", null, "CITIZEN"); doThrow(new UserNotFoundException()).when(otpService).sendOtp(expectedOtpRequest); mockMvc.perform(post("/v1/_send").contentType(MediaType.APPLICATION_JSON_UTF8) .content(resources.getFileContents("otpRequestWithoutMandatoryFields.json"))) .andExpect(status().isBadRequest()) .andExpect(content().json(resources.getFileContents("unknownMobileNumberErrorResponse.json"))); }
@PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) public OtpResponse sendOtp(@RequestBody OtpRequest otpRequest) { otpService.sendOtp(otpRequest.toDomain()); return new OtpResponse(null, true); }
OtpController { @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) public OtpResponse sendOtp(@RequestBody OtpRequest otpRequest) { otpService.sendOtp(otpRequest.toDomain()); return new OtpResponse(null, true); } }
OtpController { @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) public OtpResponse sendOtp(@RequestBody OtpRequest otpRequest) { otpService.sendOtp(otpRequest.toDomain()); return new OtpResponse(null, true); } @Autowired  OtpController(OtpService otpService); }
OtpController { @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) public OtpResponse sendOtp(@RequestBody OtpRequest otpRequest) { otpService.sendOtp(otpRequest.toDomain()); return new OtpResponse(null, true); } @Autowired  OtpController(OtpService otpService); @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) OtpResponse sendOtp(@RequestBody OtpRequest otpRequest); }
OtpController { @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) public OtpResponse sendOtp(@RequestBody OtpRequest otpRequest) { otpService.sendOtp(otpRequest.toDomain()); return new OtpResponse(null, true); } @Autowired  OtpController(OtpService otpService); @PostMapping("/v1/_send") @ResponseStatus(HttpStatus.CREATED) OtpResponse sendOtp(@RequestBody OtpRequest otpRequest);  }