### Question:
LocationUpdatesBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { try { if (intent == null) { Log.w(TAG, "intent == null"); return; } final String action = intent.getAction(); if (!ACTION_LOCATION_UPDATED.equals(action)) { return; } LocationEngineResult result = LocationEngineResult.extractResult(intent); if (result == null) { Log.w(TAG, "LocationEngineResult == null"); return; } LocationCollectionClient collectionClient = LocationCollectionClient.getInstance(); MapboxTelemetry telemetry = collectionClient.getTelemetry(); String sessionId = collectionClient.getSessionId(); List<Location> locations = result.getLocations(); for (Location location : locations) { if (isThereAnyNaN(location) || isThereAnyInfinite(location)) { continue; } telemetry.push(LocationMapper.create(location, sessionId)); } } catch (Throwable throwable) { Log.e(TAG, throwable.toString()); } }  @Override void onReceive(Context context, Intent intent);  }### Answer:
@Test public void testNullIntentOnReceive() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); broadcastReceiver.onReceive(mockedContext, null); verify(mockedContext, never()).getApplicationContext(); }
@Test public void testOnReceiveActionReturnNull() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); Intent mockedIntent = mock(Intent.class); when(mockedIntent.getAction()).thenReturn(null); broadcastReceiver.onReceive(mockedContext, mockedIntent); verify(mockedIntent, never()).getStringExtra(anyString()); }