### Question:
BatteryChargingTracker extends BroadcastReceiverConstraintTracker<Boolean> { @Override public IntentFilter getIntentFilter() { IntentFilter intentFilter = new IntentFilter(); if (Build.VERSION.SDK_INT >= 23) { intentFilter.addAction(BatteryManager.ACTION_CHARGING); intentFilter.addAction(BatteryManager.ACTION_DISCHARGING); } else { intentFilter.addAction(Intent.ACTION_POWER_CONNECTED); intentFilter.addAction(Intent.ACTION_POWER_DISCONNECTED); } return intentFilter; } BatteryChargingTracker(Context context); @Override Boolean getInitialState(); @Override IntentFilter getIntentFilter(); @Override void onBroadcastReceive(Context context, @NonNull Intent intent);  }### Answer:
@Test @SmallTest @SdkSuppress(maxSdkVersion = 22) public void testGetIntentFilter_beforeApi23() { IntentFilter intentFilter = mTracker.getIntentFilter(); assertThat(intentFilter.hasAction(Intent.ACTION_POWER_CONNECTED), is(true)); assertThat(intentFilter.hasAction(Intent.ACTION_POWER_DISCONNECTED), is(true)); assertThat(intentFilter.countActions(), is(2)); }
@Test @SmallTest @SdkSuppress(minSdkVersion = 23) public void testGetIntentFilter_afterApi23() { IntentFilter intentFilter = mTracker.getIntentFilter(); assertThat(intentFilter.hasAction(BatteryManager.ACTION_CHARGING), is(true)); assertThat(intentFilter.hasAction(BatteryManager.ACTION_DISCHARGING), is(true)); assertThat(intentFilter.countActions(), is(2)); }