@Test(expected = RuntimeException.class) public void test_should_throw_runtime_exception_when_send_sms_message_fails() { final String mobileNumber = "mobileNumber"; final String smsMessage = "smsMessage"; final SmsMessage expectedSMSMessage = new SmsMessage(mobileNumber, smsMessage); when(kafkaTemplate.send(SMS_TOPIC, expectedSMSMessage)).thenThrow(new RuntimeException()); messageQueueRepository.sendSMS(new SMSRequest(smsMessage, mobileNumber)); }
public void sendSMS(SMSRequest smsRequest) { final SmsMessage smsMessage = new SmsMessage(smsRequest.getMobileNumber(), smsRequest.getMessage()); sendMessage(smsTopic, smsMessage); }
MessageQueueRepository { public void sendSMS(SMSRequest smsRequest) { final SmsMessage smsMessage = new SmsMessage(smsRequest.getMobileNumber(), smsRequest.getMessage()); sendMessage(smsTopic, smsMessage); } }
MessageQueueRepository { public void sendSMS(SMSRequest smsRequest) { final SmsMessage smsMessage = new SmsMessage(smsRequest.getMobileNumber(), smsRequest.getMessage()); sendMessage(smsTopic, smsMessage); } MessageQueueRepository(LogAwareKafkaTemplate<String, Object> kafkaTemplate,
                                  @Value("${sms.topic}") String smsTopic,
                                  @Value("${email.topic}") String emailTopic); }
MessageQueueRepository { public void sendSMS(SMSRequest smsRequest) { final SmsMessage smsMessage = new SmsMessage(smsRequest.getMobileNumber(), smsRequest.getMessage()); sendMessage(smsTopic, smsMessage); } MessageQueueRepository(LogAwareKafkaTemplate<String, Object> kafkaTemplate,
                                  @Value("${sms.topic}") String smsTopic,
                                  @Value("${email.topic}") String emailTopic); void sendSMS(SMSRequest smsRequest); void sendEmail(EmailRequest emailRequest); }
MessageQueueRepository { public void sendSMS(SMSRequest smsRequest) { final SmsMessage smsMessage = new SmsMessage(smsRequest.getMobileNumber(), smsRequest.getMessage()); sendMessage(smsTopic, smsMessage); } MessageQueueRepository(LogAwareKafkaTemplate<String, Object> kafkaTemplate,
                                  @Value("${sms.topic}") String smsTopic,
                                  @Value("${email.topic}") String emailTopic); void sendSMS(SMSRequest smsRequest); void sendEmail(EmailRequest emailRequest);  }