@Test public void copyToFile_returns_null_if_artifact_not_found() throws IOException { MavenLocation location = MavenLocation.of("foo", "bar", "1.0"); markVersionsAsResolved(); File toFile = temp.newFile(); File result = underTest.copyToFile(location, toFile); assertThat(result).isNull(); }
@Override public File copyToFile(MavenLocation location, File toFile) { File target = locate(location); if (target == null) { return null; } try { FileUtils.copyFile(target, toFile); return toFile; } catch (IOException e) { throw new IllegalStateException("Fail to copy to file: " + toFile, e); } }
MavenLocator implements Locator<MavenLocation> { @Override public File copyToFile(MavenLocation location, File toFile) { File target = locate(location); if (target == null) { return null; } try { FileUtils.copyFile(target, toFile); return toFile; } catch (IOException e) { throw new IllegalStateException("Fail to copy to file: " + toFile, e); } } }
MavenLocator implements Locator<MavenLocation> { @Override public File copyToFile(MavenLocation location, File toFile) { File target = locate(location); if (target == null) { return null; } try { FileUtils.copyFile(target, toFile); return toFile; } catch (IOException e) { throw new IllegalStateException("Fail to copy to file: " + toFile, e); } } MavenLocator(FileSystem fileSystem, Artifactory artifactory); }
MavenLocator implements Locator<MavenLocation> { @Override public File copyToFile(MavenLocation location, File toFile) { File target = locate(location); if (target == null) { return null; } try { FileUtils.copyFile(target, toFile); return toFile; } catch (IOException e) { throw new IllegalStateException("Fail to copy to file: " + toFile, e); } } MavenLocator(FileSystem fileSystem, Artifactory artifactory); @Override File locate(MavenLocation location); Optional<String> resolveVersion(MavenLocation location); @Override File copyToDirectory(MavenLocation location, File toDir); @Override File copyToFile(MavenLocation location, File toFile); @Override @CheckForNull InputStream openInputStream(MavenLocation location); }
MavenLocator implements Locator<MavenLocation> { @Override public File copyToFile(MavenLocation location, File toFile) { File target = locate(location); if (target == null) { return null; } try { FileUtils.copyFile(target, toFile); return toFile; } catch (IOException e) { throw new IllegalStateException("Fail to copy to file: " + toFile, e); } } MavenLocator(FileSystem fileSystem, Artifactory artifactory); @Override File locate(MavenLocation location); Optional<String> resolveVersion(MavenLocation location); @Override File copyToDirectory(MavenLocation location, File toDir); @Override File copyToFile(MavenLocation location, File toFile); @Override @CheckForNull InputStream openInputStream(MavenLocation location);  }