Skip to content

Commit f595c43

Browse files
committed
Finished unit tests
1 parent 3b9ee68 commit f595c43

File tree

2 files changed

+11
-31
lines changed
  • com.vogella.android.daggerjunitmockito/app/src/test/java/com/vogella/android/daggerjunitmockito
  • com.vogella.android.test.juntexamples/app/src/androidTest/java/com/vogella/android/test/juntexamples

2 files changed

+11
-31
lines changed

com.vogella.android.daggerjunitmockito/app/src/test/java/com/vogella/android/daggerjunitmockito/ExampleUnitTest.java

-17
This file was deleted.

com.vogella.android.test.juntexamples/app/src/androidTest/java/com/vogella/android/test/juntexamples/SecondActivityTest.java

+11-14
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,16 @@
2828
public class SecondActivityTest {
2929

3030
@Rule
31-
public ActivityTestRule<SecondActivity> rule = new ActivityTestRule<SecondActivity>(SecondActivity.class) ;
32-
// {
33-
// @Override
34-
// protected Intent getActivityIntent() {
35-
// InstrumentationRegistry.getTargetContext();
36-
// Intent intent = new Intent(Intent.ACTION_MAIN);
37-
// intent.putExtra("MYKEY", "Hello");
38-
// return intent;
39-
// }
40-
41-
42-
// };
31+
public ActivityTestRule<SecondActivity> rule = new ActivityTestRule<SecondActivity>(SecondActivity.class)
32+
{
33+
@Override
34+
protected Intent getActivityIntent() {
35+
InstrumentationRegistry.getTargetContext();
36+
Intent intent = new Intent(Intent.ACTION_MAIN);
37+
intent.putExtra("MYKEY", "Hello");
38+
return intent;
39+
}
40+
};
4341

4442
@Test
4543
public void ensureIntentDataIsDisplayed() throws Exception {
@@ -50,7 +48,6 @@ public void ensureIntentDataIsDisplayed() throws Exception {
5048
assertThat(viewById,notNullValue());
5149
assertThat(viewById, instanceOf(TextView.class));
5250
TextView textView = (TextView) viewById;
53-
// InstrumentationRegistry.getTargetContext().wait(10000);
54-
assertThat(textView.getEditableText().toString(),is("Hello"));
51+
assertThat(textView.getText().toString(),is("Hello"));
5552
}
5653
}

0 commit comments

Comments
 (0)