Source:
<code>public void testGetAllStoreAllMatchCacheAccessExceptionBeforeLoaderSomeMatchDisjointFailWithBulkCacheLoadingException() 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_B, KEY_SET_C), KEY_SET_B, 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(), Matchers.<Set<?>>equalTo(KEY_SET_B)); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(KEY_SET_A)); } 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(), Matchers.<Map<?,?>>equalTo(getNullEntryMap(KEY_SET_B))); assertThat(this.bulkExceptionCaptor.getValue().getFailures().keySet(), Matchers.<Set<?>>equalTo(KEY_SET_A)); 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 testGetAllStoreAllMatchCacheAccessExceptionBeforeLoaderSomeMatchDisjointFailWithBulkCacheLoadingException() 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 FakeCacheLoaderWriter fakeLoader = new FakeCacheLoaderWriter(TEST_ENTRIES, KEY_SET_A, true); 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(), Matchers.<Set<?>>equalTo(KEY_SET_B)); assertThat(e.getFailures().keySet(), Matchers.<Set<?>>equalTo(KEY_SET_A)); } 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(), KEY_SET_B, KEY_SET_A); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }