EventToStringConverter { public static String toString(Map<String, ?> eventData) { StringBuilder builder = new StringBuilder("event: "); for (Map.Entry<String, ?> entry : eventData.entrySet()) { builder.append(entry.getKey()).append(" : ").append(entry.getValue()).append("\n"); } return builder.toString(); }  static String toString(Map<String, ?> eventData);  }
@Test public void testToString() throws Exception { Map<String, Object> event = new EventBuilder("An event").setAction("an action").get(); String myString = EventToStringConverter.toString(event); assertEquals("event: name : An event\naction : an action\n", myString); }