summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity
diff options
context:
space:
mode:
authorCameron Mace <cameron@mapbox.com>2016-12-16 16:19:15 -0500
committerGitHub <noreply@github.com>2016-12-16 16:19:15 -0500
commit20b958301eb208fe9ed0ae8edfb14b6f3741d8f2 (patch)
tree94ae0ce250cda159be13f9a21cc70c92d4908974 /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity
parentf95b4838ea816b9da0c151a953a1f98f97c79a39 (diff)
downloadqtlocation-mapboxgl-20b958301eb208fe9ed0ae8edfb14b6f3741d8f2.tar.gz
Adds checkstyle to CI (#7442)
* adds checkstyle to CI * fixed gradlew path * resolved testapp checkstyle violations * added back mapboxMap variable for test * checkstyle annotations * checkstyle SDK round 1 * maps package checkstyle * rest of SDK checkstyle * checkstyle gesture library * checkstyle test * finished rest of test checkstyle * resolved all checkstyle errors * fixed class name * removed old test file * fixed camera postion test * fixed native crash
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java78
1 files changed, 40 insertions, 38 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
index 44a98ad664..2f51140cd1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
@@ -4,6 +4,7 @@ import android.app.Activity;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.IdlingResourceTimeoutException;
import android.support.test.rule.ActivityTestRule;
+
import timber.log.Timber;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -22,49 +23,50 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
public abstract class BaseActivityTest {
- @Rule
- public ActivityTestRule<Activity> rule = new ActivityTestRule<>(getActivityClass());
- protected MapboxMap mapboxMap;
- protected OnMapReadyIdlingResource idlingResource;
+ @Rule
+ public ActivityTestRule<Activity> rule = new ActivityTestRule<>(getActivityClass());
+ protected MapboxMap mapboxMap;
+ protected OnMapReadyIdlingResource idlingResource;
- @Before
- public void beforeTest() {
- try {
- Timber.e("@Before test: register idle resource");
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- checkViewIsDisplayed(R.id.mapView);
- mapboxMap = idlingResource.getMapboxMap();
- } catch (IdlingResourceTimeoutException e) {
- Timber.e("Idling resource timed out. Couldn't not validate if map is ready.");
- throw new RuntimeException("Could not start test for " + getActivityClass().getSimpleName() + ".\n" +
- "The ViewHierarchy doesn't contain a view with resource id = R.id.mapView or \n" +
- "the Activity doesn't contain an instance variable with a name equal to mapboxMap.\n" +
- "You can resolve this issue be implementing the requirements above or\n add " + getActivityClass().getSimpleName() + " to the excludeActivities array in `generate-test-code.js`.\n");
- }
+ @Before
+ public void beforeTest() {
+ try {
+ Timber.e("@Before test: register idle resource");
+ idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
+ Espresso.registerIdlingResources(idlingResource);
+ checkViewIsDisplayed(R.id.mapView);
+ mapboxMap = idlingResource.getMapboxMap();
+ } catch (IdlingResourceTimeoutException idlingResourceTimeoutException) {
+ Timber.e("Idling resource timed out. Couldn't not validate if map is ready.");
+ throw new RuntimeException("Could not start test for " + getActivityClass().getSimpleName() + ".\n"
+ + "The ViewHierarchy doesn't contain a view with resource id = R.id.mapView or \n"
+ + "the Activity doesn't contain an instance variable with a name equal to mapboxMap.\n"
+ + "You can resolve this issue be implementing the requirements above or\n add "
+ + getActivityClass().getSimpleName() + " to the excludeActivities array in `generate-test-code.js`.\n");
}
+ }
- protected abstract Class getActivityClass();
+ protected abstract Class getActivityClass();
- protected void checkViewIsDisplayed(int id) {
- onView(withId(id))
- .check(matches(isDisplayed()));
- }
+ protected void checkViewIsDisplayed(int id) {
+ onView(withId(id))
+ .check(matches(isDisplayed()));
+ }
- protected void takeScreenshot(final String name) {
- final Activity activity = rule.getActivity();
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ScreenshotUtil.take(activity, name);
- }
- });
- }
+ protected void takeScreenshot(final String name) {
+ final Activity activity = rule.getActivity();
+ activity.runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ScreenshotUtil.take(activity, name);
+ }
+ });
+ }
- @After
- public void afterTest() {
- Timber.e("@After test: unregister idle resource");
- Espresso.unregisterIdlingResources(idlingResource);
- }
+ @After
+ public void afterTest() {
+ Timber.e("@After test: unregister idle resource");
+ Espresso.unregisterIdlingResources(idlingResource);
+ }
}