JsonMetadata extends JsonMetadataBase { public static void toJson(Metadata metadata, Writer writer) throws TikaException { try { GSON.toJson(metadata, writer); } catch (JsonIOException e) { throw new TikaException(e.getMessage()); } }  static void toJson(Metadata metadata, Writer writer); static Metadata fromJson(Reader reader); static void setGson(Gson gson); static void setPrettyPrinting(boolean prettyPrint);  }
@Test public void testNull() { StringWriter writer = new StringWriter(); boolean ex = false; try { JsonMetadata.toJson(null, writer); } catch (TikaException e) { ex = true; } assertFalse(ex); assertEquals("null", writer.toString()); }