@Test public void should_locate_with_url_locator() { URLLocation location = mock(URLLocation.class); File expectedFile = new File("found"); when(urlLocator.locate(location)).thenReturn(expectedFile); File actualFile = locators.locate(location); assertThat(actualFile).isSameAs(expectedFile); }
public File locate(Location location) { File file; if (location instanceof FileLocation) { file = fileLocator.locate((FileLocation) location); } else if (location instanceof MavenLocation) { file = mavenLocator.locate((MavenLocation) location); } else if (location instanceof ResourceLocation) { file = resourceLocator.locate((ResourceLocation) location); } else if (location instanceof URLLocation) { file = urlLocator.locate((URLLocation) location); } else { throw throwNotSupported(location); } return file; }
Locators { public File locate(Location location) { File file; if (location instanceof FileLocation) { file = fileLocator.locate((FileLocation) location); } else if (location instanceof MavenLocation) { file = mavenLocator.locate((MavenLocation) location); } else if (location instanceof ResourceLocation) { file = resourceLocator.locate((ResourceLocation) location); } else if (location instanceof URLLocation) { file = urlLocator.locate((URLLocation) location); } else { throw throwNotSupported(location); } return file; } }
Locators { public File locate(Location location) { File file; if (location instanceof FileLocation) { file = fileLocator.locate((FileLocation) location); } else if (location instanceof MavenLocation) { file = mavenLocator.locate((MavenLocation) location); } else if (location instanceof ResourceLocation) { file = resourceLocator.locate((ResourceLocation) location); } else if (location instanceof URLLocation) { file = urlLocator.locate((URLLocation) location); } else { throw throwNotSupported(location); } return file; } Locators(FileSystem fileSystem, Artifactory artifactory);   Locators(FileLocator fileLocator, MavenLocator mavenLocator, ResourceLocator resourceLocator, URLLocator urlLocator); }
Locators { public File locate(Location location) { File file; if (location instanceof FileLocation) { file = fileLocator.locate((FileLocation) location); } else if (location instanceof MavenLocation) { file = mavenLocator.locate((MavenLocation) location); } else if (location instanceof ResourceLocation) { file = resourceLocator.locate((ResourceLocation) location); } else if (location instanceof URLLocation) { file = urlLocator.locate((URLLocation) location); } else { throw throwNotSupported(location); } return file; } Locators(FileSystem fileSystem, Artifactory artifactory);   Locators(FileLocator fileLocator, MavenLocator mavenLocator, ResourceLocator resourceLocator, URLLocator urlLocator); MavenLocator maven(); File locate(Location location); File copyToDirectory(Location location, File toDir); File copyToFile(Location location, File toFile); InputStream openInputStream(Location location); }
Locators { public File locate(Location location) { File file; if (location instanceof FileLocation) { file = fileLocator.locate((FileLocation) location); } else if (location instanceof MavenLocation) { file = mavenLocator.locate((MavenLocation) location); } else if (location instanceof ResourceLocation) { file = resourceLocator.locate((ResourceLocation) location); } else if (location instanceof URLLocation) { file = urlLocator.locate((URLLocation) location); } else { throw throwNotSupported(location); } return file; } Locators(FileSystem fileSystem, Artifactory artifactory);   Locators(FileLocator fileLocator, MavenLocator mavenLocator, ResourceLocator resourceLocator, URLLocator urlLocator); MavenLocator maven(); File locate(Location location); File copyToDirectory(Location location, File toDir); File copyToFile(Location location, File toFile); InputStream openInputStream(Location location);  }