AccessTokenCacheFetcher extends CacheFetcher { @Override protected Object fromJson(String json) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); return objectMapper.readValue(json, AccessToken.class); } AccessTokenCacheFetcher(String owner, List<String> scopes, String target);   }
@Test public void testFromJSON() { AccessTokenCacheFetcher fetcher = new AccessTokenCacheFetcher(ALICE, SCOPES, TARGET); String json = "{\"expiresAt\": 888888888, \"value\": \"blah\"}"; AccessToken token; try { token = (AccessToken) fetcher.fromJson(json); } catch (IOException e) { throw new RuntimeException(e); } assertEquals(token.getValue(), "blah"); assertEquals(token.getExpiresAt(), 888888888L); }