/** Creates an Message through the advance createMessage() method and inspects its parameters. */ public void testCreateMessage2() { String body = "This is an IM coming from the tested implementation" + " on " + new Date().toString(); String contentType = "text/html"; String encoding = "UTF-16"; String subject = "test message"; net.java.sip.communicator.service.protocol.Message msg = opSetBasicIM.createMessage(body.getBytes(), contentType, encoding, subject); assertEquals("message body", body, msg.getContent()); assertTrue("message body bytes", Arrays.equals(body.getBytes(), msg.getRawData())); assertEquals("message length", body.length(), msg.getSize()); assertEquals("message content type", contentType, msg.getContentType()); assertEquals("message encoding", encoding, msg.getEncoding()); assertNotNull("message uid", msg.getMessageUID()); // a further test on message uid. net.java.sip.communicator.service.protocol.Message msg2 = opSetBasicIM.createMessage(body); assertFalse("message uid", msg.getMessageUID().equals(msg2.getMessageUID())); }
/** Creates an Message through the simple createMessage() method and inspects its parameters. */ public void testCreateMessage1() { String body = "This is an IM coming from the tested implementation" + " on " + new Date().toString(); net.java.sip.communicator.service.protocol.Message msg = opSetBasicIM.createMessage(body); assertEquals("message body", body, msg.getContent()); assertTrue("message body bytes", Arrays.equals(body.getBytes(), msg.getRawData())); assertEquals("message length", body.length(), msg.getSize()); assertEquals( "message content type", OperationSetBasicInstantMessaging.DEFAULT_MIME_TYPE, msg.getContentType()); assertEquals( "message encoding", OperationSetBasicInstantMessaging.DEFAULT_MIME_ENCODING, msg.getEncoding()); assertNotNull("message uid", msg.getMessageUID()); // a further test on message uid. net.java.sip.communicator.service.protocol.Message msg2 = opSetBasicIM.createMessage(body); assertFalse("message uid", msg.getMessageUID().equals(msg2.getMessageUID())); }