### Question:
ConstraintTracker { public void removeListener(ConstraintListener<T> listener) { if (mListeners.remove(listener) && mListeners.isEmpty()) { stopTracking(); } } ConstraintTracker(Context context); void addListener(ConstraintListener<T> listener); void removeListener(ConstraintListener<T> listener); void setState(T newState); abstract T getInitialState(); abstract void startTracking(); abstract void stopTracking();  }### Answer:
@Test public void testRemoveListener() { ConstraintListener<Boolean> constraintListener1 = mock(ConstraintListener.class); ConstraintListener<Boolean> constraintListener2 = mock(ConstraintListener.class); mTracker.addListener(constraintListener1); mTracker.addListener(constraintListener2); mTracker.removeListener(constraintListener1); assertThat(mTracker.mIsTracking, is(true)); assertThat(mTracker.mStopTrackingCount, is(0)); mTracker.removeListener(constraintListener2); assertThat(mTracker.mIsTracking, is(false)); assertThat(mTracker.mStopTrackingCount, is(1)); }