use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.
the class MainActivityTest method givenExceptionObtainingCharacters.
private void givenExceptionObtainingCharacters() throws Exception {
when(charactersRepository.getAll(ReadPolicy.CACHE_ONLY)).thenReturn(new ArrayList<Character>());
when(charactersRepository.getPage(any(Page.class))).thenThrow(new MarvelApiException(ANY_EXCEPTION, null));
}
use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.
the class MainActivityTest method getCharacter.
@NonNull
private Character getCharacter(int id) {
Character character = new Character();
character.setKey("" + id);
character.setName("SuperHero - " + id);
character.setDescription("Description Super Hero - " + id);
character.setThumbnailUrl("https://id.annihil.us/u/prod/marvel/id/mg/c/60/55b6a28ef24fa.jpg");
return character;
}
use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.
the class GetCharacters method getAllCharactersInCache.
public PaginatedCollection<Character> getAllCharactersInCache() {
Collection<Character> all;
try {
all = charactersRepository.getAll(ReadPolicy.CACHE_ONLY);
} catch (Exception e) {
all = new ArrayList<>();
}
if (all == null) {
all = new ArrayList<>();
}
Page page = Page.withOffsetAndLimit(0, all.size());
PaginatedCollection<Character> comics = new PaginatedCollection<>(all);
comics.setPage(page);
comics.setHasMore(true);
return comics;
}
use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.
the class CharactersFakeDataSource method getScarletWitch.
@NonNull
private Character getScarletWitch() {
Character scarlet = new Character();
scarlet.setKey(SCARLET_KEY);
scarlet.setName("Scarlet Witch");
scarlet.setThumbnailUrl("https://i.annihil.us/u/prod/marvel/i/mg/9/b0/537bc2375dfb9.jpg");
scarlet.setDescription("Born at the Wundagore base of the High Evolutionary, in proximity to the eldritch energies" + " of the Elder God Chthon; Wanda and her brother Pietro's mother, Magda, fled " + "Wundagore shortly after their birth. Although not known at the time, Chthon formed " + "a mystic bond with Wanda, who, it was later learned, was destined to serve the role " + "of Nexus Being, a living focal point for the Earth dimension's mystical energy.");
return scarlet;
}
use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.
the class CharactersFakeDataSource method getSpiderman.
@NonNull
private Character getSpiderman() {
Character spiderman = new Character();
spiderman.setKey(SPIDERMAN_KEY);
spiderman.setName("Spiderman");
spiderman.setThumbnailUrl("http://x.annihil.us/u/prod/marvel/i/mg/6/60/538cd3628a05e.jpg");
spiderman.setDescription("Bitten by a radioactive spider, high school student Peter Parker gained the speed, " + "strength and powers of a spider. Adopting the name Spider-Man, Peter hoped to start" + " a career using his new abilities. Taught that with great power comes great" + " responsibility, Spidey has vowed to use his powers to help people.");
return spiderman;
}
Aggregations