use of org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel in project kie-wb-common by kiegroup.
the class IncludedKnowledgeBaseItemPresenterTest method testSetup.
@Test
public void testSetup() {
includedKnowledgeBaseItemPresenter.setup(new SingleValueItemObjectModel("Name"), mock(KnowledgeBaseItemPresenter.class));
verify(view).init(eq(includedKnowledgeBaseItemPresenter));
verify(view).setName(eq("Name"));
}
use of org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel in project kie-wb-common by kiegroup.
the class PackageItemPresenterTest method testSetup.
@Test
public void testSetup() {
packageItemPresenter.setup(new SingleValueItemObjectModel("Name"), mock(KnowledgeBaseItemPresenter.class));
verify(view).init(eq(packageItemPresenter));
verify(view).setName(eq("Name"));
}
use of org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel 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.services.shared.kmodule.SingleValueItemObjectModel in project kie-wb-common by kiegroup.
the class ListPresenterTest method addTest.
@Test
public void addTest() {
doNothing().when(listPresenter).addToListElement(any());
final List<SingleValueItemObjectModel> objs = new ArrayList<SingleValueItemObjectModel>();
objs.add(new SingleValueItemObjectModel("foo"));
objs.add(new SingleValueItemObjectModel("bar"));
listPresenter.setup(mock(HTMLElement.class), objs, (a, b) -> {
});
listPresenter.add(new SingleValueItemObjectModel("dee"));
verify(listPresenter).addToListElement(eq(new SingleValueItemObjectModel("dee")));
assertEquals(Arrays.asList(new SingleValueItemObjectModel("foo"), new SingleValueItemObjectModel("bar"), new SingleValueItemObjectModel("dee")), listPresenter.getObjectsList());
}
use of org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel 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