ModifierManager implements Tickable { public void purge(String tag) { if ("all".equals(tag)) { attributeModifiers = new ArrayList<>(); } else { Iterator<AttributeModifier> iterator = attributeModifiers.iterator(); while (iterator.hasNext()) { if (iterator.next().getTag().equals(tag)) { Console.getInstance().println("removed " + tag + " modifier"); iterator.remove(); } } } } ModifierManager(); void addNewAttributeModifier(Map<String, String> settings); void removeAttributeModifier(String target, String tag,
                                        Point position); void purge(String tag); Integer count(String tag); @Override void tick();  }
@Test public void testPurge() throws Exception { Map<String, String> settings = new HashMap<>(); settings.put("tag", "Tests"); settings.put("target", "Batman"); settings.put("location", position.toString()); Map<String, String> settings2 = new HashMap<>(); settings2.put("tag", "Robin"); settings2.put("target", "Batman"); settings2.put("location", position.toString()); manager.addNewAttributeModifier(settings); manager.addNewAttributeModifier(settings2); manager.purge("Tests"); Assert.assertTrue(manager.count("Tests") == 0); Assert.assertTrue(manager.count("all") == 1); manager.purge("all"); Assert.assertTrue(manager.count("all") == 0); }