X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneDownloaderTest.java;h=c17c12f2b3a6caf540f123cd1667b25cb853b7db;hb=68d5537f9d502ce6dc7079ae55b52b9284a01899;hp=31e83f793811f3a90ffea39a5296f3610147b686;hpb=b2a3147c056a532558c9bfe676431f4597b7f8eb;p=Sone.git
diff --git a/src/test/java/net/pterodactylus/sone/core/SoneDownloaderTest.java b/src/test/java/net/pterodactylus/sone/core/SoneDownloaderTest.java
index 31e83f7..c17c12f 100644
--- a/src/test/java/net/pterodactylus/sone/core/SoneDownloaderTest.java
+++ b/src/test/java/net/pterodactylus/sone/core/SoneDownloaderTest.java
@@ -33,8 +33,6 @@ import java.util.Map;
import java.util.Set;
import net.pterodactylus.sone.core.FreenetInterface.Fetched;
-import net.pterodactylus.sone.core.SoneDownloader.FetchSone;
-import net.pterodactylus.sone.core.SoneDownloader.FetchSoneWithUri;
import net.pterodactylus.sone.data.Album;
import net.pterodactylus.sone.data.AlbumImpl;
import net.pterodactylus.sone.data.Client;
@@ -63,7 +61,7 @@ import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
/**
- * Unit test for {@link SoneDownloader} and its subclasses.
+ * Unit test for {@link SoneDownloaderImpl} and its subclasses.
*
* @author David âBombeâ Roden
*/
@@ -71,7 +69,7 @@ public class SoneDownloaderTest {
private final Core core = mock(Core.class);
private final FreenetInterface freenetInterface = mock(FreenetInterface.class);
- private final SoneDownloader soneDownloader = new SoneDownloader(core, freenetInterface);
+ private final SoneDownloaderImpl soneDownloader = new SoneDownloaderImpl(core, freenetInterface);
private final FreenetURI requestUri = mock(FreenetURI.class);
private final Sone sone = mock(Sone.class);
private final PostBuilder postBuilder = mock(PostBuilder.class);
@@ -213,7 +211,7 @@ public class SoneDownloaderTest {
public void setupAlbums() {
albums.put("album-id-1", new AlbumImpl("album-id-1"));
albums.put("album-id-2", new AlbumImpl("album-id-2"));
- when(core.getAlbum(anyString())).thenAnswer(new Answer() {
+ when(core.getOrCreateAlbum(anyString())).thenAnswer(new Answer() {
@Override
public Album answer(InvocationOnMock invocation) throws Throwable {
return albums.get(invocation.getArguments()[0]);
@@ -625,26 +623,6 @@ public class SoneDownloaderTest {
}
@Test
- public void fetchSoneWithUriDownloadsSoneWithUri() {
- SoneDownloader soneDownloader = mock(SoneDownloader.class);
- Sone sone = mock(Sone.class);
- FreenetURI soneUri = mock(FreenetURI.class);
- when(sone.getRequestUri()).thenReturn(soneUri);
- FetchSoneWithUri fetchSoneWithUri = soneDownloader.new FetchSoneWithUri(sone);
- fetchSoneWithUri.run();
- verify(soneDownloader).fetchSone(eq(sone), eq(soneUri));
- }
-
- @Test
- public void fetchSoneDownloadsSone() {
- SoneDownloader soneDownloader = mock(SoneDownloader.class);
- Sone sone = mock(Sone.class);
- FetchSone fetchSone = soneDownloader.new FetchSone(sone);
- fetchSone.run();
- verify(soneDownloader).fetchSone(eq(sone));
- }
-
- @Test
public void notBeingAbleToFetchAnUnknownSoneDoesNotUpdateCore() {
soneDownloader.fetchSone(sone);
verify(freenetInterface).fetchUri(requestUri);