### Question:
SessionAdapter implements TokenAdapter<InternalSession> { public int findIndexOfValidField(String blob) { for (Field field : AttributeCompressionStrategy.getAllValidFields(InternalSession.class)) { String search = JSONSerialisation.jsonAttributeName(field.getName()); int index = blob.indexOf(search); if (index != -1) { return index; } } return -1; } @Inject  SessionAdapter(TokenIdFactory tokenIdFactory, CoreTokenConfig config,
                          JSONSerialisation serialisation, TokenBlobUtils blobUtils); Token toToken(InternalSession session); InternalSession fromToken(Token token); int findIndexOfValidField(String blob); String filterLatestAccessTime(Token token);  }### Answer:
@Test public void shouldLocateValidFieldInJSON() { String json = "{\"clientDomain\":null,\"creationTime\":1376307674,\"isISStored\":true,\"latestAccessTime\":1376308558,\"maxCachingTime\":3}"; assertEquals(1, adapter.findIndexOfValidField(json)); }
@Test public void shouldIndicateNoValidFieldsInJSON() { assertEquals(-1, adapter.findIndexOfValidField("")); }