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());
}
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);
}
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));
}
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);
}
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);
}
Aggregations