public void checkTestResults() { Optional<TestOutcomes> outcomes = loadOutcomes(); if (outcomes.isPresent()) { checkTestResultsIn(outcomes.get()); } else { handleMissingTestResults(); } }
protected ResultChecker getResultChecker() { return new ResultChecker(outputDirectory); }
public ResultChecker(File outputDirectory, String tags) { this.outputDirectory = outputDirectory; this.tags = tagsFrom(tags); }
public TestResult checkTestResults() { Optional<TestOutcomes> outcomes = loadOutcomes(); if (outcomes.isPresent()) { logOutcomesFrom(outcomes.get()); return outcomes.get().getResult(); } return TestResult.UNDEFINED; }
private void checkTestResultsIn(TestOutcomes testOutcomes) { switch (testOutcomes.getResult()) { case ERROR: throw new TestOutcomesError(testOutcomeSummary(testOutcomes)); case FAILURE: throw new TestOutcomesFailures(testOutcomeSummary(testOutcomes)); } }
public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Checking Thucydides test results"); getResultChecker().checkTestResults(); } }
private Optional<TestOutcomes> loadOutcomes() { TestOutcomes outcomes = null; try { outcomes = TestOutcomeLoader.loadTestOutcomes().inFormat(OutcomeFormat.JSON).from(outputDirectory); if (outcomes.getTotal() == 0) { outcomes = TestOutcomeLoader.loadTestOutcomes().inFormat(OutcomeFormat.XML).from(outputDirectory); } if (thereAreTagsIn(tags)) { outcomes = outcomes.withTags(tags); } } catch (IOException e) { e.printStackTrace(); } return Optional.ofNullable(outcomes); }
private void checkTestResultsIn(TestOutcomes testOutcomes) { switch (testOutcomes.getResult()) { case ERROR: throw new TestOutcomesError(testOutcomeSummary(testOutcomes)); case FAILURE: throw new TestOutcomesFailures(testOutcomeSummary(testOutcomes)); } }
public void checkTestResults() { Optional<TestOutcomes> outcomes = loadOutcomes(); if (outcomes.isPresent()) { checkTestResultsIn(outcomes.get()); } else { handleMissingTestResults(); } }