@Override public void start() { Context context = new Context(); definitions.forEach(definition -> definition.define(context)); Context coreContext = new Context(); corePageDefinitions.stream() .map(CorePageDefinition::getPageDefinition) .forEach(definition -> definition.define(coreContext)); pages = Stream.concat( context.getPages().stream().peek(this::checkPluginExists), coreContext.getPages().stream().peek(this::checkCoreExtensionExists)) .sorted(comparing(Page::getKey)) .collect(toList()); }
@Test public void test_page_definition() { PageDefinition underTest = context -> context.addPage(Page.builder("my_plugin/my_page").setName("My Page").build()); Context context = new Context(); underTest.define(context); assertThat(context.getPages()).extracting(Page::getKey).contains("my_plugin/my_page"); }
@Override public void start() { Context context = new Context(); definitions.forEach(definition -> definition.define(context)); Context coreContext = new Context(); corePageDefinitions.stream() .map(CorePageDefinition::getPageDefinition) .forEach(definition -> definition.define(coreContext)); pages = Stream.concat( context.getPages().stream().peek(this::checkPluginExists), coreContext.getPages().stream().peek(this::checkCoreExtensionExists)) .sorted(comparing(Page::getKey)) .collect(toList()); }