Add unit test for preferences.
[Sone.git] / src / test / java / net / pterodactylus / sone / core / SoneDownloaderTest.java
index 413b8ff..21d01f6 100644 (file)
@@ -6,6 +6,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import net.pterodactylus.sone.core.SoneDownloader.FetchSone;
+import net.pterodactylus.sone.core.SoneDownloader.FetchSoneWithUri;
 import net.pterodactylus.sone.data.Sone;
 
 import freenet.keys.FreenetURI;
@@ -20,14 +21,23 @@ import org.junit.Test;
 public class SoneDownloaderTest {
 
        @Test
-       public void fetchSoneDownloadsSone() {
+       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), eq(soneUri));
+               verify(soneDownloader).fetchSone(eq(sone));
        }
 
 }