@Override public void evaluateFor(Actor actor) { Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); do { try { consequenceThatMightTakeSomeTime.evaluateFor(actor); return; } catch (AssertionError assertionError) { caughtAssertionError = assertionError; } catch (RuntimeException runtimeException) { caughtRuntimeException = runtimeException; } pauseBeforeNextAttempt(); } while (stopwatch.lapTime() < timeout); throwAnyCaughtErrors(); }
private void generateReportsFor(Collection<ReportingTask> reportingTasks) throws IOException { stopwatch.start(); try { Reporter.generateReportsFor(reportingTasks); final List<Callable<Void>> partitions = Lists.newArrayList(); for (ReportingTask reportingTask : reportingTasks) { partitions.add(new ReportExecutor(reportingTask)); } final ExecutorService executorPool = Executors.newFixedThreadPool(NumberOfThreads.forIOOperations()); for (Future<Void> executedTask : executorPool.invokeAll(partitions)) { executedTask.get(); } } catch (Exception e) { LOGGER.error("Report generation failed", e); } LOGGER.debug("Test outcome reports generated in {} ms", stopwatch.stop()); }