use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class ContextTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
final ContextEntry contextEntry1 = mock(ContextEntry.class);
final ContextEntry contextEntry2 = mock(ContextEntry.class);
final List<ContextEntry> contextEntry = asList(contextEntry1, contextEntry2);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
doReturn(contextEntry).when(context).getContextEntry();
when(contextEntry1.getHasTypeRefs()).thenReturn(asList(hasTypeRef1));
when(contextEntry2.getHasTypeRefs()).thenReturn(asList(hasTypeRef2));
final List<HasTypeRef> actualHasTypeRefs = context.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(context, hasTypeRef1, hasTypeRef2);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class FunctionDefinitionTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
final Expression expression = mock(Expression.class);
final InformationItem informationItem1 = mock(InformationItem.class);
final InformationItem informationItem2 = mock(InformationItem.class);
final List<InformationItem> formalParameter = asList(informationItem1, informationItem2);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef3 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef4 = mock(HasTypeRef.class);
doReturn(expression).when(functionDefinition).getExpression();
doReturn(formalParameter).when(functionDefinition).getFormalParameter();
when(expression.getHasTypeRefs()).thenReturn(asList(hasTypeRef1, hasTypeRef2));
when(informationItem1.getHasTypeRefs()).thenReturn(asList(hasTypeRef3));
when(informationItem2.getHasTypeRefs()).thenReturn(asList(hasTypeRef4));
final List<HasTypeRef> actualHasTypeRefs = functionDefinition.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(functionDefinition, hasTypeRef1, hasTypeRef2, hasTypeRef3, hasTypeRef4);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class ListTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
// added
final Expression expression1 = mock(Expression.class);
// added
final Expression expression2 = mock(Expression.class);
final List<HasExpression> hasExpressions = asList(HasExpression.wrap(list, expression1), HasExpression.wrap(list, expression2));
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
doReturn(hasExpressions).when(list).getExpression();
when(expression1.getHasTypeRefs()).thenReturn(asList(hasTypeRef1));
when(expression2.getHasTypeRefs()).thenReturn(asList(hasTypeRef2));
final List<HasTypeRef> actualHasTypeRefs = list.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(list, hasTypeRef1, hasTypeRef2);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class HasTypeRefHelperTest method testGetNotNullHasTypeRefs.
@Test
public void testGetNotNullHasTypeRefs() {
final HasTypeRef hasTypeRef = mock(HasTypeRef.class);
final List<HasTypeRef> expectedHasTypeRefs = asList(mock(HasTypeRef.class), mock(HasTypeRef.class));
when(hasTypeRef.getHasTypeRefs()).thenReturn(expectedHasTypeRefs);
final List<HasTypeRef> actualHasTypeRefs = HasTypeRefHelper.getNotNullHasTypeRefs(hasTypeRef);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
use of org.kie.workbench.common.dmn.api.definition.HasTypeRef in project kie-wb-common by kiegroup.
the class DecisionTableTest method testGetHasTypeRefs.
@Test
public void testGetHasTypeRefs() {
final InputClause inputClauses1 = mock(InputClause.class);
final InputClause inputClauses2 = mock(InputClause.class);
final List<InputClause> inputClauses = asList(inputClauses1, inputClauses2);
final OutputClause outputClauses1 = mock(OutputClause.class);
final OutputClause outputClauses2 = mock(OutputClause.class);
final List<OutputClause> outputClauses = asList(outputClauses1, outputClauses2);
final DecisionRule decisionRules1 = mock(DecisionRule.class);
final DecisionRule decisionRules2 = mock(DecisionRule.class);
final List<DecisionRule> decisionRules = asList(decisionRules1, decisionRules2);
final HasTypeRef hasTypeRef1 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef2 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef3 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef4 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef5 = mock(HasTypeRef.class);
final HasTypeRef hasTypeRef6 = mock(HasTypeRef.class);
doReturn(inputClauses).when(decisionTable).getInput();
doReturn(outputClauses).when(decisionTable).getOutput();
doReturn(decisionRules).when(decisionTable).getRule();
when(inputClauses1.getHasTypeRefs()).thenReturn(asList(hasTypeRef1));
when(inputClauses2.getHasTypeRefs()).thenReturn(asList(hasTypeRef2));
when(outputClauses1.getHasTypeRefs()).thenReturn(asList(hasTypeRef3));
when(outputClauses2.getHasTypeRefs()).thenReturn(asList(hasTypeRef4));
when(decisionRules1.getHasTypeRefs()).thenReturn(asList(hasTypeRef5));
when(decisionRules2.getHasTypeRefs()).thenReturn(asList(hasTypeRef6));
final List<HasTypeRef> actualHasTypeRefs = decisionTable.getHasTypeRefs();
final List<HasTypeRef> expectedHasTypeRefs = asList(decisionTable, hasTypeRef1, hasTypeRef2, hasTypeRef3, hasTypeRef4, hasTypeRef5, hasTypeRef6);
assertEquals(expectedHasTypeRefs, actualHasTypeRefs);
}
Aggregations