use of org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter in project kie-wb-common by kiegroup.
the class ListPresenterTest method newPresenterForTest.
@Test
public void newPresenterForTest() {
final IncludedKnowledgeBaseItemPresenter p1 = spy(new IncludedKnowledgeBaseItemPresenter(null));
doReturn(p1).when(includedKnowledgeBaseItemPresenters).get();
listPresenter.setup(mock(HTMLElement.class), new ArrayList<>(), (o, p) -> {
assertEquals(new SingleValueItemObjectModel("foo"), o);
assertEquals(p1, p);
});
listPresenter.newPresenterFor(new SingleValueItemObjectModel("foo"));
verify(p1).setListPresenter(eq(listPresenter));
}
use of org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.includedknowledgebases.IncludedKnowledgeBaseItemPresenter in project kie-wb-common by kiegroup.
the class ListPresenterTest method testSetupWithPresenters.
@Test
public void testSetupWithPresenters() {
doNothing().when(listPresenter).addPresenter(any());
final IncludedKnowledgeBaseItemPresenter p1 = mock(IncludedKnowledgeBaseItemPresenter.class);
doReturn(new SingleValueItemObjectModel("foo")).when(p1).getObject();
final IncludedKnowledgeBaseItemPresenter p2 = mock(IncludedKnowledgeBaseItemPresenter.class);
doReturn(new SingleValueItemObjectModel("bar")).when(p2).getObject();
final List<IncludedKnowledgeBaseItemPresenter> presenters = Arrays.asList(p1, p2);
listPresenter.setupWithPresenters(mock(HTMLElement.class), presenters, (a, b) -> {
});
assertEquals(presenters, listPresenter.getPresenters());
assertEquals(Arrays.asList(new SingleValueItemObjectModel("foo"), new SingleValueItemObjectModel("bar")), listPresenter.getObjectsList());
verify(listPresenter, times(2)).addPresenter(any());
}
Aggregations