@Test public void test_should_return_success_response_when_otp_is_sent() throws Exception { mockMvc.perform(post("/v1/_send").contentType(MediaType.APPLICATION_JSON_UTF8) .content(resources.getFileContents("otpSendRequest.json"))).andExpect(status().isCreated()) .andExpect(content().json(resources.getFileContents("otpSendSuccessResponse.json"))); final OtpRequest expectedOtpRequest = new OtpRequest("mobileNumber", "tenantId", OtpRequestType.PASSWORD_RESET, "CITIZEN"); verify(otpService).sendOtp(expectedOtpRequest); }
@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);  }