### Question:
DownloaderFactory { public Downloader create(PhantomJsResolverOptions options, RepositoryDetails repositoryDetails) { return isRepositorySource(options) ? createRepositoryDownloader(repositoryDetails) : createWebDownloader(repositoryDetails); } @Inject  DownloaderFactory(ArtifactBuilder artifactBuilder,
                           ArchiveCacheFactory archiveCacheFactory); Downloader create(PhantomJsResolverOptions options,
                           RepositoryDetails repositoryDetails);  }### Answer:
@Test public void testGetDownloader_RepositoryDownloader() { when(options.getSource()).thenReturn(PhantomJsResolverOptions.Source.REPOSITORY); assertThat(downloaderFactory.create(options, repositoryDetails)).isInstanceOf(RepositoryDownloader.class); }
@Test public void testGetDownloader_WebDownloader() { when(options.getSource()).thenReturn(PhantomJsResolverOptions.Source.URL); assertThat(downloaderFactory.create(options, repositoryDetails)).isInstanceOf(WebDownloader.class); }