public void testDeleteThenNextThrowsCME() { TripleBunch b = getBunch(); b.add(Triple.create("a P b")); b.add(Triple.create("c Q d")); Iterator it = b.iterator(); it.next(); b.remove(Triple.create("a P b")); try { it.next(); fail("should have thrown ConcurrentModificationException"); } catch (ConcurrentModificationException e) { pass(); } }
public void testAddDuringAppThrowsCME() { final TripleBunch b = getBunch(); b.add(Triple.create("a P b")); b.add(Triple.create("c Q d")); StageElement se = new StageElement() { public void run(Domain current) { b.add(Triple.create("S P O")); } }; try { b.app(new Domain(0), se, mob); fail(" should throw CME"); } catch (ConcurrentModificationException e) { pass(); } }