assertEquals("Intermediate bytes and compressed source must have same size", compressedBytes.length,
intermediateSize);
// now test the other way around: getting the byte[] from a manually created
// BytesMessage
AbstractJmsTransformer trans2 = new JMSMessageToObject();
trans2.setReturnClass(byte[].class);
BytesMessage bMsg = session.createBytesMessage();
bMsg.writeBytes(compressedBytes);
Object result = trans2.transform(bMsg);
assertTrue("Transformed object should be a byte[]", result instanceof byte[]);
assertTrue("Result should be compressed", compressor.isCompressed((byte[])result));
assertTrue("Source and result should be equal", Arrays.equals(compressedBytes, (byte[])result));
}