use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BoxedExpressionHelperTest method testGetExpression.
@Test
public void testGetExpression() {
final View content = mock(View.class);
final Decision decision = mock(Decision.class);
final Expression expectedExpression = mock(Expression.class);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(decision);
when(decision.getExpression()).thenReturn(expectedExpression);
final Expression actualExpression = helper.getExpression(node);
assertEquals(expectedExpression, actualExpression);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class BoxedExpressionHelperTest method testGetOptionalExpressionWhenIsPresent.
@Test
public void testGetOptionalExpressionWhenIsPresent() {
final View content = mock(View.class);
final Decision decision = mock(Decision.class);
final Expression expectedExpression = mock(Expression.class);
when(node.getContent()).thenReturn(content);
when(content.getDefinition()).thenReturn(decision);
when(decision.getExpression()).thenReturn(expectedExpression);
final Optional<Expression> optionalExpression = helper.getOptionalExpression(node);
assertTrue(optionalExpression.isPresent());
assertEquals(expectedExpression, optionalExpression.get());
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByDrgElementNoResult.
@Test
public void testQueryFilteredByDrgElementNoResult() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setDrgElement("KnowledgeRequirement");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = emptyList();
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryFilteredByTermMultipleResults.
@Test
public void testQueryFilteredByTermMultipleResults() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
filter.setTerm("?");
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = asList(item1, item2);
assertEquals(expectedResult, actualResult);
}
use of org.kie.workbench.common.dmn.api.definition.model.Decision in project kie-wb-common by kiegroup.
the class DecisionComponentFilterTest method testQueryWithoutFilters.
@Test
public void testQueryWithoutFilters() {
final DecisionComponentsItem item1 = item("Can Drive?", new Decision());
final DecisionComponentsItem item2 = item("Is Allowed?", new Decision());
final DecisionComponentsItem item3 = item("Age", new InputData());
final DecisionComponentsItem item4 = item("Name", new InputData());
final Stream<DecisionComponentsItem> stream = Stream.of(item1, item2, item3, item4);
final Stream<DecisionComponentsItem> query = filter.query(stream);
final List<DecisionComponentsItem> actualResult = query.collect(Collectors.toList());
final List<DecisionComponentsItem> expectedResult = asList(item1, item2, item3, item4);
assertEquals(expectedResult, actualResult);
}
Aggregations