@Test public void testSetup() { final ProjectScreenModel model = mock(ProjectScreenModel.class); when(model.getKModule()).thenReturn(spy(new KModuleModel())); when(model.getKModule().getKBases()).thenReturn(emptyMap()); knowledgeBasesPresenter.setup(model).catch_(i -> { Assert.fail("Promise should've been resolved!"); return promises.resolve(); }); verify(view).init(eq(knowledgeBasesPresenter)); verify(knowledgeBaseListPresenter).setup(any(), any(), any()); }
@Override public Promise<Void> setup(final ProjectScreenModel model) { this.kModuleModel = model.getKModule(); view.init(this); knowledgeBaseListPresenter.setup( view.getKnowledgeBasesTable(), model.getKModule().getKBases().values().stream().sorted(comparing(KBaseModel::getName)).collect(Collectors.toList()), (kbase, presenter) -> presenter.setup(kbase, this)); return promises.resolve(); }
KnowledgeBasesPresenter extends Section<ProjectScreenModel> { @Override public Promise<Void> setup(final ProjectScreenModel model) { this.kModuleModel = model.getKModule(); view.init(this); knowledgeBaseListPresenter.setup( view.getKnowledgeBasesTable(), model.getKModule().getKBases().values().stream().sorted(comparing(KBaseModel::getName)).collect(Collectors.toList()), (kbase, presenter) -> presenter.setup(kbase, this)); return promises.resolve(); } }
KnowledgeBasesPresenter extends Section<ProjectScreenModel> { @Override public Promise<Void> setup(final ProjectScreenModel model) { this.kModuleModel = model.getKModule(); view.init(this); knowledgeBaseListPresenter.setup( view.getKnowledgeBasesTable(), model.getKModule().getKBases().values().stream().sorted(comparing(KBaseModel::getName)).collect(Collectors.toList()), (kbase, presenter) -> presenter.setup(kbase, this)); return promises.resolve(); } @Inject  KnowledgeBasesPresenter(final View view,
                                   final Event<SettingsSectionChange<ProjectScreenModel>> settingsSectionChangeEvent,
                                   final Promises promises,
                                   final MenuItem<ProjectScreenModel> menuItem,
                                   final KnowledgeBaseListPresenter knowledgeBaseListPresenter); }
KnowledgeBasesPresenter extends Section<ProjectScreenModel> { @Override public Promise<Void> setup(final ProjectScreenModel model) { this.kModuleModel = model.getKModule(); view.init(this); knowledgeBaseListPresenter.setup( view.getKnowledgeBasesTable(), model.getKModule().getKBases().values().stream().sorted(comparing(KBaseModel::getName)).collect(Collectors.toList()), (kbase, presenter) -> presenter.setup(kbase, this)); return promises.resolve(); } @Inject  KnowledgeBasesPresenter(final View view,
                                   final Event<SettingsSectionChange<ProjectScreenModel>> settingsSectionChangeEvent,
                                   final Promises promises,
                                   final MenuItem<ProjectScreenModel> menuItem,
                                   final KnowledgeBaseListPresenter knowledgeBaseListPresenter); @Override Promise<Void> setup(final ProjectScreenModel model); @Override Promise<Void> save(final String comment,
                              final Supplier<Promise<Void>> chain); @Override SectionView<?> getView(); @Override int currentHashCode(); }
KnowledgeBasesPresenter extends Section<ProjectScreenModel> { @Override public Promise<Void> setup(final ProjectScreenModel model) { this.kModuleModel = model.getKModule(); view.init(this); knowledgeBaseListPresenter.setup( view.getKnowledgeBasesTable(), model.getKModule().getKBases().values().stream().sorted(comparing(KBaseModel::getName)).collect(Collectors.toList()), (kbase, presenter) -> presenter.setup(kbase, this)); return promises.resolve(); } @Inject  KnowledgeBasesPresenter(final View view,
                                   final Event<SettingsSectionChange<ProjectScreenModel>> settingsSectionChangeEvent,
                                   final Promises promises,
                                   final MenuItem<ProjectScreenModel> menuItem,
                                   final KnowledgeBaseListPresenter knowledgeBaseListPresenter); @Override Promise<Void> setup(final ProjectScreenModel model); @Override Promise<Void> save(final String comment,
                              final Supplier<Promise<Void>> chain); @Override SectionView<?> getView(); @Override int currentHashCode();  }