### Question:
ExecutionHistoryService { void addScenarioForSeverity(ExecutedScenarioWithErrorAndProblemJoin executedScenarioJoin, Map<String, ExecutedScenarioHandlingCountsDTO> qualitiesPerSeverity, String severityCode) { ExecutedScenarioHandlingCountsDTO executedScenarioHandlingCounts = qualitiesPerSeverity .computeIfAbsent(severityCode, k -> new ExecutedScenarioHandlingCountsDTO()); incrementCountsByHandling(executedScenarioJoin, executedScenarioHandlingCounts); }  List<ExecutionHistoryPointDTO> getLatestExecutionHistories(long projectId); ExecutionHistoryPointDTO getExecution(long projectId, long id); ExecutedScenarioHandlingCountsDTO getExecutedScenarioHandlingCountsFor(Execution execution);  }### Answer:
@Test public void addScenarioForSeverity_should_increment_total_and_passed_for_succeed_scenario() { ExecutedScenarioWithErrorAndProblemJoin executedScenarioJoin = new ExecutedScenarioWithErrorAndProblemJoin(); Map<String, ExecutedScenarioHandlingCountsDTO> qualitiesPerSeverity = new HashMap<>(); cut.addScenarioForSeverity(executedScenarioJoin, qualitiesPerSeverity, "medium"); assertThat(qualitiesPerSeverity.size()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getTotal()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getPassed()).isEqualTo(1); }
@Test public void addScenarioForSeverity_should_increment_total_and_unhandled_for_failed_scenario_without_problem() { ExecutedScenarioWithErrorAndProblemJoin executedScenarioJoin = new ExecutedScenarioWithErrorAndProblemJoin() .withUnhandledCount(1); Map<String, ExecutedScenarioHandlingCountsDTO> qualitiesPerSeverity = new HashMap<>(); cut.addScenarioForSeverity(executedScenarioJoin, qualitiesPerSeverity, "medium"); assertThat(qualitiesPerSeverity.size()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getTotal()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getUnhandled()).isEqualTo(1); }
@Test public void addScenarioForSeverity_should_increment_total_and_handled_for_failed_scenario_with_problem() { ExecutedScenarioWithErrorAndProblemJoin executedScenarioJoin = new ExecutedScenarioWithErrorAndProblemJoin() .withUnhandledCount(2) .withHandledCount(1); Map<String, ExecutedScenarioHandlingCountsDTO> qualitiesPerSeverity = new HashMap<>(); cut.addScenarioForSeverity(executedScenarioJoin, qualitiesPerSeverity, "medium"); assertThat(qualitiesPerSeverity.size()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getTotal()).isEqualTo(1); assertThat(qualitiesPerSeverity.get("medium").getHandled()).isEqualTo(1); }