use of org.opensmartgridplatform.adapter.protocol.iec60870.testutils.matchers.ErrorResponseMessageMatcher in project open-smart-grid-platform by OSGP.
the class DeviceRequestMessageListenerTest method shouldSendErrorMessageWhenMessageTypeIsNotSupported.
@Test
void shouldSendErrorMessageWhenMessageTypeIsNotSupported() throws JMSException {
// Arrange
final String correlationUid = DEFAULT_CORRELATION_UID;
final ObjectMessage message = new ObjectMessageBuilder().withCorrelationUid(correlationUid).withDeviceIdentification(DEFAULT_DEVICE_IDENTIFICATION).withMessageType(DEFAULT_MESSAGE_TYPE).withObject(new GetHealthStatusRequestDto()).build();
when(this.iec60870RequestMessageProcessorMap.getMessageProcessor(message)).thenThrow(JMSException.class);
// Act
this.deviceRequestMessageListener.onMessage(message);
// Assert
verify(this.pendingRequestsQueue).enqueue(DEFAULT_DEVICE_IDENTIFICATION, correlationUid);
verify(this.pendingRequestsQueue).remove(DEFAULT_DEVICE_IDENTIFICATION, correlationUid);
verify(this.deviceResponseMessageSender).send(argThat(new ErrorResponseMessageMatcher()));
}
Aggregations