@Test
public void testLookupCaching() {

    KeySpace keySpace = new KeySpace(new KeySpaceDirectory("path", KeyType.STRING, "path"));
    ResolvedKeySpacePath path1;
    try (FDBRecordContext context = database.openContext()) {
        path1 = keySpace.resolveFromKey(context, Tuple.from("path"));
    }
    LocatableResolver resolver = scopedDirectoryGenerator.apply(database, path1);
    Long value = resolver.resolve("foo").join();
    for (int i = 0; i < 5; i++) {
        Long fetched = resolver.resolve("foo").join();
        assertThat("we should always get the original value", fetched, is(value));
    }
    CacheStats stats = database.getDirectoryCacheStats();
    assertThat("subsequent lookups should hit the cache", stats.hitCount(), is(5L));
}