@Test public void countScenariosOfSeverity_should_count_only_the_given_severity() { final Set<Run> runs = Collections.singleton(run() .withExecutedScenarios(new HashSet<>(Arrays.asList( passedScenario().withSeverity(""), failedScenario().withSeverity("some"))))); Severity someSeverity = new Severity().withCode("some"); ScenarioCountDTO counts = cut.countScenariosOfSeverity(runs, someSeverity); assertThat(counts.getTotal()).isEqualTo(1); assertThat(counts.getPassed()).isEqualTo(0); assertThat(counts.getFailed()).isEqualTo(1); }
ScenarioCountDTO countScenariosOfSeverity(Set<Run> runs, Severity severity) { ScenarioCountDTO counts = new ScenarioCountDTO(); for (Run run : runs) { for (ExecutedScenario executedScenario : run.getExecutedScenarios()) { if (Severity.ALL.equals(severity) || (StringUtils.isEmpty(executedScenario.getSeverity()) && severity.isDefaultOnMissing()) || severity.getCode().equals(executedScenario.getSeverity())) { countScenario(counts, executedScenario); } } } return counts; }
QualityService { ScenarioCountDTO countScenariosOfSeverity(Set<Run> runs, Severity severity) { ScenarioCountDTO counts = new ScenarioCountDTO(); for (Run run : runs) { for (ExecutedScenario executedScenario : run.getExecutedScenarios()) { if (Severity.ALL.equals(severity) || (StringUtils.isEmpty(executedScenario.getSeverity()) && severity.isDefaultOnMissing()) || severity.getCode().equals(executedScenario.getSeverity())) { countScenario(counts, executedScenario); } } } return counts; } }
QualityService { ScenarioCountDTO countScenariosOfSeverity(Set<Run> runs, Severity severity) { ScenarioCountDTO counts = new ScenarioCountDTO(); for (Run run : runs) { for (ExecutedScenario executedScenario : run.getExecutedScenarios()) { if (Severity.ALL.equals(severity) || (StringUtils.isEmpty(executedScenario.getSeverity()) && severity.isDefaultOnMissing()) || severity.getCode().equals(executedScenario.getSeverity())) { countScenario(counts, executedScenario); } } } return counts; }  }
QualityService { ScenarioCountDTO countScenariosOfSeverity(Set<Run> runs, Severity severity) { ScenarioCountDTO counts = new ScenarioCountDTO(); for (Run run : runs) { for (ExecutedScenario executedScenario : run.getExecutedScenarios()) { if (Severity.ALL.equals(severity) || (StringUtils.isEmpty(executedScenario.getSeverity()) && severity.isDefaultOnMissing()) || severity.getCode().equals(executedScenario.getSeverity())) { countScenario(counts, executedScenario); } } } return counts; }  void computeQuality(Execution execution); }
QualityService { ScenarioCountDTO countScenariosOfSeverity(Set<Run> runs, Severity severity) { ScenarioCountDTO counts = new ScenarioCountDTO(); for (Run run : runs) { for (ExecutedScenario executedScenario : run.getExecutedScenarios()) { if (Severity.ALL.equals(severity) || (StringUtils.isEmpty(executedScenario.getSeverity()) && severity.isDefaultOnMissing()) || severity.getCode().equals(executedScenario.getSeverity())) { countScenario(counts, executedScenario); } } } return counts; }  void computeQuality(Execution execution);  }