Search in sources :

Example 1 with ENUMERATION

use of org.kie.workbench.common.dmn.api.definition.model.ConstraintType.ENUMERATION in project kie-wb-common by kiegroup.

the class DataTypeConstraintTest method testOpenModal.

@Test
public void testOpenModal() {
    final DataTypeListItem listItem = mock(DataTypeListItem.class);
    final String constraint = "1,2,3";
    final String type = "string";
    final BiConsumer<String, ConstraintType> onShowConsumer = (s, c) -> {
    /* Nothing. */
    };
    doReturn(listItem).when(dataTypeConstraint).getListItem();
    doReturn(constraint).when(dataTypeConstraint).getValue();
    doReturn(onShowConsumer).when(dataTypeConstraint).getOnShowConsumer();
    when(listItem.getType()).thenReturn(type);
    dataTypeConstraint.openModal();
    constraintModal.load(type, constraint, ENUMERATION);
    constraintModal.show(onShowConsumer);
}
Also used : DataTypeListItem(org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItem) GwtMockitoTestRunner(com.google.gwtmockito.GwtMockitoTestRunner) ENUMERATION(org.kie.workbench.common.dmn.api.definition.model.ConstraintType.ENUMERATION) Mock(org.mockito.Mock) Assert.assertNotNull(org.junit.Assert.assertNotNull) ManagedInstance(org.jboss.errai.ioc.client.api.ManagedInstance) DataType(org.kie.workbench.common.dmn.client.editors.types.common.DataType) RunWith(org.junit.runner.RunWith) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Mockito.spy(org.mockito.Mockito.spy) DataTypeListItem(org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItem) Mockito.verify(org.mockito.Mockito.verify) Assert.assertSame(org.junit.Assert.assertSame) Assert.assertNull(org.junit.Assert.assertNull) HTMLElement(elemental2.dom.HTMLElement) Assert.assertFalse(org.junit.Assert.assertFalse) BiConsumer(java.util.function.BiConsumer) ConstraintType(org.kie.workbench.common.dmn.api.definition.model.ConstraintType) Mockito.doReturn(org.mockito.Mockito.doReturn) Assert.assertEquals(org.junit.Assert.assertEquals) Before(org.junit.Before) Mockito.mock(org.mockito.Mockito.mock) ConstraintType(org.kie.workbench.common.dmn.api.definition.model.ConstraintType) Test(org.junit.Test)

Aggregations

GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 HTMLElement (elemental2.dom.HTMLElement)1 BiConsumer (java.util.function.BiConsumer)1 ManagedInstance (org.jboss.errai.ioc.client.api.ManagedInstance)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertFalse (org.junit.Assert.assertFalse)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertNull (org.junit.Assert.assertNull)1 Assert.assertSame (org.junit.Assert.assertSame)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)1 ENUMERATION (org.kie.workbench.common.dmn.api.definition.model.ConstraintType.ENUMERATION)1 DataType (org.kie.workbench.common.dmn.client.editors.types.common.DataType)1 DataTypeListItem (org.kie.workbench.common.dmn.client.editors.types.listview.DataTypeListItem)1 Mock (org.mockito.Mock)1 Mockito.doReturn (org.mockito.Mockito.doReturn)1 Mockito.mock (org.mockito.Mockito.mock)1