@Test(expected = RuntimeException.class) public void test_should_raise_run_time_exception_when_sending_message_to_topic_fails() { final String mobileNumber = "mobileNumber"; final String tenantId = "tenantId"; final String otpNumber = "otpNumber"; final OtpRequestType type = OtpRequestType.REGISTER; final OtpRequest otpRequest = new OtpRequest(mobileNumber, tenantId, type, "CITIZEN"); final String expectedMessage = "Use OTP otpNumber for portal registration."; final SMSRequest expectedSmsRequest = new SMSRequest(mobileNumber, expectedMessage); when(kafkaTemplate.send(eq(SMS_TOPIC), argThat(new SmsRequestMatcher(expectedSmsRequest)))) .thenThrow(new InterruptedException()); otpSMSRepository.send(otpRequest, otpNumber); }
public void send(OtpRequest otpRequest, String otpNumber) { final String message = getMessage(otpNumber, otpRequest); kafkaTemplate.send(smsTopic, new SMSRequest(otpRequest.getMobileNumber(), message)); }
OtpSMSRepository { public void send(OtpRequest otpRequest, String otpNumber) { final String message = getMessage(otpNumber, otpRequest); kafkaTemplate.send(smsTopic, new SMSRequest(otpRequest.getMobileNumber(), message)); } }
OtpSMSRepository { public void send(OtpRequest otpRequest, String otpNumber) { final String message = getMessage(otpNumber, otpRequest); kafkaTemplate.send(smsTopic, new SMSRequest(otpRequest.getMobileNumber(), message)); } @Autowired  OtpSMSRepository(CustomKafkaTemplate<String, SMSRequest> kafkaTemplate,
			@Value("${sms.topic}") String smsTopic); }
OtpSMSRepository { public void send(OtpRequest otpRequest, String otpNumber) { final String message = getMessage(otpNumber, otpRequest); kafkaTemplate.send(smsTopic, new SMSRequest(otpRequest.getMobileNumber(), message)); } @Autowired  OtpSMSRepository(CustomKafkaTemplate<String, SMSRequest> kafkaTemplate,
			@Value("${sms.topic}") String smsTopic); void send(OtpRequest otpRequest, String otpNumber); }
OtpSMSRepository { public void send(OtpRequest otpRequest, String otpNumber) { final String message = getMessage(otpNumber, otpRequest); kafkaTemplate.send(smsTopic, new SMSRequest(otpRequest.getMobileNumber(), message)); } @Autowired  OtpSMSRepository(CustomKafkaTemplate<String, SMSRequest> kafkaTemplate,
			@Value("${sms.topic}") String smsTopic); void send(OtpRequest otpRequest, String otpNumber);  }