@Test(expected = NotImplementedException.class) public void test_should_throw_exception_when_matching_strategy_not_found() { when(sevaRequest.getServiceTypeName()).thenReturn("name"); when(sevaRequest.getCrn()).thenReturn("crn"); when(sevaRequest.getStatusName()).thenReturn("Registerd"); when(sevaRequest.getMobileNumber()).thenReturn("mobileNumber"); final List<String> keywords = Collections.singletonList("COMPLAINT"); final ServiceType serviceType = new ServiceType("serviceName", keywords); when(smsMessageStrategy1.matches(any())).thenReturn(false); when(smsMessageStrategy2.matches(any())).thenReturn(false); final Tenant tenant = new Tenant("name", "grade"); final NotificationContext context = NotificationContext.builder() .sevaRequest(sevaRequest) .serviceType(serviceType) .tenant(tenant) .build(); smsService.send(context); verify(messageQueueRepository).sendSMS(new SMSRequest("smsMessage", "mobileNumber")); }
public void send(NotificationContext context) { final List<SMSRequest> smsRequests = getSMSRequests(context); smsRequests.forEach(smsRequest -> messageQueueRepository.sendSMS(smsRequest)); }
SMSService { public void send(NotificationContext context) { final List<SMSRequest> smsRequests = getSMSRequests(context); smsRequests.forEach(smsRequest -> messageQueueRepository.sendSMS(smsRequest)); } }
SMSService { public void send(NotificationContext context) { final List<SMSRequest> smsRequests = getSMSRequests(context); smsRequests.forEach(smsRequest -> messageQueueRepository.sendSMS(smsRequest)); } SMSService(TemplateService templateService,
                      MessageQueueRepository messageQueueRepository,
                      @Qualifier("smsMessageStrategies") List<SMSMessageStrategy> messageStrategyList); }
SMSService { public void send(NotificationContext context) { final List<SMSRequest> smsRequests = getSMSRequests(context); smsRequests.forEach(smsRequest -> messageQueueRepository.sendSMS(smsRequest)); } SMSService(TemplateService templateService,
                      MessageQueueRepository messageQueueRepository,
                      @Qualifier("smsMessageStrategies") List<SMSMessageStrategy> messageStrategyList); void send(NotificationContext context); }
SMSService { public void send(NotificationContext context) { final List<SMSRequest> smsRequests = getSMSRequests(context); smsRequests.forEach(smsRequest -> messageQueueRepository.sendSMS(smsRequest)); } SMSService(TemplateService templateService,
                      MessageQueueRepository messageQueueRepository,
                      @Qualifier("smsMessageStrategies") List<SMSMessageStrategy> messageStrategyList); void send(NotificationContext context);  }