DomainResponseMessageProcessor implements MessageProcessor { @Override public void processMessage(final ObjectMessage message) { LOGGER.debug("Processing distribution automation response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String notificationMessage; NotificationType notificationType; ResponseMessageResultType resultType; String resultDescription; Serializable dataObject; try { correlationUid = message.getJMSCorrelationID(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); messageType = message.getJMSType(); validateMessageType(messageType); resultType = ResponseMessageResultType.valueOf(message.getStringProperty(Constants.RESULT)); resultDescription = message.getStringProperty(Constants.DESCRIPTION); notificationMessage = message.getStringProperty(Constants.DESCRIPTION); notificationType = NotificationType.valueOf(messageType); dataObject = message.getObject(); } catch (final IllegalArgumentException e) { LOGGER.error("UNRECOVERABLE ERROR, received messageType {} is unknown.", messageType, e); logDebugInformation(messageType, correlationUid, organisationIdentification, deviceIdentification); return; } catch (final JMSException e) { LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e); logDebugInformation(messageType, correlationUid, organisationIdentification, deviceIdentification); return; } try { LOGGER.info("Calling application service function to handle response: {}", messageType); final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid); this.handleMessage(ids, messageType, resultType, resultDescription, dataObject); this.notificationService.sendNotification(this.webserviceNotificationOrganisation, deviceIdentification, resultType.name(), correlationUid, notificationMessage, notificationType); } catch (final RuntimeException e) { handleError(e, correlationUid, notificationType); } }  @Override void processMessage(final ObjectMessage message);  }
@Test public void testProcessUnknownMessageTypeResponseMessage() throws JMSException { final ObjectMessage myMessage = Mockito.mock(ObjectMessage.class); when(myMessage.getJMSType()).thenReturn("FAKE_UNKNOWN_NOTIFICATION_TYPE"); this.responseMessageProcessor.processMessage(myMessage); verify(this.notificationService, times(0)).sendNotification(anyString(), anyString(), eq("OK"), anyString(), anyString(), any()); verify(this.responseDataService, times(0)).enqueue(any()); }