@Test
public void processMessageShouldSendFirmwareFile() throws JMSException {

    // arrange
    final String correlationUid = "corr-uid-1";
    final String organisationIdentification = "test-org";
    final String deviceIdentification = "dvc-1";
    final String firmwareFileIdentification = "fw";
    final byte[] firmwareFileBytes = firmwareFileIdentification.getBytes();
    final RequestMessage requestMessage = new RequestMessage(correlationUid, organisationIdentification,
            deviceIdentification, firmwareFileIdentification);
    final ObjectMessage message = new ObjectMessageBuilder().withCorrelationUid(correlationUid)
            .withMessageType(DeviceFunction.GET_FIRMWARE_FILE.name()).withDeviceIdentification(deviceIdentification)
            .withObject(requestMessage).build();
    when(this.deviceMock.getDeviceIdentification()).thenReturn(deviceIdentification);
    when(this.deviceRepository.findByDeviceIdentification(deviceIdentification)).thenReturn(this.deviceMock);
    when(this.firmwareFileMock.getFilename()).thenReturn(firmwareFileIdentification);
    when(this.firmwareFileMock.getFile()).thenReturn(firmwareFileBytes);
    when(this.firmwareFileRepository.findByIdentification(firmwareFileIdentification)).thenReturn(this.firmwareFileMock);
    final byte[] expectedFile = firmwareFileBytes;
    final String expectedMessageType = DeviceFunction.GET_FIRMWARE_FILE.name();
    final ArgumentCaptor<ProtocolResponseMessage> responseMessageArgumentCaptor = ArgumentCaptor
            .forClass(ProtocolResponseMessage.class);
    final ArgumentCaptor<String> messageTypeCaptor = ArgumentCaptor.forClass(String.class);
    // act
    this.getFirmwareFileMessageProcessor.processMessage(message);
    // assert
    verify(this.protocolResponseMessageSender, times(1)).send(responseMessageArgumentCaptor.capture(),
            messageTypeCaptor.capture(), any(ProtocolInfo.class), any(MessageMetadata.class));
    final byte[] actualFile = ((FirmwareFileDto) responseMessageArgumentCaptor.getValue().getDataObject())
            .getFirmwareFile();
    final String actualMessageType = messageTypeCaptor.getValue();
    assertArrayEquals(expectedFile, actualFile);
    assertEquals(expectedMessageType, actualMessageType);
}