JsonMetadata extends JsonMetadataBase { public static Metadata fromJson(Reader reader) throws TikaException { Metadata m = null; try { m = GSON.fromJson(reader, Metadata.class); } catch (com.google.gson.JsonParseException e){ throw new TikaException(e.getMessage()); } return m; }  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 testDeserializationException() { String json = "{\"k1\":[\"v1\",\"v2\"],\"k3\":\"v3\",\"k4\":500,000}"; boolean ex = false; try { Metadata deserialized = JsonMetadata.fromJson(new StringReader(json)); } catch (TikaException e) { ex = true; } assertTrue(ex); }