@Test public void computeQualityOfSeverity_should_map_severity_to_a_dto() { Execution execution = new Execution(); Severity someSeverity = Severity.ALL; SeverityDTO someSeverityDto = new SeverityDTO(); doReturn(someSeverityDto).when(severityMapper).toDto(someSeverity); QualitySeverityDTO quality = cut.computeQualityOfSeverity(execution, someSeverity, null); assertThat(quality.getSeverity()).isSameAs(someSeverityDto); }
QualitySeverityDTO computeQualityOfSeverity(Execution execution, Severity severity, QualityThreshold threshold) { ScenarioCountDTO scenarioCounts = countScenariosOfSeverity(getRunsToIncludeInQuality(execution), severity); int percent = getQualityPercentage(scenarioCounts); QualityStatus severityQualityStatus = (threshold == null ? null : threshold.toStatus(percent)); QualitySeverityDTO qualitySeverity = new QualitySeverityDTO(); qualitySeverity.setSeverity(severityMapper.toDto(severity)); qualitySeverity.setScenarioCounts(scenarioCounts); qualitySeverity.setPercent(percent); qualitySeverity.setStatus(severityQualityStatus); return qualitySeverity; }
QualityService { QualitySeverityDTO computeQualityOfSeverity(Execution execution, Severity severity, QualityThreshold threshold) { ScenarioCountDTO scenarioCounts = countScenariosOfSeverity(getRunsToIncludeInQuality(execution), severity); int percent = getQualityPercentage(scenarioCounts); QualityStatus severityQualityStatus = (threshold == null ? null : threshold.toStatus(percent)); QualitySeverityDTO qualitySeverity = new QualitySeverityDTO(); qualitySeverity.setSeverity(severityMapper.toDto(severity)); qualitySeverity.setScenarioCounts(scenarioCounts); qualitySeverity.setPercent(percent); qualitySeverity.setStatus(severityQualityStatus); return qualitySeverity; } }
QualityService { QualitySeverityDTO computeQualityOfSeverity(Execution execution, Severity severity, QualityThreshold threshold) { ScenarioCountDTO scenarioCounts = countScenariosOfSeverity(getRunsToIncludeInQuality(execution), severity); int percent = getQualityPercentage(scenarioCounts); QualityStatus severityQualityStatus = (threshold == null ? null : threshold.toStatus(percent)); QualitySeverityDTO qualitySeverity = new QualitySeverityDTO(); qualitySeverity.setSeverity(severityMapper.toDto(severity)); qualitySeverity.setScenarioCounts(scenarioCounts); qualitySeverity.setPercent(percent); qualitySeverity.setStatus(severityQualityStatus); return qualitySeverity; }  }
QualityService { QualitySeverityDTO computeQualityOfSeverity(Execution execution, Severity severity, QualityThreshold threshold) { ScenarioCountDTO scenarioCounts = countScenariosOfSeverity(getRunsToIncludeInQuality(execution), severity); int percent = getQualityPercentage(scenarioCounts); QualityStatus severityQualityStatus = (threshold == null ? null : threshold.toStatus(percent)); QualitySeverityDTO qualitySeverity = new QualitySeverityDTO(); qualitySeverity.setSeverity(severityMapper.toDto(severity)); qualitySeverity.setScenarioCounts(scenarioCounts); qualitySeverity.setPercent(percent); qualitySeverity.setStatus(severityQualityStatus); return qualitySeverity; }  void computeQuality(Execution execution); }
QualityService { QualitySeverityDTO computeQualityOfSeverity(Execution execution, Severity severity, QualityThreshold threshold) { ScenarioCountDTO scenarioCounts = countScenariosOfSeverity(getRunsToIncludeInQuality(execution), severity); int percent = getQualityPercentage(scenarioCounts); QualityStatus severityQualityStatus = (threshold == null ? null : threshold.toStatus(percent)); QualitySeverityDTO qualitySeverity = new QualitySeverityDTO(); qualitySeverity.setSeverity(severityMapper.toDto(severity)); qualitySeverity.setScenarioCounts(scenarioCounts); qualitySeverity.setPercent(percent); qualitySeverity.setStatus(severityQualityStatus); return qualitySeverity; }  void computeQuality(Execution execution);  }