Search in sources :

Example 21 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharacterDetailsActivityTest method shouldShowCharacterDetailWhenCharacterIsLoaded.

@Test
public void shouldShowCharacterDetailWhenCharacterIsLoaded() throws Exception {
    Character character = givenAValidCharacter();
    startActivity();
    onView(withId(R.id.tv_character_name)).check(matches(withText(character.getName())));
    onView(withId(R.id.tv_description)).check(matches(withText(character.getDescription())));
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) InjectedInstrumentationTest(com.karumi.rosie.sample.InjectedInstrumentationTest) Test(org.junit.Test)

Example 22 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class CharacterDetailsActivityTest 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;
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) NonNull(android.support.annotation.NonNull)

Example 23 with Character

use of com.karumi.rosie.sample.characters.domain.model.Character in project Rosie by Karumi.

the class MainActivityTest method shouldOpenCharacterDetailActivityOnRecyclerViewItemClicked.

@Test
public void shouldOpenCharacterDetailActivityOnRecyclerViewItemClicked() throws Exception {
    List<Character> characters = givenThereAreSomeCharacters(ANY_NUMBER_OF_CHARACTERS);
    int characterIndex = 0;
    startActivity();
    onView(withId(R.id.rv_characters)).perform(RecyclerViewActions.actionOnItemAtPosition(characterIndex, click()));
    Character characterSelected = characters.get(characterIndex);
    intended(hasComponent(CharacterDetailsActivity.class.getCanonicalName()));
    intended(hasExtra("CharacterDetailsActivity.CharacterKey", characterSelected.getKey()));
}
Also used : Character(com.karumi.rosie.sample.characters.domain.model.Character) LargeTest(android.test.suitebuilder.annotation.LargeTest) InjectedInstrumentationTest(com.karumi.rosie.sample.InjectedInstrumentationTest) Test(org.junit.Test)

Aggregations

Character (com.karumi.rosie.sample.characters.domain.model.Character)23 NonNull (android.support.annotation.NonNull)10 Page (com.karumi.rosie.repository.datasource.paginated.Page)4 PaginatedCollection (com.karumi.rosie.repository.PaginatedCollection)3 MarvelApiException (com.karumi.marvelapiclient.MarvelApiException)2 InjectedInstrumentationTest (com.karumi.rosie.sample.InjectedInstrumentationTest)2 LinkedList (java.util.LinkedList)2 Test (org.junit.Test)2 LargeTest (android.test.suitebuilder.annotation.LargeTest)1 CharactersDto (com.karumi.marvelapiclient.model.CharactersDto)1 RosieUseCase (com.karumi.rosie.domain.usecase.RosieUseCase)1 Success (com.karumi.rosie.domain.usecase.annotation.Success)1 UseCase (com.karumi.rosie.domain.usecase.annotation.UseCase)1 OnSuccessCallback (com.karumi.rosie.domain.usecase.callback.OnSuccessCallback)1 OnErrorCallback (com.karumi.rosie.domain.usecase.error.OnErrorCallback)1 CharacterDetailViewModel (com.karumi.rosie.sample.characters.view.viewmodel.CharacterDetailViewModel)1 CharacterViewModel (com.karumi.rosie.sample.characters.view.viewmodel.CharacterViewModel)1 UnknownHostException (java.net.UnknownHostException)1 ArrayList (java.util.ArrayList)1