@Test @SmallTest public void testReplace_empty() { mTestIdleController.replace(Collections.<WorkSpec>emptyList()); verify(mMockTracker).removeListener(mTestIdleController); verifyZeroInteractions(mCallback); }
public void replace(@NonNull List<WorkSpec> workSpecs) { mMatchingWorkSpecIds.clear(); for (WorkSpec workSpec : workSpecs) { if (hasConstraint(workSpec)) { mMatchingWorkSpecIds.add(workSpec.id); } } if (mMatchingWorkSpecIds.isEmpty()) { mTracker.removeListener(this); } else { mTracker.addListener(this); } updateCallback(); }
ConstraintController implements ConstraintListener<T> { public void replace(@NonNull List<WorkSpec> workSpecs) { mMatchingWorkSpecIds.clear(); for (WorkSpec workSpec : workSpecs) { if (hasConstraint(workSpec)) { mMatchingWorkSpecIds.add(workSpec.id); } } if (mMatchingWorkSpecIds.isEmpty()) { mTracker.removeListener(this); } else { mTracker.addListener(this); } updateCallback(); } }
ConstraintController implements ConstraintListener<T> { public void replace(@NonNull List<WorkSpec> workSpecs) { mMatchingWorkSpecIds.clear(); for (WorkSpec workSpec : workSpecs) { if (hasConstraint(workSpec)) { mMatchingWorkSpecIds.add(workSpec.id); } } if (mMatchingWorkSpecIds.isEmpty()) { mTracker.removeListener(this); } else { mTracker.addListener(this); } updateCallback(); } ConstraintController(ConstraintTracker<T> tracker, OnConstraintUpdatedCallback callback); }
ConstraintController implements ConstraintListener<T> { public void replace(@NonNull List<WorkSpec> workSpecs) { mMatchingWorkSpecIds.clear(); for (WorkSpec workSpec : workSpecs) { if (hasConstraint(workSpec)) { mMatchingWorkSpecIds.add(workSpec.id); } } if (mMatchingWorkSpecIds.isEmpty()) { mTracker.removeListener(this); } else { mTracker.addListener(this); } updateCallback(); } ConstraintController(ConstraintTracker<T> tracker, OnConstraintUpdatedCallback callback); void replace(@NonNull List<WorkSpec> workSpecs); void reset(); boolean isWorkSpecConstrained(@NonNull String workSpecId); @Override void onConstraintChanged(@Nullable T newValue); }
ConstraintController implements ConstraintListener<T> { public void replace(@NonNull List<WorkSpec> workSpecs) { mMatchingWorkSpecIds.clear(); for (WorkSpec workSpec : workSpecs) { if (hasConstraint(workSpec)) { mMatchingWorkSpecIds.add(workSpec.id); } } if (mMatchingWorkSpecIds.isEmpty()) { mTracker.removeListener(this); } else { mTracker.addListener(this); } updateCallback(); } ConstraintController(ConstraintTracker<T> tracker, OnConstraintUpdatedCallback callback); void replace(@NonNull List<WorkSpec> workSpecs); void reset(); boolean isWorkSpecConstrained(@NonNull String workSpecId); @Override void onConstraintChanged(@Nullable T newValue);  }