use of com.karumi.rosie.sample.comics.domain.model.ComicSeries in project Rosie by Karumi.
the class ComicSeriesApiDataSource method getPage.
@Override
public PaginatedCollection<ComicSeries> getPage(Page page) throws MarvelApiException {
int offset = page.getOffset();
int limit = page.getLimit();
MarvelResponse<SeriesCollectionDto> seriesApiResponse = seriesApiClient.getAll(offset, limit);
SeriesCollectionDto seriesCollectionDto = seriesApiResponse.getResponse();
Collection<ComicSeries> comicSeries = mapper.reverseMap(seriesCollectionDto.getSeries());
PaginatedCollection<ComicSeries> comicSeriesPage = new PaginatedCollection<>(comicSeries);
comicSeriesPage.setPage(page);
comicSeriesPage.setHasMore(seriesCollectionDto.getOffset() + seriesCollectionDto.getCount() < seriesCollectionDto.getTotal());
return comicSeriesPage;
}
use of com.karumi.rosie.sample.comics.domain.model.ComicSeries in project Rosie by Karumi.
the class ComicSeriesFakeDataSource method getRedWolf.
@NonNull
private ComicSeries getRedWolf() {
ComicSeries redWolf = new ComicSeries();
redWolf.setKey(RED_WOLF_KEY);
redWolf.setName("Red Wolf # 2");
redWolf.setCoverUrl("http://x.annihil.us/u/prod/marvel/i/mg/4/10/5655d353959ad/detail.jpg");
redWolf.setDescription("WHO ARE THE GUARDIANS 1000?! Defending the galaxy is a good gig, but Drax isn’t thrilled" + " with the combat hours (not enough of them) and Rocket isn’t thrilled with the" + " compensation (not enough of it). They’re off on an adventure to supplement both," + " and Groot is happy to come along. But instead of the perks they want, they’re about" + " to get more trouble than they can handle. Good thing the Guardians 3000 are on hand" + " to help! But what about…THE GUARDIANS 1000??!! Also in this issue, Latour and" + " Cheung tell a one-off story of Ben Grimm and Rocket Raccoon, stuck on a planet" + " where culture is based on Earth-style professional wrestling…but the stakes are" + " life and death! THIS AIN’T KAYFABE, BROTHER! ");
redWolf.setReleaseYear(2015);
redWolf.setRating("Explicit Content");
redWolf.setComics(getComics(redWolf.getName()));
return redWolf;
}
use of com.karumi.rosie.sample.comics.domain.model.ComicSeries in project Rosie by Karumi.
the class MainActivityTest method getComicSeries.
@NonNull
private ComicSeries getComicSeries(int id) {
ComicSeries comicSeries = new ComicSeries();
comicSeries.setKey(id);
comicSeries.setName("ComicSeries - " + id);
comicSeries.setDescription("Description Comic Serie - " + id);
return comicSeries;
}
use of com.karumi.rosie.sample.comics.domain.model.ComicSeries in project Rosie by Karumi.
the class ComicSeriesDetailsActivityTest method givenValidComicSeries.
private ComicSeries givenValidComicSeries() throws Exception {
ComicSeries comicSeries = getComicSeries(ANY_COMIC_SERIES_ID);
when(comicSeriesRepository.getComicSeriesDetail(anyInt())).thenReturn(comicSeries);
return comicSeries;
}
use of com.karumi.rosie.sample.comics.domain.model.ComicSeries in project Rosie by Karumi.
the class ComicSeriesDetailsActivityTest method shouldShowComicIfComicSeriesHaveComics.
@Test
public void shouldShowComicIfComicSeriesHaveComics() throws Exception {
ComicSeries comicSeries = givenValidComicSeries();
List<ComicSeriesDetailViewModel> comics = givenComicData(comicSeries);
startActivity();
onView(withId(R.id.rv_comics)).perform(RecyclerViewActions.scrollToPosition(1));
assertRecyclerViewShowComics(comics);
}
Aggregations