public void waitForCompletionTimesOut() throws InterruptedException {
context.checking(new Expectations() {{
oneOf(executor).shutdown();
oneOf(executor).awaitTermination(with(any(Long.class)), with(any(TimeUnit.class))); will(returnValue(false));
}});
OutputStream stream = new StubOutputStream();
new ConcurrentScheduler(executor, stream).finished();
assertThat(stream.toString(), containsString("scheduler shutdown timed out before tests completed, you may have executors hanging around..."));
}