### Question:
JSonSerializer extends JSonUtil { public static String serialize(final JsonSerializable object) { return serializeInternal(object).toString(); }  static String serialize(final JsonSerializable object); static String serialize(final Object object); static String serialize(final Object key, final Object value); static String serializeCollection(final Collection<? extends Object> list); static String serializeMap(final Map<? extends Object, ? extends Object> map); static String serializeException(final Throwable e); static String serializeStringMap(final Map<? extends Object, String> map);  }### Answer:
@Test public void should_serialize_an_exception() throws Exception { Exception exception = new Exception("an exception"); String serialize = JSonSerializer.serialize(exception); assertThat(serialize).isEqualTo("{\"exception\":\"class java.lang.Exception\",\"message\":\"an exception\"}"); }
@Test public void should_serialize_only_first_cause_of_an_exception() throws Exception { Exception exception = new Exception("first one", new Exception("second one", new Exception("third one"))); String serialize = JSonSerializer.serialize(exception); assertThat(serialize).isEqualTo( "{\"exception\":\"class java.lang.Exception\"," + "\"message\":\"first one\"," + "\"cause\":{" + "\"exception\":\"class java.lang.Exception\"," + "\"message\":\"second one\"" + "}" + "}"); }