### Question:
AWSEC2ComputeServiceContextModule extends BaseComputeServiceContextModule { protected Supplier<CacheLoader<RegionAndName, Image>> provideRegionAndNameToImageSupplierCacheLoader( final RegionAndIdToImage delegate) { return Suppliers.<CacheLoader<RegionAndName, Image>>ofInstance(new CacheLoader<RegionAndName, Image>() { private final AtomicReference<AuthorizationException> authException = Atomics.newReference(); @Override public Image load(final RegionAndName key) throws Exception { Supplier<Image> rawSupplier = new Supplier<Image>() { @Override public Image get() { try { return delegate.load(key); } catch (ExecutionException e) { throw Throwables.propagate(e); } } }; return new SetAndThrowAuthorizationExceptionSupplier<Image>(rawSupplier, authException).get(); } }); }    }### Answer:
@Test public void testCacheLoaderDoesNotReloadAfterAuthorizationException() throws Exception { AWSEC2ComputeServiceContextModule module = new AWSEC2ComputeServiceContextModule() { public Supplier<CacheLoader<RegionAndName, Image>> provideRegionAndNameToImageSupplierCacheLoader(RegionAndIdToImage delegate) { return super.provideRegionAndNameToImageSupplierCacheLoader(delegate); } }; RegionAndName regionAndName = new RegionAndName("myregion", "myname"); AuthorizationException authException = new AuthorizationException(); RegionAndIdToImage mockRegionAndIdToImage = createMock(RegionAndIdToImage.class); expect(mockRegionAndIdToImage.load(regionAndName)).andThrow(authException).once(); replay(mockRegionAndIdToImage); CacheLoader<RegionAndName, Image> cacheLoader = module.provideRegionAndNameToImageSupplierCacheLoader(mockRegionAndIdToImage).get(); for (int i = 0; i < 2; i++) { try { Image image = cacheLoader.load(regionAndName); fail("Expected Authorization exception, but got " + image); } catch (AuthorizationException e) { } } }