PopularStreamApiDatasource { public Observable<List<ApiMoviePoster>> getPopularPosters() { return backend.popularStream().map(tApiMoviePosters()); } PopularStreamApiDatasource(Backend backend); Observable<List<ApiMoviePoster>> getPopularPosters();  }
@Test public void shouldReturnApiMoviePosters() throws Exception { ApiMoviePoster firstPoster = new ApiMoviePoster(1L, "url1"); ApiMoviePoster secondPoster = new ApiMoviePoster(2L, "url2"); ApiMoviePoster thirdPoster = new ApiMoviePoster(3L, "url3"); List<ApiMoviePoster> expectedPosters = asList(firstPoster, secondPoster, thirdPoster); givenApiResponseWithMoviePoster(expectedPosters); TestSubscriber<List<ApiMoviePoster>> testSubscriber = TestSubscriber.create(); Observable<List<ApiMoviePoster>> popularPosters = apiDatasource.getPopularPosters(); popularPosters.subscribe(testSubscriber); testSubscriber.assertValue(expectedPosters); }