S3AssetsResolver extends AbstractResourceResolver { @Override protected Resource resolveResourceInternal(HttpServletRequest request, String requestPath, List<? extends Resource> locations, ResourceResolverChain chain) { return resolveResourceInternal(requestPath); } S3AssetsResolver(S3ObjectResourceLoader s3ObjectResourceLoader, String assetsBucket, String prefix); String buildS3Uri(String requestPath); Resource resolveResourceInternal(String requestPath);  }
@Test public void test_resolveResourceInternal() { when(resource.exists()).thenReturn(true); when(s3ObjectResourceLoader.getResource(any(String.class))).thenReturn(resource); S3AssetsResolver sut = new S3AssetsResolver(s3ObjectResourceLoader, "assetsbucket", "foo"); Resource actual = sut.resolveResourceInternal(""); assertThat(actual, is(resource)); }
@Test public void test_resolveResourceInternal_nonexistent() { when(resource.exists()).thenReturn(false); when(s3ObjectResourceLoader.getResource(any(String.class))).thenReturn(resource); S3AssetsResolver sut = new S3AssetsResolver(s3ObjectResourceLoader, "assetsbucket", "foo"); Resource actual = sut.resolveResourceInternal(""); assertNull(actual); }