public static void runTestAndExpect( final Iterable4 tests, int expFailures, boolean checkException) { final TestResult result = new TestResult(); new TestRunner(tests).run(result); if (expFailures != result.failures().size()) { Assert.fail(result.failures().toString()); } if (checkException) { for (Iterator4 iter = result.failures().iterator(); iter.moveNext(); ) { TestFailure failure = (TestFailure) iter.current(); Assert.areEqual(EXCEPTION, failure.reason()); } } }
private void sendAll(final Iterable4 messages, final MessageSender sender) { final Iterator4 iterator = messages.iterator(); while (iterator.moveNext()) { sender.send(iterator.current()); } }