@Test public void testHandlesNonEngineResourcesFromCacheIfPresent() { final Object expected = new Object(); Resource fromCache = mock(Resource.class); when(fromCache.get()).thenReturn(expected); when(harness.cache.remove(eq(harness.cacheKey))).thenReturn(fromCache); doAnswer( new Answer() { @Override public Object answer(InvocationOnMock invocationOnMock) throws Throwable { Resource resource = (Resource) invocationOnMock.getArguments()[0]; assertEquals(expected, resource.get()); return null; } }) .when(harness.cb) .onResourceReady(any(Resource.class)); harness.doLoad(); verify(harness.cb).onResourceReady(any(Resource.class)); }
@Override public Z get() { return toWrap.get(); }
protected void invokeGETOnNestedResources() { final Collection<Resource> values = nestedResources.values(); for (Resource resource : values) { resource.get(); } }