EventToString { public static String format(String className, String methodName, Object... args) { return new EventToString(Charset.defaultCharset()) .formatMethodCall(className, methodName, args) .build(); } EventToString(Charset charset); static String format(String className, String methodName, Object... args); String build(); EventToString formatMethodCall(String className, String methodName, Object... args);  }
@Test public void shows_the_method_and_all_its_arguments() { assertThat(EventToString.format("TheClass", "theMethod"), is("TheClass.theMethod()")); assertThat(EventToString.format("TheClass", "theMethod", 123), is("TheClass.theMethod(123)")); assertThat(EventToString.format("TheClass", "theMethod", 123, true), is("TheClass.theMethod(123, true)")); }
@Test public void does_not_crash_to_null_arguments() { assertThat(EventToString.format("TheClass", "theMethod", (Object) null), is("TheClass.theMethod(null)")); }
@Test public void quotes_string_arguments() { assertThat(EventToString.format("TheClass", "theMethod", "foo"), is("TheClass.theMethod(\"foo\")")); }