protected final function assertThatExecutionIsNotDeferred(callable $collectionOperation)
{
$exception = new CustomException();
$thowingFunction = function () use($exception) {
throw $exception;
};
$thrown = false;
try {
$collectionOperation($thowingFunction);
} catch (CustomException $thrownException) {
$thrown = true;
$this->assertSame($exception, $thrownException);
}
$this->assertTrue($thrown, 'Should have thrown an exeption');
}