private void assert12StandardChecks(RuntimeException e, boolean isPropagated) { String collapseText = Exceptions.collapseText(e); log.info("Exception collapsing got: "+collapseText+" ("+e+")"); assertContains(e, "test1"); assertContains(e, "test2"); if (isPropagated) assertContains(e, "2 errors, including"); else assertContains(e, "2 errors including"); assertNotContains(e, "IllegalState"); assertNotContains(e, "CompoundException"); Assert.assertFalse(collapseText.contains("Propagated"), "should NOT have had Propagated: "+collapseText); if (isPropagated) Assert.assertTrue(e.toString().contains("Propagate"), "SHOULD have had Propagated: "+e); else Assert.assertFalse(e.toString().contains("Propagate"), "should NOT have had Propagated: "+e); }
@Test public void test12CollapsePropagatedCompoundConcMod() throws Exception { RuntimeException e = new PropagatedRuntimeException("test1", new ExecutionException(Exceptions.create(MutableSet.of(new ConcurrentModificationException("test2"), new ConcurrentModificationException("test3"))))); assert12StandardChecks(e, true); assertContains(e, "ConcurrentModification"); }
@Test public void test12CollapsePropagatedExecutionCompoundBoring() throws Exception { RuntimeException e = new PropagatedRuntimeException("test1", new ExecutionException(Exceptions.create(MutableSet.of(new IllegalStateException("test2"), new IllegalStateException("test3"))))); assert12StandardChecks(e, true); }
@Test public void test12CollapseCompound() throws Exception { RuntimeException e = Exceptions.create("test1", MutableSet.of(new IllegalStateException("test2"), new IllegalStateException("test3"))); assert12StandardChecks(e, false); }