### Question:
LocationEngineControllerImpl implements LocationEngineController { @Override public void onResume() { registerReceiver(); requestLocationUpdates(); } LocationEngineControllerImpl(@NonNull Context context,
                               @NonNull LocationEngine locationEngine,
                               @NonNull LocationUpdatesBroadcastReceiver locationUpdatesBroadcastReceiver); @Override void onPause(); @Override void onResume(); @Override void onDestroy();  }### Answer:
@Test public void testOnResume() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); when(mockedContext.checkPermission(anyString(), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_GRANTED); locationEngineController = new LocationEngineControllerImpl(mockedContext, locationEngine, broadcastReceiver); locationEngineController.onResume(); verify(mockedContext).registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class)); }
@Test public void testOnResumePermissionsDisabled() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); when(mockedContext.checkPermission(anyString(), anyInt(), anyInt())).thenReturn(PackageManager.PERMISSION_DENIED); locationEngineController = new LocationEngineControllerImpl(mockedContext, locationEngine, broadcastReceiver); locationEngineController.onResume(); verifyZeroInteractions(locationEngine); }