@Test
public void testGetLastLocation() {

    final Location expectedLocation = GeofenceEventFake.getTriggeredLocation();
    when(LocationServices.getFusedLocationProviderClient(application))
            .thenReturn(providerClient);
    Task<Location> locationTask = mock(Task.class);
    try {
        PowerMockito.when(Tasks.await(locationTask)).thenReturn(expectedLocation);
    } catch (ExecutionException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    when(providerClient.getLastLocation()).thenReturn(locationTask);
    final GoogleLocationAdapter locationAdapter = new GoogleLocationAdapter(application);
    locationAdapter.getLastLocation(new CTLocationCallback() {
        @Override
        public void onLocationComplete(Location location) {
            Assert.assertSame(expectedLocation, location);
        }
    });
}