Throwing { public static void call(final Runnable a, final Runnable b) { RuntimeException inner = null; try { a.run(); } catch (final RuntimeException e) { inner = e; } try { b.run(); } catch (final RuntimeException e) { if (inner != null) { e.addSuppressed(inner); } throw e; } if (inner != null) { throw inner; } }  static void call(final Runnable a, final Runnable b);  }
@Test public void testCall() throws Exception { thrown.expect(Exception.class); thrown.expectMessage("b"); Throwing.call(() -> { throw new RuntimeException("a"); }, () -> { throw new RuntimeException("b"); }); }
@Test public void testRunOnce() throws Exception { thrown.expect(Exception.class); thrown.expectMessage("a"); try { Throwing.call(() -> { throw new RuntimeException("a"); }, runnable); } catch (final Exception e) { verify(runnable).run(); throw e; } fail("Should not be reached"); }