SimpleMessageFormatter extends MessageBuilder<StringBuilder> implements ParameterVisitor { static String toString(Object value) { if (!value.getClass().isArray()) { return String.valueOf(value); } if (value instanceof int[]) { return Arrays.toString((int[]) value); } if (value instanceof long[]) { return Arrays.toString((long[]) value); } if (value instanceof byte[]) { return Arrays.toString((byte[]) value); } if (value instanceof char[]) { return Arrays.toString((char[]) value); } if (value instanceof short[]) { return Arrays.toString((short[]) value); } if (value instanceof float[]) { return Arrays.toString((float[]) value); } if (value instanceof double[]) { return Arrays.toString((double[]) value); } if (value instanceof boolean[]) { return Arrays.toString((boolean[]) value); } return Arrays.toString((Object[]) value); } private  SimpleMessageFormatter(TemplateContext context, Object[] args); static void format(LogData logData, SimpleLogHandler receiver); static String safeToString(Object value); @Override void addParameterImpl(int termStart, int termEnd, Parameter param); @Override StringBuilder buildImpl(); @Override void visit(Object value, FormatChar format, FormatOptions options); @Override void visitDateTime(Object value, DateTimeFormat format, FormatOptions options); @Override void visitPreformatted(Object value, String formatted); @Override void visitMissing(); @Override void visitNull();  }
@Test public void testToStringFormatsCorrectly() { assertThat(SimpleMessageFormatter.toString("Hello World")).isSameInstanceAs("Hello World"); assertThat(SimpleMessageFormatter.toString(10)).isEqualTo("10"); assertThat(SimpleMessageFormatter.toString(false)).isEqualTo("false"); assertThat(SimpleMessageFormatter.toString(new String[] {"Foo", "Bar"})) .isEqualTo("[Foo, Bar]"); assertThat(SimpleMessageFormatter.toString(new int[] {1, 2, 3})).isEqualTo("[1, 2, 3]"); }