package com.github.vergnes.albumindexer.rss;

/**
 * Created by denis.vergnes on 21/08/2015.
 */
public class RssAlbumFetcherTaskTest {

    
}

@@ -39,16 +39,532 @@
 r.rss;%0A%0A
+import com.github.vergnes.albumindexer.domain.Album;%0Aimport com.rometools.fetcher.FeedFetcher;%0Aimport com.rometools.rome.feed.synd.SyndEntry;%0Aimport com.rometools.rome.feed.synd.SyndFeed;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Optional;%0Aimport java.util.function.Consumer;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Mockito.*;%0A%0A
 /**%0A * C
@@ -606,16 +606,51 @@
 15.%0A */%0A
+@RunWith(MockitoJUnitRunner.class)%0A
 public c
@@ -685,11 +685,947 @@
  %7B%0A%0A    
+@Mock%0A    private RssAlbumParser parser;%0A%0A    @Mock%0A    private FeedFetcher fetcher;%0A%0A    @Mock%0A    private Consumer%3CAlbum%3E consumer;%0A%0A    @InjectMocks%0A    private RssAlbumFetcherTask task;%0A%0A    @Test%0A    public void should_retrieve_albums() throws Exception %7B%0A        SyndFeed syndFeed = mock(SyndFeed.class);%0A        SyndEntry entry1 = mock(SyndEntry.class);%0A        SyndEntry entry2 = mock(SyndEntry.class);%0A        SyndEntry entry3 = mock(SyndEntry.class);%0A        when(syndFeed.getEntries()).thenReturn(Arrays.asList(entry1, entry2, entry3));%0A%0A        when(fetcher.retrieveFeed(null)).thenReturn(syndFeed);%0A%0A        Album album1 = mock(Album.class);%0A        Album album2 = mock(Album.class);%0A        when(parser.parse(any(SyndEntry.class))).thenReturn(Optional.of(album1), Optional.empty(), Optional.of(album2));%0A%0A        task.fetchAlbums();%0A%0A        verify(consumer).accept(album1);%0A        verify(consumer).accept(album2);%0A    %7D%0A
 %0A%7D%0A

add unit test