NewVersusFixedPieChart { public PieChartModel create(final Report newIssues, final Report outstandingIssues, final Report fixedIssues) { PieChartModel model = new PieChartModel(Messages.NewVersusFixed_Name()); model.add(new PieData(Messages.New_Warnings_Short(), newIssues.size()), Palette.RED); model.add(new PieData(Messages.Outstanding_Warnings_Short(), outstandingIssues.size()), Palette.YELLOW); model.add(new PieData(Messages.Fixed_Warnings_Short(), fixedIssues.size()), Palette.GREEN); return model; }  PieChartModel create(final Report newIssues, final Report outstandingIssues, final Report fixedIssues);  }
@Test void testCreate() { int[] sizes = {2, 3, 4}; String[] names = {New_Warnings_Short(), Outstanding_Warnings_Short(), Fixed_Warnings_Short()}; Palette[] colors = {Palette.RED, Palette.YELLOW, Palette.GREEN}; NewVersusFixedPieChart chart = new NewVersusFixedPieChart(); PieChartModel model = chart.create(createReportStub(sizes[0]), createReportStub(sizes[1]), createReportStub(sizes[2])); List<PieData> data = model.getData(); assertThat(model.getData().size()).isEqualTo(3); assertThat(model.getColors().size()).isEqualTo(3); for (int i = 0; i < 3; i++) { assertThat(data.get(i).getName()).isEqualTo(names[i]); assertThat(data.get(i).getValue()).isEqualTo(sizes[i]); assertThat(model.getColors().get(i)).isEqualTo(colors[i].getNormal()); } }