Skip to content

Commit d455b5e

Browse files
authored
Merge pull request commons-app#784 from psh/master
Fixing Travis build failure on master
2 parents 3db421a + 2e4b25a commit d455b5e

File tree

2 files changed

+11
-22
lines changed

2 files changed

+11
-22
lines changed

app/src/androidTest/java/fr/free/nrw/commons/SettingsActivityTest.java

+8-20
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
import android.support.test.filters.LargeTest;
1010
import android.support.test.rule.ActivityTestRule;
1111
import android.support.test.runner.AndroidJUnit4;
12-
import android.view.View;
1312

14-
import org.hamcrest.Matcher;
13+
import org.hamcrest.Matchers;
1514
import org.junit.Rule;
1615
import org.junit.Test;
1716
import org.junit.runner.RunWith;
@@ -20,9 +19,6 @@
2019

2120
import fr.free.nrw.commons.settings.SettingsActivity;
2221

23-
import static org.hamcrest.Matchers.allOf;
24-
import static org.hamcrest.Matchers.anything;
25-
2622
@LargeTest
2723
@RunWith(AndroidJUnit4.class)
2824
public class SettingsActivityTest {
@@ -65,8 +61,8 @@ protected void afterActivityFinished() {
6561
@Test
6662
public void oneLicenseIsChecked() {
6763
// click "License" (the first item)
68-
Espresso.onData(anything())
69-
.inAdapterView(findPreferenceList())
64+
Espresso.onData(Matchers.anything())
65+
.inAdapterView(ViewMatchers.withId(android.R.id.list))
7066
.atPosition(0)
7167
.perform(ViewActions.click());
7268

@@ -78,8 +74,8 @@ public void oneLicenseIsChecked() {
7874
@Test
7975
public void afterClickingCcby4ItWillStay() {
8076
// click "License" (the first item)
81-
Espresso.onData(anything())
82-
.inAdapterView(findPreferenceList())
77+
Espresso.onData(Matchers.anything())
78+
.inAdapterView(ViewMatchers.withId(android.R.id.list))
8379
.atPosition(0)
8480
.perform(ViewActions.click());
8581

@@ -89,8 +85,8 @@ public void afterClickingCcby4ItWillStay() {
8985
).perform(ViewActions.click());
9086

9187
// click "License" (the first item)
92-
Espresso.onData(anything())
93-
.inAdapterView(findPreferenceList())
88+
Espresso.onData(Matchers.anything())
89+
.inAdapterView(ViewMatchers.withId(android.R.id.list))
9490
.atPosition(0)
9591
.perform(ViewActions.click());
9692

@@ -100,12 +96,4 @@ public void afterClickingCcby4ItWillStay() {
10096
ViewMatchers.withText(R.string.license_name_cc_by_four)
10197
));
10298
}
103-
104-
private static Matcher<View> findPreferenceList() {
105-
return allOf(
106-
ViewMatchers.isDescendantOfA(ViewMatchers.withId(R.id.settingsFragment)),
107-
ViewMatchers.withResourceName("list"),
108-
ViewMatchers.hasFocus()
109-
);
110-
}
111-
}
99+
}

app/src/test/java/fr/free/nrw/commons/nearby/NearbyAdapterFactoryTest.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
import fr.free.nrw.commons.R;
2323
import fr.free.nrw.commons.location.LatLng;
2424

25-
import static org.junit.Assert.*;
25+
import static org.junit.Assert.assertEquals;
26+
import static org.junit.Assert.assertNotNull;
2627

2728
@RunWith(RobolectricTestRunner.class)
28-
@Config(constants = BuildConfig.class)
29+
@Config(constants = BuildConfig.class, sdk = 21)
2930
public class NearbyAdapterFactoryTest {
3031

3132
private static final Place PLACE = new Place("name", Place.Description.AIRPORT,

0 commit comments

Comments
 (0)