ChecklistPlanner { private void selectChecklists(final List<Checklist> constructed) { for (String activeId : activeChecklistIds) { if (activeId.isEmpty()) { continue; } List<Checklist> selected = constructed.stream() .filter(checklist -> isChecklistSelected(activeId, checklist)).collect(Collectors.toList()); checklists.addAll(selected); constructed.removeAll(selected); } inactiveChecklists.addAll(constructed); } ChecklistPlanner(final List<String> activeChecklistIds); void provideChecklists(final List<Checklist> constructed); void discoverChecklists(); void discoverChecklists(final ClassLoader classLoader); void discoverChecklists(final List<File> files); List<InitStage> getInitStages(); List<CheckSpec> getEffectiveCheckSpecs(final List<CheckSpec> checkOverrides); static List<Checklist> constructChecklists(final Map<URL, List<JsonObject>> parsed); static Map<URL, List<JsonObject>> parseChecklists(final URL manifestUrl); static Map<URL, List<JsonObject>> parseChecklists(final ClassLoader classLoader); static Map<URL, List<JsonObject>> parseChecklists(final List<File> files); static final String OAKPAL_CHECKLIST; static final String OAKPAL_MODULENAME; static final String BUNDLE_SYMBOLICNAME; static final String AUTOMATIC_MODULE_NAME; }
@Test public void testSelectChecklists() throws Exception { List<Checklist> checklists = this.constructIndivChecklists(); ChecklistPlanner planner = new ChecklistPlanner(Arrays.asList(CKL_NAME_ALPHA, "")); planner.provideChecklists(checklists); List<Checklist> allChecklists = planner.getAllChecklists().collect(Collectors.toList()); assertTrue("all has alpha/alpha checklist", allChecklists.stream().anyMatch(alphaFilter)); assertTrue("all has bravo/bravo-1 checklist", allChecklists.stream().anyMatch(bravo1Filter)); assertTrue("all has bravo/bravo-2 checklist", allChecklists.stream().anyMatch(bravo2Filter)); assertTrue("all has charlie/charlie checklist", allChecklists.stream().anyMatch(charlieFilter)); List<Checklist> selectedChecklists = planner.getSelectedChecklists().collect(Collectors.toList()); assertTrue("selected alpha/alpha checklist", selectedChecklists.stream().anyMatch(alphaFilter)); assertFalse("not selected bravo/bravo-1 checklist", selectedChecklists.stream().anyMatch(bravo1Filter)); assertFalse("not selected bravo/bravo-2 checklist", selectedChecklists.stream().anyMatch(bravo2Filter)); assertFalse("not selected charlie/charlie checklist", selectedChecklists.stream().anyMatch(charlieFilter)); }