/** Creates an Message through the advance createMessage() method and inspects its parameters. */
  public void testCreateMessage2() throws UnsupportedEncodingException {
    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 =
        opSetBasicIM1.createMessage(body, contentType, encoding, subject);
    byte[] bodyBytes = body.getBytes(encoding);

    assertEquals("message body", body, msg.getContent());
    assertTrue("message body bytes", Arrays.equals(bodyBytes, msg.getRawData()));
    assertEquals("message length", bodyBytes.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 = opSetBasicIM1.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 = opSetBasicIM1.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 = opSetBasicIM1.createMessage(body);
    assertFalse("message uid", msg.getMessageUID().equals(msg2.getMessageUID()));
  }