### Question:
BatteryChargingTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public Boolean getInitialState() { IntentFilter intentFilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED); Intent intent = mAppContext.registerReceiver(null, intentFilter); if (intent == null) { Log.e(TAG, "getInitialState - null intent received"); return null; } return isBatteryChangedIntentCharging(intent); } BatteryChargingTracker(Context context); @Override Boolean getInitialState(); @Override IntentFilter getIntentFilter(); @Override void onBroadcastReceive(Context context, @NonNull Intent intent);  }### Answer:
@Test @SmallTest public void testGetInitialState_nullIntent() { mockContextReturns(null); assertThat(mTracker.getInitialState(), is(nullValue())); }
@Test @SmallTest public void testGetInitialState_chargingIntent() { mockContextReturns(createBatteryChangedIntent(true)); assertThat(mTracker.getInitialState(), is(true)); }
@Test @SmallTest public void testGetInitialState_dischargingIntent() { mockContextReturns(createBatteryChangedIntent(false)); assertThat(mTracker.getInitialState(), is(false)); }