use of org.kie.workbench.common.dmn.api.definition.model.NamedElement in project kie-wb-common by kiegroup.
the class NodeTextSetterTest method testGetName.
@Test
public void testGetName() {
final NamedElement named = mock(NamedElement.class);
final Node node = mock(Node.class);
final Name name = mock(Name.class);
final String nodeName = "node name";
when(name.getValue()).thenReturn(nodeName);
when(named.getName()).thenReturn(name);
doReturn(Optional.of(named)).when(nodeTextSetter).getNamedElement(node);
final String actualName = nodeTextSetter.getName(node);
assertEquals(nodeName, actualName);
}
use of org.kie.workbench.common.dmn.api.definition.model.NamedElement in project kie-wb-common by kiegroup.
the class NodeTextSetterTest method testGetNamedElementWhenNamedIsNotPresent.
@Test
public void testGetNamedElementWhenNamedIsNotPresent() {
final Node node = mock(Node.class);
final View content = mock(View.class);
final Object namedElement = mock(Object.class);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(namedElement);
final Optional<NamedElement> actualNamed = nodeTextSetter.getNamedElement(node);
assertFalse(actualNamed.isPresent());
}
use of org.kie.workbench.common.dmn.api.definition.model.NamedElement in project kie-wb-common by kiegroup.
the class NodeTextSetterTest method testGetNamedElementWhenViewIsNotPresent.
@Test
public void testGetNamedElementWhenViewIsNotPresent() {
final Node node = mock(Node.class);
final Object content = mock(Object.class);
when(node.getContent()).thenReturn(content);
final Optional<NamedElement> actualNamed = nodeTextSetter.getNamedElement(node);
assertFalse(actualNamed.isPresent());
}
use of org.kie.workbench.common.dmn.api.definition.model.NamedElement in project kie-wb-common by kiegroup.
the class MonacoFEELSuggestions method getName.
private String getName(final Object definition) {
final NamedElement namedElement = (NamedElement) definition;
final Name name = namedElement.getName();
return name.getValue();
}
Aggregations