Map p = new HashMap();
p.put("Key1", "Value1");
p.put("Key2", new byte[]{1,2,3});
p.put("Key3", new Double(99.999));
p.put("Key4", new Orange());
AbstractJmsTransformer trans = new SessionEnabledObjectToJMSMessage(session);
trans.setReturnDataType(DataTypeFactory.create(ObjectMessage.class));
initialiseObject(trans);
Object result2 = trans.transform(p);
assertTrue("Transformed object should be a ObjectMessage", result2 instanceof ObjectMessage);
ObjectMessage oMsg = (ObjectMessage) result2;
AbstractJmsTransformer trans2 = createObject(JMSMessageToObject.class);
trans2.setReturnDataType(DataTypeFactory.create(Map.class));
Object result = trans2.transform(oMsg);
assertTrue("Transformed object should be a Map", result instanceof Map);
Map m = (Map)result;
assertEquals("Value1", m.get("Key1"));
assertTrue(Arrays.equals(new byte[]{1,2,3}, (byte[])m.get("Key2")));
assertEquals(new Double(99.999), m.get("Key3"));
assertEquals(new Orange(), m.get("Key4"));
}