use of com.google.devtools.build.lib.bazel.repository.cache.RepositoryCache in project bazel by bazelbuild.
the class MavenJarFunctionTest method testNoSha1WithCache.
@Test
public void testNoSha1WithCache() throws Exception {
Rule rule = scratchRule("external", "foo", "maven_jar(", " name = 'foo',", " artifact = 'x:y:z:1.1',", ")");
RepositoryCache cache = Mockito.mock(RepositoryCache.class);
Mockito.when(cache.isEnabled()).thenReturn(true);
MavenDownloader downloader = new MavenDownloader(cache);
try {
downloader.download("foo", WorkspaceAttributeMapper.of(rule), scratch.dir("/whatever"), TEST_SERVER);
fail("Expected failure to fetch artifact because of nonexistent server.");
} catch (IOException expected) {
assertThat(expected.getMessage()).contains("Failed to fetch Maven dependency:");
}
}
Aggregations