CompilationLog (final boolean errorsExpected, final Consumer<? super CompileStatusNotification> action) { CompilationLog log = compile(action); if (errorsExpected && log.myErrors.length == 0) { Assert.fail("compilation finished without errors"); } else if (!errorsExpected && log.myErrors.length > 0) { Assert.fail("compilation finished with errors: " + Arrays.toString(log.myErrors)); } return log; }