Skip to content

Commit

Permalink
Multiple refactorizations
Browse files Browse the repository at this point in the history
  • Loading branch information
saulmm committed Jan 5, 2016
1 parent ab8352e commit 73fe634
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package saulmm.avengers.tests;
package saulmm.avengers;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Expand All @@ -7,6 +7,7 @@
import java.util.List;

import rx.Observable;
import saulmm.avengers.TestData;
import saulmm.avengers.entities.CollectionItem;
import saulmm.avengers.entities.MarvelCharacter;
import saulmm.avengers.repository.CharacterRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package saulmm.avengers.tests;
package saulmm.avengers;

import saulmm.avengers.AvengersApplication;
import saulmm.avengers.injector.components.AppComponent;
import saulmm.avengers.injector.DaggerTestAppComponent;
import saulmm.avengers.injector.TestAppComponent;
import saulmm.avengers.injector.TestAppModule;

public class TestAvengersApplication extends AvengersApplication {
private TestAppComponent mAppComponent;
Expand Down
12 changes: 12 additions & 0 deletions app/src/androidTest/java/saulmm/avengers/TestData.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package saulmm.avengers.tests;
package saulmm.avengers.injector;

import javax.inject.Singleton;

import dagger.Component;
import saulmm.avengers.AvengersApplication;
import saulmm.avengers.injector.AppModule;
import saulmm.avengers.injector.components.AppComponent;
import saulmm.avengers.repository.CharacterRepository;
import saulmm.avengers.TestAvengersApplication;

@Singleton @Component(modules = TestAppModule.class)
public interface TestAppComponent extends AppComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
package saulmm.avengers.tests;
package saulmm.avengers.injector;

import javax.inject.Singleton;

import dagger.Module;
import dagger.Provides;
import saulmm.avengers.AvengersApplication;
import saulmm.avengers.repository.CharacterRepository;
import saulmm.avengers.rest.RestDataSource;
import saulmm.avengers.MockRestDataSource;
import saulmm.avengers.TestAvengersApplication;

@Module
public class TestAppModule {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

import android.app.Application;
import android.content.Context;
import android.support.test.internal.util.AndroidRunnerParams;
import android.support.test.runner.AndroidJUnit4;
import android.support.test.runner.AndroidJUnitRunner;

import org.junit.runners.model.InitializationError;

import saulmm.avengers.tests.TestAvengersApplication;
import saulmm.avengers.TestAvengersApplication;

/**
* Created by saulmm on 04/01/16.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.widget.TextView;

import org.junit.Before;
import org.junit.Rule;
Expand All @@ -26,10 +27,15 @@

import static android.support.test.espresso.Espresso.*;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.Intents.times;
import static android.support.test.espresso.intent.matcher.IntentMatchers.hasComponent;
import static android.support.test.espresso.matcher.ViewMatchers.*;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;

@LargeTest
@RunWith(AndroidJUnit4.class)
Expand All @@ -40,8 +46,13 @@ public class CharacterListActivityInstrumentationTest {
new IntentsTestRule<>(CharacterListActivity.class);

@Test
public void testThatAClickOnTheAvengerOPensTheDetailActivity() {
onView(ViewMatchers.withId(R.id.activity_avengers_recycler))
public void testThatAvengersDataIsShown() {
onView(withText("Arcana")).check(matches(isDisplayed()));
}

@Test
public void testThatAClickOnTheAvengerOpensTheDetailActivity() {
onView(withId(R.id.activity_avengers_recycler))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));

intended(hasComponent(CharacterDetailActivity.class.getCanonicalName()));
Expand Down
12 changes: 0 additions & 12 deletions app/src/androidTest/java/saulmm/avengers/tests/TestData.java

This file was deleted.

0 comments on commit 73fe634

Please sign in to comment.