@Test public void test_should_send_email_message() { final EmailMessage expectedEmailMessage = EmailMessage.builder() .subject("Password Reset") .body("Your OTP for recovering password is otpNumber.") .sender("") .email("foo@bar.com") .build(); repository.send("foo@bar.com", "otpNumber"); verify(kakfaTemplate).send(EMAIL_TOPIC, expectedEmailMessage); }
public void send(String email, String otpNumber) { if (isEmpty(email)) { return; } sendEmail(email, otpNumber); }
OtpEmailRepository { public void send(String email, String otpNumber) { if (isEmpty(email)) { return; } sendEmail(email, otpNumber); } }
OtpEmailRepository { public void send(String email, String otpNumber) { if (isEmpty(email)) { return; } sendEmail(email, otpNumber); } @Autowired  OtpEmailRepository(CustomKafkaTemplate<String, EmailMessage> kafkaTemplate,
							  @Value("${email.topic}") String emailTopic); }
OtpEmailRepository { public void send(String email, String otpNumber) { if (isEmpty(email)) { return; } sendEmail(email, otpNumber); } @Autowired  OtpEmailRepository(CustomKafkaTemplate<String, EmailMessage> kafkaTemplate,
							  @Value("${email.topic}") String emailTopic); void send(String email, String otpNumber); }
OtpEmailRepository { public void send(String email, String otpNumber) { if (isEmpty(email)) { return; } sendEmail(email, otpNumber); } @Autowired  OtpEmailRepository(CustomKafkaTemplate<String, EmailMessage> kafkaTemplate,
							  @Value("${email.topic}") String emailTopic); void send(String email, String otpNumber);  }