UserFeedsRepository { public Feed getFeed(String id) { return httpClient.getApi().getFeed(id); } @Inject  UserFeedsRepository(HttpClient httpClient); List<Feed> getFeeds(); Feed getFeed(String id);  }
@Test public void itReturnsFeedId() { Feed feed = repository.getFeed(expectedId); assertThat(feed.getId(), is(expectedId)); }
@Test public void itReturnsTitleWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public String getTitle() { return "Newest Episode!"; } }; assertThat(episode.getTitle(), is(expectedEpisode.getTitle())); }
@Test public void itReturnsAudioUrlWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public String getAudioUrl() { return "http: } }; assertThat(episode.getAudioUrl(), is(expectedEpisode.getAudioUrl())); }
@Test public void itReturnsImageUrlWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public Image getImage() { return new Image() { @Override public String getUrl() { return "http: } }; } }; assertThat(episode.getImage().getUrl(), is(expectedEpisode.getImage().getUrl())); }
@Test public void itReturnsPublishedDateWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public Date getPublishedDate() { DateTime date = dateTimeParser().parseDateTime("2015-09-23T15:00:00.000Z"); return date.toDate(); } }; assertThat(episode.getPublishedDate(), is(expectedEpisode.getPublishedDate())); }
@Test public void itReturnsDurationWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public String getDuration() { return "01:01:07"; } }; assertThat(episode.getDuration(), is(expectedEpisode.getDuration())); }
@Test public void itReturnsDescriptionWhenGetFeeds() { Feed feed = repository.getFeed(expectedId); Episode episode = feed.getEpisodes().get(firstPosition); Episode expectedEpisode = new Episode() { @Override public String getDescription() { return "Newest episode description"; } }; assertThat(episode.getDescription(), is(expectedEpisode.getDescription())); }