Source:
<code>public void testProperties() throws XmppStringprepException, NotConnectedException, Exception { Chat newChat = chatManagerOne.createChat(conTwo.getUser()); PacketCollector collector = conTwo.createPacketCollector(new ThreadFilter(newChat.getThreadID())); <START> JivePropertiesManager.setJavaObjectEnabled(true); <END> Message msg = new Message(); msg.setSubject("Subject of the chat"); msg.setBody("Body of the chat"); addProperty(msg, "favoriteColor", "red"); addProperty(msg, "age", 30); addProperty(msg, "distance", 30f); addProperty(msg, "weight", 30d); addProperty(msg, "male", true); addProperty(msg, "birthdate", new Date()); newChat.sendMessage(msg); Message msg2 = (Message) collector.nextResult(2000); assertNotNull("No message was received", msg2); assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject()); assertEquals("Bodies are different", msg.getBody(), msg2.getBody()); assertEquals( "favoriteColors are different", getProperty(msg, "favoriteColor"), getProperty(msg2, "favoriteColor")); assertEquals( "ages are different", getProperty(msg, "age"), getProperty(msg2, "age")); assertEquals( "distances are different", getProperty(msg, "distance"), getProperty(msg2, "distance")); assertEquals( "weights are different", getProperty(msg, "weight"), getProperty(msg2, "weight")); assertEquals( "males are different", getProperty(msg, "male"), getProperty(msg2, "male")); assertEquals( "birthdates are different", getProperty(msg, "birthdate"), getProperty(msg2, "birthdate")); }</code><technical_language>Tests leave state unchanged, if set this true, need reset end. Create methods setUp() tearDown(), annoate @BeforeClass @AfterClass, set reset config of JivePropertiesManager</technical_language>

Target:
public void testProperties() throws XmppStringprepException, NotConnectedException, Exception { Chat newChat = chatManagerOne.createChat(conTwo.getUser()); PacketCollector collector = conTwo.createPacketCollector(new ThreadFilter(newChat.getThreadID())); Message msg = new Message(); msg.setSubject("Subject of the chat"); msg.setBody("Body of the chat"); addProperty(msg, "favoriteColor", "red"); addProperty(msg, "age", 30); addProperty(msg, "distance", 30f); addProperty(msg, "weight", 30d); addProperty(msg, "male", true); addProperty(msg, "birthdate", new Date()); newChat.sendMessage(msg); Message msg2 = (Message) collector.nextResult(2000); assertNotNull("No message was received", msg2); assertEquals("Subjects are different", msg.getSubject(), msg2.getSubject()); assertEquals("Bodies are different", msg.getBody(), msg2.getBody()); assertEquals( "favoriteColors are different", getProperty(msg, "favoriteColor"), getProperty(msg2, "favoriteColor")); assertEquals( "ages are different", getProperty(msg, "age"), getProperty(msg2, "age")); assertEquals( "distances are different", getProperty(msg, "distance"), getProperty(msg2, "distance")); assertEquals( "weights are different", getProperty(msg, "weight"), getProperty(msg2, "weight")); assertEquals( "males are different", getProperty(msg, "male"), getProperty(msg2, "male")); assertEquals( "birthdates are different", getProperty(msg, "birthdate"), getProperty(msg2, "birthdate")); }