ContentSupport { <T> T fromJson(String raw, Class<T> c) { if (String.class.isAssignableFrom(c)) { return (T) raw; } return gson().fromJson(raw, c); }    }
@Test public void testFromJson() { final Problem in = Problem.localProblem("title", "detail"); final String raw = new Gson().toJson(in); final ContentSupport cs = new ContentSupport(); final Problem out = cs.fromJson(raw, Problem.class); assertEquals("title", out.title()); assertEquals("detail", out.detail().get()); assertEquals(in, out); }