Rename class that fetches a Sone with its URI.
[Sone.git] / src / test / java / net / pterodactylus / sone / core / SoneDownloaderTest.java
1 package net.pterodactylus.sone.core;
2
3 import static org.mockito.Matchers.eq;
4 import static org.mockito.Mockito.mock;
5 import static org.mockito.Mockito.verify;
6 import static org.mockito.Mockito.when;
7
8 import net.pterodactylus.sone.core.SoneDownloader.FetchSoneWithUri;
9 import net.pterodactylus.sone.data.Sone;
10
11 import freenet.keys.FreenetURI;
12
13 import org.junit.Test;
14
15 /**
16  * Unit test for {@link SoneDownloader} and its subclasses.
17  *
18  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
19  */
20 public class SoneDownloaderTest {
21
22         @Test
23         public void fetchSoneWithUriDownloadsSoneWithUri() {
24                 SoneDownloader soneDownloader = mock(SoneDownloader.class);
25                 Sone sone = mock(Sone.class);
26                 FreenetURI soneUri = mock(FreenetURI.class);
27                 when(sone.getRequestUri()).thenReturn(soneUri);
28                 FetchSoneWithUri fetchSoneWithUri = soneDownloader.new FetchSoneWithUri(sone);
29                 fetchSoneWithUri.run();
30                 verify(soneDownloader).fetchSone(eq(sone), eq(soneUri));
31         }
32
33 }