NearestFit implements EventSubscriber { @Subscribe public synchronized void remove(TasksDeleted deletedEvent) { fitByGroupKey.invalidateAll(Iterables.transform(deletedEvent.getTasks(), Functions.compose( TaskGroupKey::from, Tasks::getConfig))); } @VisibleForTesting  NearestFit(Ticker ticker); @Inject  NearestFit(); synchronized ImmutableSet<Veto> getNearestFit(TaskGroupKey groupKey); @Subscribe synchronized void remove(TasksDeleted deletedEvent); @Subscribe synchronized void stateChanged(TaskStateChange event); @Subscribe synchronized void vetoed(Vetoed vetoEvent);  }
@Test public void testRemove() { vetoed(SEVERITY_1); nearest.remove(new TasksDeleted(ImmutableSet.of(makeTask()))); assertNearest(); }