У меня есть тестовый env .: [REST API] -> [RabbitMQ], и я пытаюсь отправить файл (с несколькими частями) в REST API и напрямую прочитать из RabbitMQ:
* bytes expectedPayload = read('flask.png')
And multipart file file = { read: 'flask.png', contentType: 'application/json' }
And multipart field message = { messageFlowName: 'TestMSGFlow', moduleInstanceId: 5 }
When method POST
Then status 200
...
* bytes receivedPayload = amqpConnection.getMessagePayload('test.rabbitmq.queue', 'testChannel')
And match receivedPayload == read('flask.png')
amqpConnection.getMessagePayloadМетод:
public byte[] getMessagePayload(String queueName, Channel channel) {
byte[] message = null;
try {
GetResponse response = channel.basicGet(queueName, true);
if (response == null) {
System.out.println("DEBUG: No message found.");
} else {
AMQP.BasicProperties props = response.getProps();
return response.getBody();
}
} catch (IOException e) {
e.printStackTrace();
}
return message;
}
Я получаю результат:
actual: [B@64b70919, expected: [B@4e31c3ec, reason: actual and expected byte-arrays are not equal
Я пытался использовать * .json вместо * .png (в качестве тестового файла), и он работает хорошо,Как заставить работать с * .png тоже?