@Test
 public void testNotNull() {
   final String testMsg = "Test message {}";
   final ObjectMessage msg = new ObjectMessage(testMsg);
   final String result = msg.getFormattedMessage();
   assertEquals(testMsg, result);
 }
  @Test
  public void testUnsafeWithMutableParams() { // LOG4J2-763
    final Mutable param = new Mutable().set("abc");
    final ObjectMessage msg = new ObjectMessage(param);

    // modify parameter before calling msg.getFormattedMessage
    param.set("XYZ");
    final String actual = msg.getFormattedMessage();
    assertEquals("Expected most recent param value", "XYZ", actual);
  }
  @Test
  public void testSafeAfterGetFormattedMessageIsCalled() { // LOG4J2-763
    final Mutable param = new Mutable().set("abc");
    final ObjectMessage msg = new ObjectMessage(param);

    // modify parameter after calling msg.getFormattedMessage
    msg.getFormattedMessage();
    param.set("XYZ");
    final String actual = msg.getFormattedMessage();
    assertEquals("Should use initial param value", "abc", actual);
  }
  @Test
  public void formatTo_usesCachedMessageString() throws Exception {
    final StringBuilder charSequence = new StringBuilder("initial value");
    final ObjectMessage message = new ObjectMessage(charSequence);
    assertEquals("initial value", message.getFormattedMessage());

    charSequence.setLength(0);
    charSequence.append("different value");

    final StringBuilder result = new StringBuilder();
    message.formatTo(result);
    assertEquals("initial value", result.toString());
  }
 @Test
 public void testNull() {
   final ObjectMessage msg = new ObjectMessage(null);
   final String result = msg.getFormattedMessage();
   assertEquals("null", result);
 }