/** @see EE-1705/MULE-4567 */
public void testSessionProperties() throws Exception
{
DefaultMuleMessage message = new DefaultMuleMessage("Test Message", muleContext);
SessionHandler handler = new SerializeAndEncodeSessionHandler();
MuleSession session = new DefaultMuleSession(muleContext);
String string = "bar";
session.setProperty("fooString", string);
Date date = new Date(0);
session.setProperty("fooDate", date);
List<String> list = createList();
session.setProperty("fooList", list);
handler.storeSessionInfoToMessage(session, message);
// store save session to outbound, move it to the inbound
// for retrieve to deserialize
Object s = message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY);
message.setInboundProperty(MuleProperties.MULE_SESSION_PROPERTY, s);
session = handler.retrieveSessionInfoFromMessage(message);
Object obj = session.getProperty("fooString");
assertTrue(obj instanceof String);
assertEquals(string, obj);
obj = session.getProperty("fooDate");
assertTrue("Object should be a Date but is " + obj.getClass().getName(), obj instanceof Date);
assertEquals(date, obj);
obj = session.getProperty("fooList");
assertTrue("Object should be a List but is " + obj.getClass().getName(), obj instanceof List);
assertEquals(list, obj);
}