@Test(timeout = 1000L)
public void testThreadedPutWorks() throws Exception {

    final MemoryPersistentStore persistentStore = new MemoryPersistentStore();
    final AtomicBoolean waitForStartPut = new AtomicBoolean(false);
    final AtomicBoolean waitForAllowPut = new AtomicBoolean(false);
    final AtomicBoolean waitForDone = new AtomicBoolean(false);
    this.formatterCache = new FormatterCache(persistentStore, 100, 5000) {
        @Override
        PersistentStoreRunnable createPersistentStoreRunnable(BlockingQueue<Pair<Key, StoreInfoAndDataLoadResult>> storeRequests,
                                                              PersistentStore store) {
            return new PersistentStoreRunnable(storeRequests, store) {
                @Override
                void doStore(Pair<Key, StoreInfoAndDataLoadResult> request) throws Exception {
                    waitForStartPut.set(true);
                    while (!waitForAllowPut.get()) {
                        Thread.sleep(100);
                    }
                    super.doStore(request);
                    waitForDone.set(true);
                }
            };
        }
    };
    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), false);
    waitForStartPut.set(true);
    assertNull(persistentStore.get(key));
    waitForAllowPut.set(true);
    while (!waitForDone.get()) {
        Thread.sleep(100);
    }
    assertNotNull(persistentStore.get(key));
}