### Question:
AsyncWriteBehind implements WriteBehind { @Override public void start(CacheWriter writer) throws CacheException { async.start(new CacheWriterProcessor(writer), concurrency, POLICY); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer); @Override void write(Element element); @Override void delete(CacheEntry entry); @Override void setOperationsFilter(OperationsFilter filter); @Override void stop(); @Override long getQueueSize(); static final ItemScatterPolicy<SingleAsyncOperation> POLICY; }### Answer:
@SuppressWarnings("unchecked") @Test public void testPassesConcurrencyToAsyncCoordinatorOnStart() { asyncWriteBehind.start(null); verify(asyncCoordinator).start(any(CacheWriterProcessor.class), eq(CONCURRENCY), any(ItemScatterPolicy.class)); }
@Test public void testPassesItemScatterPolicyToAsyncCoordinatorOnStart() { asyncWriteBehind.start(null); verify(asyncCoordinator).start(any(CacheWriterProcessor.class), eq(CONCURRENCY), same(AsyncWriteBehind.POLICY)); }
@Test public void testPassesWrappedWriterToAsyncCoordinatorOnStart() { final CacheWriter writer = mock(CacheWriter.class); asyncWriteBehind.start(writer); ArgumentCaptor<CacheWriterProcessor> captor = ArgumentCaptor.forClass(CacheWriterProcessor.class); verify(asyncCoordinator).start(captor.capture(), eq(CONCURRENCY), same(AsyncWriteBehind.POLICY)); assertThat(captor.getAllValues().size(), is(1)); assertThat(captor.getValue().getCacheWriter(), sameInstance(writer)); }