Skip to content

Commit

Permalink
Fixed broken test
Browse files Browse the repository at this point in the history
  • Loading branch information
saulmm committed Jan 3, 2016
1 parent e3daa8d commit 9667b3f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 24 deletions.
7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,10 @@ dependencies {
exclude module: 'recyclerview-v7'
}

androidTestCompile "com.android.support:support-annotations:$libs.supportVersion"
androidTestApt "com.google.dagger:dagger-compiler:${libs.dagger}"

}

configurations.all {
resolutionStrategy.force "com.android.support:support-annotations:$libs.supportVersion"
}
14 changes: 0 additions & 14 deletions app/src/androidTest/java/saulmm/avengers/ApplicationTest.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
package saulmm.avengers;
package saulmm.avengers.tests;


import android.support.test.espresso.Espresso;
import android.support.test.espresso.contrib.RecyclerViewActions;
import android.support.test.espresso.intent.Intents;
import android.support.test.espresso.intent.rule.IntentsTestRule;
import android.support.test.espresso.matcher.ViewMatchers;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;

import saulmm.avengers.R;
import saulmm.avengers.injector.components.DaggerAvengersComponent;
import saulmm.avengers.injector.modules.ActivityModule;
import saulmm.avengers.repository.CharacterRepository;
import saulmm.avengers.views.activities.CharacterDetailActivity;
import saulmm.avengers.views.activities.CharacterListActivity;

import static android.support.test.espresso.Espresso.*;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.intent.Intents.intended;
import static android.support.test.espresso.intent.Intents.times;
Expand All @@ -31,19 +37,23 @@ public class CharacterListActivityInstrumentationTest {
public IntentsTestRule<CharacterListActivity> mCharacterListIntentRule =
new IntentsTestRule<>(CharacterListActivity.class);

@Before
public void setup() {
}

@Test
public void clickOnAvenger() {
public void testThatAClickOnTheAvengerOPensTheDetailActivity() {
waitForRequest();

Espresso.onView(withId(R.id.activity_avengers_recycler))
onView(ViewMatchers.withId(R.id.activity_avengers_recycler))
.perform(RecyclerViewActions.actionOnItemAtPosition(0, click()));

intended(hasComponent(CharacterDetailActivity.class.getCanonicalName()));
}

public void waitForRequest() {
try {
Thread.sleep(4000);
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ public void onReceive(Bitmap bitmap) {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initializeDependencyInjector();
initializeBinding();
initButterknife();
initializeDependencyInjector();
initializePresenter();
initToolbar();
initTransitions();
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
configuration = [
package : "saulmm.avengers",
buildToolsVersion : "23.0.1",
buildToolsVersion : "23.0.2",
compileVersion : 23,
minSdk : 21,
targetSdk : 23,
Expand Down Expand Up @@ -38,10 +38,10 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.1.0'
classpath 'com.android.databinding:dataBinder:1.0-rc1'
classpath 'me.tatarka:gradle-retrolambda:3.3.0-beta3'
classpath 'com.android.databinding:dataBinder:1.0-rc4'
}
}

Expand Down

0 comments on commit 9667b3f

Please sign in to comment.