Last active
July 3, 2016 18:19
-
-
Save orhanobut/83956cb912cf5f2dddab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RunWith(AndroidJUnit4.class) | |
public class GooglePlacesApiTest { | |
private GoogleApiClient apiClient; | |
@Before public void setup() throws InterruptedException { | |
Context context = InstrumentationRegistery.getContext(); | |
final CountDownLatch latch = new CountDownLatch(1); | |
apiClient = new GoogleApiClient.Builder(context) | |
.addApi(Places.GEO_DATA_API) | |
.addApi(Places.PLACE_DETECTION_API) | |
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { | |
@Override public void onConnected(Bundle bundle) { | |
latch.countDown(); | |
} | |
}) | |
.build(); | |
apiClient.connect(); | |
assertThat(latch.await(3, SECONDS)).isTrue(); | |
} | |
@Test public void apiClientShouldConnect() { | |
assertThat(apiClient.isConnected()).isTrue(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment