CoverageReportPresenter extends AbstractSubDockPresenter<CoverageReportView> implements CoverageReportView.Presenter { protected void populateScenarioList(Map<ScenarioWithIndex, Map<String, Integer>> scenarioCounter, Type type) { coverageScenarioListPresenter.clear(); List<ScenarioWithIndex> scenarioIndexes = new ArrayList<>(scenarioCounter.keySet()); scenarioIndexes.sort(Comparator.comparingInt(ScenarioWithIndex::getIndex)); for (ScenarioWithIndex scenarioWithIndex : scenarioIndexes) { coverageScenarioListPresenter.addScesimDataGroup(scenarioWithIndex, scenarioCounter.get(scenarioWithIndex), type); } } 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 populateScenarioList() { presenterSpy.populateScenarioList(scenarioCounterLocal, Type.DMN); verify(coverageScenarioListPresenterMock, times(1)).clear(); verify(coverageScenarioListPresenterMock, times(scenarioCounterLocal.size())) .addScesimDataGroup(scenarioWithIndexCaptor.capture(), resultCounterCaptor.capture(), eq(Type.DMN)); List<ScenarioWithIndex> scenarios = scenarioWithIndexCaptor.getAllValues(); assertEquals(scenarioCounterLocal.size(), scenarios.size()); assertEquals(1, scenarios.get(0).getIndex()); assertEquals(2, scenarios.get(1).getIndex()); List<Map<String, Integer>> resultCounters = resultCounterCaptor.getAllValues(); assertEquals(scenarioCounterLocal.size(), resultCounters.size()); assertTrue(resultCounters.get(0).keySet().contains("d1")); assertEquals(1, (int) resultCounters.get(0).get("d1")); assertTrue(resultCounters.get(0).keySet().contains("d2")); assertEquals(1, (int) resultCounters.get(0).get("d2")); assertTrue(resultCounters.get(1).keySet().contains("d2")); assertEquals(1, (int) resultCounters.get(1).get("d2")); }