/** shall request updates from enabled providers and */ @Test public void testProperUpdateRequest( @Mocked final LocationManager locationManager, @Mocked final Context context, @Mocked final Configuration configuration, @Cascading Intent intent, @Mocked Log log, @Mocked(methods = {"scheduleLocationUpdates", "scheduleCancelationIntent"}) final LegacyLocationProcessor llp) { Deencapsulation.setField(llp, "locationManager", locationManager); Deencapsulation.setField(llp, "configuration", configuration); new Expectations() { { configuration.getLocationProvider(); returns("grumple|grample|grimple"); locationManager.isProviderEnabled("grumple"); returns(true); Log.d(LegacyLocationProcessor.LOG_TAG, withAny("")); invoke(llp, "scheduleLocationUpdates", "grumple"); locationManager.isProviderEnabled("grample"); returns(false); locationManager.isProviderEnabled("grimple"); returns(true); Log.d(LegacyLocationProcessor.LOG_TAG, withAny("")); invoke(llp, "scheduleLocationUpdates", "grimple"); invoke(llp, "scheduleCancelationIntent"); } }; llp.requestLocationUpdate(); // nothing else is allowed new FullVerifications() { { } }; }