CoverageReportPresenter extends AbstractSubDockPresenter<CoverageReportView> implements CoverageReportView.Presenter { protected void populateList(Map<String, Integer> outputCounter) { coverageElementPresenter.clear(); List<String> elements = new ArrayList<>(outputCounter.keySet()); elements.sort(Comparator.naturalOrder()); for (String element : elements) { coverageElementPresenter.addElementView(element, outputCounter.get(element) + ""); } } CoverageReportPresenter(); @Inject  CoverageReportPresenter(CoverageReportView view,
                                   CoverageReportDonutPresenter coverageReportDonutPresenter,
                                   CoverageElementPresenter coverageElementPresenter,
                                   CoverageScenarioListPresenter coverageScenarioListPresenter); @PostConstruct void init(); @Override void reset(); @Override void populateCoverageReport(Type type, SimulationRunMetadata simulationRunMetadata); @Override void onDownloadReportButtonClicked(); @Override void setDownloadReportCommand(Command downloadReportCommand); static final int DEFAULT_PREFERRED_WIDTH; static final String IDENTIFIER; }
@Test public void populateList() { presenterSpy.populateList(outputCounterLocal); verify(coverageElementPresenterMock, times(1)).clear(); verify(coverageElementPresenterMock, times(outputCounterLocal.size())) .addElementView(descriptionCaptor.capture(), valueCaptor.capture()); List<String> descriptions = descriptionCaptor.getAllValues(); assertEquals(2, descriptions.size()); assertEquals("d1", descriptions.get(0)); assertEquals("d2", descriptions.get(1)); List<String> values = valueCaptor.getAllValues(); assertEquals(2, values.size()); assertEquals("1", values.get(0)); assertEquals("2", values.get(1)); }