Source:
<code>public void testGetAllStoreAllMatchCacheAccessExceptionBeforeLoaderNoMatchSomeFailWithBulkCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(getEntryMap(KEY_SET_A, KEY_SET_B)); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store) .bulkComputeIfAbsent(getAnyStringSet(), getAnyIterableFunction()); <START> final FakeCacheLoaderWriter fakeLoader = new FakeCacheLoaderWriter(getEntryMap(KEY_SET_C, KEY_SET_F), KEY_SET_F, true); <END> this.loaderWriter = spy(fakeLoader); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Set<String> fetchKeys = fanIn(KEY_SET_A, KEY_SET_B); try { ehcache.getAll(fetchKeys); fail(); } catch (BulkCacheLoadingException e) { assertThat(e.getSuccesses().keySet(), empty()); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(fetchKeys)); } final InOrder ordered = inOrder(this.loaderWriter, this.spiedResilienceStrategy); verify(this.store).bulkComputeIfAbsent(eq(fetchKeys), getAnyIterableFunction()); ordered.verify(this.loaderWriter, atLeast(1)).loadAll(this.loadAllCaptor.capture()); assertThat(this.getLoadAllArgs(), equalTo(fetchKeys)); ordered.verify(this.spiedResilienceStrategy) .getAllFailure(eq(fetchKeys), any(CacheAccessException.class), this.bulkExceptionCaptor.capture()); assertThat(this.bulkExceptionCaptor.getValue().getSuccesses().keySet(), empty()); assertThat(this.bulkExceptionCaptor.getValue().getFailures().keySet(), Matchers.<Set<?>>equalTo(fetchKeys)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }</code><technical_language>Do start in inconsistent state: loader needs a super set of store knows. If test a duplicate, delete it</technical_language>

Target:
public void testGetAllStoreAllMatchCacheAccessExceptionBeforeLoaderNoMatchSomeFailWithBulkCacheLoadingException() throws Exception { final FakeStore fakeStore = new FakeStore(getEntryMap(KEY_SET_A, KEY_SET_B)); this.store = spy(fakeStore); doThrow(new CacheAccessException("")).when(this.store) .bulkComputeIfAbsent(getAnyStringSet(), getAnyIterableFunction()); final Set<String> fetchKeys = fanIn(KEY_SET_A, KEY_SET_B); final FakeCacheLoaderWriter fakeLoader = new FakeCacheLoaderWriter(TEST_ENTRIES, fetchKeys, true); this.loaderWriter = spy(fakeLoader); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); try { ehcache.getAll(fetchKeys); fail(); } catch (BulkCacheLoadingException e) { assertThat(e.getSuccesses().keySet(), empty()); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(fetchKeys)); } final InOrder ordered = inOrder(this.loaderWriter, this.spiedResilienceStrategy); verify(this.store).bulkComputeIfAbsent(eq(fetchKeys), getAnyIterableFunction()); ordered.verify(this.loaderWriter, atLeast(1)).loadAll(this.loadAllCaptor.capture()); assertThat(this.getLoadAllArgs(), equalTo(fetchKeys)); ordered.verify(this.spiedResilienceStrategy) .getAllFailure(eq(fetchKeys), any(CacheAccessException.class), this.bulkExceptionCaptor.capture()); verifyBulkLoadingException(this.bulkExceptionCaptor.getValue(), Collections.<String> emptySet(), fetchKeys); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }