SessionCacheFetcher extends CacheFetcher { @Override protected Object fromJson(String json) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(json, Session.class); } SessionCacheFetcher(String rawToken);   }
@Test public void testFromJSON() { SessionCacheFetcher fetcher = new SessionCacheFetcher("xxxx"); String json = "{" + "\"id\": \"abcd\", " + "\"creationTime\": 1000000000000, " + "\"owner\": \"bob@EXAMPLE.COM\", " + "\"renewer\": \"yarn@BAZ.NET\", " + "\"scopes\": \"" + BIGQUERY + "\", " + "\"target\": \"gs: "\"expiresAt\": 2000000000000" + "}"; Session session; try { session = (Session) fetcher.fromJson(json); } catch (IOException e) { throw new RuntimeException(e); } assertEquals("abcd", session.getId()); assertEquals(1000000000000L, session.getCreationTime().longValue()); assertEquals("bob@EXAMPLE.COM", session.getOwner()); assertEquals("yarn@BAZ.NET", session.getRenewer()); assertEquals(BIGQUERY, session.getScopes()); assertEquals("gs: assertEquals(2000000000000L, session.getExpiresAt().longValue()); }