summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/activity/BaseMapboxMapTest.java
blob: 1b1211b94c675cc9216d3eb19e624652fa6c6369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.mapbox.mapboxsdk.activity;

import android.app.Activity;
import android.support.test.espresso.Espresso;
import android.util.Log;

import com.mapbox.mapboxsdk.activity.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;

import org.junit.After;
import org.junit.Before;

public abstract class BaseMapboxMapTest extends BaseTest {

    private OnMapReadyIdlingResource idlingResource;
    protected MapboxMap mapboxMap;

    @Before
    public void registerIdlingResource() {
        Log.e(MapboxConstants.TAG, "@Before test");
        idlingResource = new OnMapReadyIdlingResource(getActivity());
        Espresso.registerIdlingResources(idlingResource);
        checkViewIsDisplayed(R.id.mapView);
        mapboxMap = idlingResource.getMapboxMap();
    }

    public abstract Activity getActivity();

    @After
    public void unregisterIdlingResource() {
        Log.e(MapboxConstants.TAG, "@After test");
        Espresso.unregisterIdlingResources(idlingResource);
    }
}