@Test
public void testMemoryCache() throws Exception {

    final AtomicBoolean persistentStoreHit = new AtomicBoolean(false);
    this.formatterCache = new FormatterCache(new PersistentStore() {
        @Override
        @Nullable
        public StoreInfoAndData get(@Nonnull Key key) {
            persistentStoreHit.set(true);
            return new StoreInfoAndData("lksjdf", 234982734, false);
        }
        @Override
        @Nullable
        public StoreInfo getInfo(@Nonnull Key key) {
            return get(key);
        }
        @Override
        public void put(@Nonnull Key key, @Nonnull StoreInfoAndData data) {
            // ignore
        }
        @Nullable
        @Override
        public byte[] getPublished(@Nonnull Key key) {
            throw new UnsupportedOperationException("to implement");
        }
        @Override
        public void remove(@Nonnull Key key) throws IOException, SQLException {
            // ignore
        }
        @Override
        public void setPublished(int metadataId, boolean published) {
            throw new UnsupportedOperationException("not yet implemented");
        }
        @Override
        public void clear() {
            // ignore
        }
    }, 100, 5000);
    final boolean hideWithheld = true;
    final long changeDate = new Date().getTime();
    final Key key = new Key(1, "eng", FormatType.html, "full_view", hideWithheld, FormatterWidth._100);
    formatterCache.get(key, new ChangeDateValidator(changeDate), new TestLoader("result", changeDate, false), true);
    assertEquals(true, persistentStoreHit.get());
    persistentStoreHit.set(false);
    byte[] bytes = formatterCache.get(key, new ChangeDateValidator(changeDate), new TestLoader("result", changeDate, false), true);
    String result = new String(bytes, Constants.CHARSET);
    assertEquals("result", result);
    assertEquals(false, persistentStoreHit.get());
}