private final Long bugs;
private final Long vulnerabilities;
private final Long securityHotspots;
- private final Double technicalDebt;
- private final Double developmentCost;
+ private final Long technicalDebt;
+ private final Long developmentCost;
ProjectStatistics(Builder builder) {
this.projectUuid = builder.projectUuid;
return Optional.ofNullable(securityHotspots);
}
- public Optional<Double> getTechnicalDebt() {
+ public Optional<Long> getTechnicalDebt() {
return Optional.ofNullable(technicalDebt);
}
- public Optional<Double> getDevelopmentCost() {
+ public Optional<Long> getDevelopmentCost() {
return Optional.ofNullable(developmentCost);
}
private Long bugs;
private Long vulnerabilities;
private Long securityHotspots;
- private Double technicalDebt;
- private Double developmentCost;
+ private Long technicalDebt;
+ private Long developmentCost;
public Builder setProjectUuid(String projectUuid) {
this.projectUuid = projectUuid;
}
public Builder setTechnicalDebt(@Nullable Number technicalDebt) {
- this.technicalDebt = technicalDebt != null ? technicalDebt.doubleValue() : null;
+ this.technicalDebt = technicalDebt != null ? technicalDebt.longValue() : null;
return this;
}
public Builder setDevelopmentCost(@Nullable Number developmentCost) {
- this.developmentCost = developmentCost != null ? developmentCost.doubleValue() : null;
+ this.developmentCost = developmentCost != null ? developmentCost.longValue() : null;
return this;
}
}
@Test
- public void writes_all_projects_stats_with_analyzed_languages() {
+ public void writeTelemetryData_whenAnalyzedLanguages_shouldwriteAllProjectsStats() {
TelemetryData data = telemetryBuilder()
.setProjectStatistics(attachProjectStatsWithMetrics())
.build();
"bugs": 2,
"vulnerabilities": 3,
"securityHotspots": 4,
- "technicalDebt": 60.0,
- "developmentCost": 30.0
+ "technicalDebt": 60,
+ "developmentCost": 30
},
{
"projectUuid": "uuid-1",
"bugs": 4,
"vulnerabilities": 6,
"securityHotspots": 8,
- "technicalDebt": 120.0,
- "developmentCost": 60.0
+ "technicalDebt": 120,
+ "developmentCost": 60
},
{
"projectUuid": "uuid-2",
"bugs": 6,
"vulnerabilities": 9,
"securityHotspots": 12,
- "technicalDebt": 180.0,
- "developmentCost": 90.0
+ "technicalDebt": 180,
+ "developmentCost": 90
}
]
}
TelemetryData.ProjectStatistics::getBugs, TelemetryData.ProjectStatistics::getVulnerabilities, TelemetryData.ProjectStatistics::getSecurityHotspots,
TelemetryData.ProjectStatistics::getDevelopmentCost, TelemetryData.ProjectStatistics::getTechnicalDebt)
.containsExactlyInAnyOrder(
- tuple(1L, 0L, qualityGate1.getUuid(), "scm-1", "ci-1", "azure_devops_cloud", Optional.of(1L), Optional.of(1L), Optional.of(1L), Optional.of(50.0), Optional.of(5.0)),
+ tuple(1L, 0L, qualityGate1.getUuid(), "scm-1", "ci-1", "azure_devops_cloud", Optional.of(1L), Optional.of(1L), Optional.of(1L), Optional.of(50L), Optional.of(5L)),
tuple(1L, 0L, builtInDefaultQualityGate.getUuid(), "scm-2", "ci-2", "github_cloud", Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty()));
assertThat(data.getQualityGates())
.extracting(TelemetryData.QualityGate::uuid, TelemetryData.QualityGate::isCaycCompliant)