@Test void shouldCreateChartFromSimpleReport() { SeverityPieChart severityPieChart = new SeverityPieChart(); PieChartModel pieChartModel = severityPieChart.create(createReport(1, 1, 1, 1)); List<PieData> data = pieChartModel.getData(); assertThat(data.get(0)).isEqualTo(new PieData("Error", 1)); assertThat(data.get(1)).isEqualTo(new PieData("High", 1)); assertThat(data.get(2)).isEqualTo(new PieData("Normal", 1)); assertThat(data.get(3)).isEqualTo(new PieData("Low", 1)); }
public PieChartModel create(final Report report) { PieChartModel model = new PieChartModel(Messages.Severities_Name()); ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues(); for (Severity severity : predefinedSeverities) { int total = report.getSizeOf(severity); if (total > 0 || !severity.equals(Severity.ERROR)) { model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total), SeverityPalette.getColor(severity)); } } return model; }
SeverityPieChart { public PieChartModel create(final Report report) { PieChartModel model = new PieChartModel(Messages.Severities_Name()); ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues(); for (Severity severity : predefinedSeverities) { int total = report.getSizeOf(severity); if (total > 0 || !severity.equals(Severity.ERROR)) { model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total), SeverityPalette.getColor(severity)); } } return model; } }
SeverityPieChart { public PieChartModel create(final Report report) { PieChartModel model = new PieChartModel(Messages.Severities_Name()); ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues(); for (Severity severity : predefinedSeverities) { int total = report.getSizeOf(severity); if (total > 0 || !severity.equals(Severity.ERROR)) { model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total), SeverityPalette.getColor(severity)); } } return model; }  }
SeverityPieChart { public PieChartModel create(final Report report) { PieChartModel model = new PieChartModel(Messages.Severities_Name()); ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues(); for (Severity severity : predefinedSeverities) { int total = report.getSizeOf(severity); if (total > 0 || !severity.equals(Severity.ERROR)) { model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total), SeverityPalette.getColor(severity)); } } return model; }  PieChartModel create(final Report report); }
SeverityPieChart { public PieChartModel create(final Report report) { PieChartModel model = new PieChartModel(Messages.Severities_Name()); ImmutableSet<Severity> predefinedSeverities = Severity.getPredefinedValues(); for (Severity severity : predefinedSeverities) { int total = report.getSizeOf(severity); if (total > 0 || !severity.equals(Severity.ERROR)) { model.add(new PieData(LocalizedSeverity.getLocalizedString(severity), total), SeverityPalette.getColor(severity)); } } return model; }  PieChartModel create(final Report report);  }