ResponseMessageRouter implements NotificationResponseMessageSender { @Override public void send(final ResponseMessage responseMessage, final String messageType) { final IntegrationType integrationType = this.getIntegrationType(responseMessage.getDeviceIdentification()); switch (integrationType) { case BOTH: this.kafkaResponseMessageSender.send(responseMessage, messageType); this.webServiceResponseMessageSender.send(responseMessage, messageType); break; case KAFKA: this.kafkaResponseMessageSender.send(responseMessage, messageType); break; default: this.webServiceResponseMessageSender.send(responseMessage, messageType); } }  @Override void send(final ResponseMessage responseMessage, final String messageType);  }
@Test void testSendDefault() { this.responseMessageRouter.send(MESSAGE, MESSAGE_TYPE); verify(this.webServiceResponseMessageSender).send(any(ResponseMessage.class), anyString()); }
@Test void testSendWebservice() throws FunctionalException { final Device device = this.createDevice(IntegrationType.WEB_SERVICE); when(this.deviceDomainService.searchDevice(anyString())).thenReturn(device); this.responseMessageRouter.send(MESSAGE, MESSAGE_TYPE); verify(this.webServiceResponseMessageSender).send(any(ResponseMessage.class), anyString()); }
@Test void testSendKafka() throws FunctionalException { final Device device = this.createDevice(IntegrationType.KAFKA); when(this.deviceDomainService.searchDevice(anyString())).thenReturn(device); this.responseMessageRouter.send(MESSAGE, MESSAGE_TYPE); verify(this.kafkaResponseMessageSender).send(any(ResponseMessage.class), anyString()); }
@Test void testSendBoth() throws FunctionalException { final Device device = this.createDevice(IntegrationType.BOTH); when(this.deviceDomainService.searchDevice(anyString())).thenReturn(device); this.responseMessageRouter.send(MESSAGE, MESSAGE_TYPE); verify(this.webServiceResponseMessageSender).send(any(ResponseMessage.class), anyString()); verify(this.kafkaResponseMessageSender).send(any(ResponseMessage.class), anyString()); }