### Question:
KnowledgeBasesPresenter extends Section<ProjectScreenModel> { KBaseModel newKBaseModel(final String knowledgeBaseName) { final KBaseModel kBaseModel = new KBaseModel(); kBaseModel.setName(knowledgeBaseName); kBaseModel.setDefault(knowledgeBaseListPresenter.getObjectsList().isEmpty()); return kBaseModel; } @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();  }### Answer:
@Test public void testNewKBaseModelEmptyMap() { doReturn(emptyList()).when(knowledgeBaseListPresenter).getObjectsList(); final KBaseModel kBaseModel = knowledgeBasesPresenter.newKBaseModel("Name"); Assert.assertEquals("Name", kBaseModel.getName()); Assert.assertEquals(true, kBaseModel.isDefault()); }
@Test public void testNewKBaseModelNonEmptyMap() { doReturn(singletonList(new KBaseModel())).when(knowledgeBaseListPresenter).getObjectsList(); final KBaseModel kBaseModel = knowledgeBasesPresenter.newKBaseModel("Name"); Assert.assertEquals("Name", kBaseModel.getName()); Assert.assertEquals(false, kBaseModel.isDefault()); }