Search in sources :

Example 6 with HasName

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

the class EditableTextHeaderMetaDataTest method checkSetTitleWithoutHasName.

@Test
public void checkSetTitleWithoutHasName() {
    final HasName mockHasName = new MockHasName("name");
    hasName = Optional.empty();
    header.setTitle("new-name");
    assertEquals("name", mockHasName.getName().getValue());
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) Test(org.junit.Test)

Example 7 with HasName

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

the class DecisionTableGridTest method makeHasNameForDecision.

private Optional<HasName> makeHasNameForDecision() {
    final Decision decision = new Decision();
    decision.setName(new Name(HASNAME_NAME));
    return Optional.of(decision);
}
Also used : Decision(org.kie.workbench.common.dmn.api.definition.v1_1.Decision) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 8 with HasName

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

the class ExpressionContainerGridTest method testSpyHasNameWithoutHasNameSetNameObject.

@Test
@SuppressWarnings("unchecked")
public void testSpyHasNameWithoutHasNameSetNameObject() {
    final String NEW_NAME = "new-name";
    final Name newName = new Name(NEW_NAME);
    grid.setExpression(NODE_UUID, hasExpression, Optional.empty());
    final Optional<HasName> spy = grid.spyHasName(onHasNameChanged);
    assertThat(spy.isPresent()).isTrue();
    spy.get().setName(newName);
    assertThat(hasName.getName().getValue()).isEqualTo(NAME);
    verify(onHasNameChanged, never()).execute(any(Optional.class));
}
Also used : Optional(java.util.Optional) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Matchers.anyString(org.mockito.Matchers.anyString) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Example 9 with HasName

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

the class ExpressionContainerGridTest method testSpyHasNameWithHasNameSetNameValue.

@Test
public void testSpyHasNameWithHasNameSetNameValue() {
    final String NEW_NAME = "new-name";
    grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName));
    final Optional<HasName> spy = grid.spyHasName(onHasNameChanged);
    assertThat(spy.isPresent()).isTrue();
    spy.get().getName().setValue(NEW_NAME);
    assertThat(hasName.getName().getValue()).isEqualTo(NEW_NAME);
    verify(onHasNameChanged).execute(hasNameCaptor.capture());
    assertThat(hasNameCaptor.getValue().get().getName().getValue()).isEqualTo(NEW_NAME);
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 10 with HasName

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

the class ExpressionContainerGridTest method testSpyHasNameWithHasNameSetNameObject.

@Test
public void testSpyHasNameWithHasNameSetNameObject() {
    final String NEW_NAME = "new-name";
    final Name newName = new Name(NEW_NAME);
    grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName));
    final Optional<HasName> spy = grid.spyHasName(onHasNameChanged);
    assertThat(spy.isPresent()).isTrue();
    spy.get().setName(newName);
    assertThat(hasName.getName().getValue()).isEqualTo(NEW_NAME);
    verify(onHasNameChanged).execute(hasNameCaptor.capture());
    assertThat(hasNameCaptor.getValue().get().getName().getValue()).isEqualTo(NEW_NAME);
}
Also used : HasName(org.kie.workbench.common.dmn.api.definition.HasName) Matchers.anyString(org.mockito.Matchers.anyString) HasName(org.kie.workbench.common.dmn.api.definition.HasName) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) Test(org.junit.Test)

Aggregations

HasName (org.kie.workbench.common.dmn.api.definition.HasName)19 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)9 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)9 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)8 Test (org.junit.Test)7 Optional (java.util.Optional)6 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)6 Decision (org.kie.workbench.common.dmn.api.definition.v1_1.Decision)5 Matchers.anyString (org.mockito.Matchers.anyString)5 Before (org.junit.Before)4 LiteralExpression (org.kie.workbench.common.dmn.api.definition.v1_1.LiteralExpression)4 ExpressionEditorDefinition (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinition)4 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)4 GridDataCache (org.kie.workbench.common.dmn.client.widgets.grid.model.GridDataCache)4 UpdateElementPropertyCommand (org.kie.workbench.common.stunner.core.client.canvas.command.UpdateElementPropertyCommand)3 Element (org.kie.workbench.common.stunner.core.graph.Element)3 Definition (org.kie.workbench.common.stunner.core.graph.content.definition.Definition)3 GridColumn (org.uberfire.ext.wires.core.grids.client.model.GridColumn)3 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)3 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)3