### Question:
Enforcer { public void deleteUnexpected() { checkState(!safemode, "Deletion is not allowed in safe mode"); checkState(configured.size() > 0, "Configured entities can not be empty"); List<T> toDelete = unexpected(); float destruction = toDelete.size() * 1.0f / configured.size(); checkState(destruction <= PERMISSIBLE_DELETION_THRESHOLD, "Too many [%s%] entities being deleted in one run", destruction * 100); if (!toDelete.isEmpty()) { LOG.info("Deleting {} redundant entities: {}", toDelete.size(), toDelete); delete(toDelete); } else { LOG.info("No un-expected entity was found."); } } protected  Enforcer(Collection<T> configured, Supplier<Collection<T>> existing, BiPredicate<T, T> isEqual, boolean safemode); List<T> absent(); List<T> unexpected(); void createAbsent(); void deleteUnexpected(); void enforceAll(); void stats();  }### Answer:
@Test(expected = IllegalStateException.class) public void testSafeMode() { enforcer = new DummyEnforcer(dummies, Collections::emptyList); enforcer.deleteUnexpected(); }
@Test(expected = IllegalStateException.class) public void testTooManyBeingDeleted() { enforcer = new DummyEnforcer( dummies, () -> Arrays.asList(new Dummy("x", emptyMap()), new Dummy("y", emptyMap())), false); enforcer.deleteUnexpected(); }