### Question:
KnowledgeSessionsModal extends Elemental2Modal<KnowledgeSessionsModal.View> { KSessionModel newKSessionModel() { final KSessionModel kSessionModel = new KSessionModel(); kSessionModel.setName(""); kSessionModel.setDefault(knowledgeBasesListPresenter.getObjectsList().isEmpty()); return kSessionModel; } @Inject  KnowledgeSessionsModal(final View view,
                                  final KnowledgeBasesListPresenter knowledgeBasesListPresenter); void setup(final KnowledgeBaseItemPresenter parentPresenter); @Override void setWidth(final String width); KBaseModel getObject(); void add(); void signalKnowledgeBaseAddedOrRemoved(); void fireChangeEvent(); void done();  }### Answer:
@Test public void testNewKSessionModelEmptyList() { doReturn(emptyList()).when(knowledgeBasesListPresenter).getObjectsList(); final KSessionModel kSessionModel = knowledgeSessionsModal.newKSessionModel(); Assert.assertEquals("", kSessionModel.getName()); Assert.assertTrue(kSessionModel.isDefault()); }
@Test public void testNewKSessionModelNonEmptyList() { doReturn(singletonList(mock(KSessionModel.class))).when(knowledgeBasesListPresenter).getObjectsList(); final KSessionModel kSessionModel = knowledgeSessionsModal.newKSessionModel(); Assert.assertEquals("", kSessionModel.getName()); Assert.assertEquals(false, kSessionModel.isDefault()); }