@Test
public void testApplySettings() {

    CTGeofenceSettings ctGeofenceSettings = new CTGeofenceSettings.Builder()
            .setLocationFetchMode(CTGeofenceSettings.FETCH_LAST_LOCATION_PERIODIC)
            .enableBackgroundLocationUpdates(true)
            .setInterval(2000000)
            .setFastestInterval(2000000)
            .setLocationAccuracy(CTGeofenceSettings.ACCURACY_LOW)
            .setSmallestDisplacement(900)
            .build();
    when(ctGeofenceAPI.getGeofenceSettings()).thenReturn(ctGeofenceSettings);
    final GoogleLocationAdapter locationAdapter = new GoogleLocationAdapter(application);
    try {
        WhiteboxImpl.invokeMethod(locationAdapter, "applySettings", application);
        LocationRequest actualLocationRequest = WhiteboxImpl.invokeMethod(locationAdapter,
                "getLocationRequest");
        assertEquals(ctGeofenceSettings.getInterval(), actualLocationRequest.getInterval());
        assertEquals(ctGeofenceSettings.getFastestInterval(), actualLocationRequest.getFastestInterval());
        assertEquals(ctGeofenceSettings.getSmallestDisplacement(),
                actualLocationRequest.getSmallestDisplacement(), 0);
        assertEquals(LocationRequest.PRIORITY_LOW_POWER, actualLocationRequest.getPriority());
        Field actualFetchMode = WhiteboxImpl.getField(GoogleLocationAdapter.class, "locationFetchMode");
        Field actualLocationUpdateEnabled = WhiteboxImpl.getField(GoogleLocationAdapter.class,
                "backgroundLocationUpdatesEnabled");
        assertEquals(ctGeofenceSettings.getLocationFetchMode(), actualFetchMode.getInt(locationAdapter));
        assertEquals(ctGeofenceSettings.isBackgroundLocationUpdatesEnabled(),
                actualLocationUpdateEnabled.getBoolean(locationAdapter));
    } catch (Exception e) {
        e.printStackTrace();
    }
}