message.setStringProperty(LENGTH10STRING, LENGTH10STRING);
producer.send(message);
messageList.assertMessagesArrived(1);
ActiveMQTextMessage received = ((ActiveMQTextMessage) messageList
.flushMessages().get(0));
assertEquals(LENGTH10STRING, received.getText());
assertTrue(received.getProperties().size() > 0);
assertTrue(received.propertyExists(LENGTH10STRING));
assertEquals(LENGTH10STRING, received.getStringProperty(LENGTH10STRING));
/**
* As specified by getSize(), the size (memory usage) of the body should
* be length of text * 2. Unsure of how memory usage is calculated for
* properties, but should probably not be less than the sum of (string)
* lengths for the key name and value.
*/
final int sizeShouldBeNoLessThan = LENGTH10STRING.length() * 4 + received.DEFAULT_MINIMUM_MESSAGE_SIZE;
assertTrue("Message size was smaller than expected: " + received.getSize(),
received.getSize() >= sizeShouldBeNoLessThan);
assertFalse(LENGTH10STRING.length() * 2 == received.getSize());
}