@Test public void test_should_validate_otp_request_for_user_login() { final OtpRequest otpRequest = mock(OtpRequest.class); when(otpRequest.isLoginRequestType()).thenReturn(true); when(userRepository.fetchUser(anyString(), anyString(), anyString())).thenReturn(new User(1L, "foo@bar.com", "123")); otpService.sendOtp(otpRequest); verify(otpRequest).validate(); }
public void sendOtp(OtpRequest otpRequest) { otpRequest.validate(); if (otpRequest.isRegistrationRequestType() || otpRequest.isLoginRequestType()) { sendOtpForUserRegistration(otpRequest); } else { sendOtpForPasswordReset(otpRequest); } }
OtpService { public void sendOtp(OtpRequest otpRequest) { otpRequest.validate(); if (otpRequest.isRegistrationRequestType() || otpRequest.isLoginRequestType()) { sendOtpForUserRegistration(otpRequest); } else { sendOtpForPasswordReset(otpRequest); } } }
OtpService { public void sendOtp(OtpRequest otpRequest) { otpRequest.validate(); if (otpRequest.isRegistrationRequestType() || otpRequest.isLoginRequestType()) { sendOtpForUserRegistration(otpRequest); } else { sendOtpForPasswordReset(otpRequest); } } @Autowired  OtpService(OtpRepository otpRepository, OtpSMSRepository otpSMSSender, OtpEmailRepository otpEmailRepository,
			UserRepository userRepository); }
OtpService { public void sendOtp(OtpRequest otpRequest) { otpRequest.validate(); if (otpRequest.isRegistrationRequestType() || otpRequest.isLoginRequestType()) { sendOtpForUserRegistration(otpRequest); } else { sendOtpForPasswordReset(otpRequest); } } @Autowired  OtpService(OtpRepository otpRepository, OtpSMSRepository otpSMSSender, OtpEmailRepository otpEmailRepository,
			UserRepository userRepository); void sendOtp(OtpRequest otpRequest); }
OtpService { public void sendOtp(OtpRequest otpRequest) { otpRequest.validate(); if (otpRequest.isRegistrationRequestType() || otpRequest.isLoginRequestType()) { sendOtpForUserRegistration(otpRequest); } else { sendOtpForPasswordReset(otpRequest); } } @Autowired  OtpService(OtpRepository otpRepository, OtpSMSRepository otpSMSSender, OtpEmailRepository otpEmailRepository,
			UserRepository userRepository); void sendOtp(OtpRequest otpRequest);  }