use of org.kie.dmn.model.v1_4.TContext in project kie-wb-common by kiegroup.
the class FunctionDefinitionPropertyConverterTest method doTestWBFromDMNWithContextEntry.
private void doTestWBFromDMNWithContextEntry(final FunctionKind kind, final String variableName, final Class<? extends IsLiteralExpression> literalExpressionClass) {
final org.kie.dmn.model.api.FunctionDefinition dmn = new TFunctionDefinition();
final org.kie.dmn.model.api.Context contextExpression = new TContext();
final org.kie.dmn.model.api.ContextEntry contextEntry = new TContextEntry();
final org.kie.dmn.model.api.InformationItem variable = new TInformationItem();
variable.setName(variableName);
contextEntry.setVariable(variable);
contextEntry.setExpression(new TLiteralExpression());
contextExpression.getContextEntry().add(contextEntry);
dmn.setKind(kind);
dmn.setExpression(contextExpression);
final FunctionDefinition wb = FunctionDefinitionPropertyConverter.wbFromDMN(dmn, hasComponentWidthsConsumer);
assertThat(wb.getExpression()).isInstanceOf(Context.class);
assertThat(((Context) wb.getExpression()).getContextEntry().get(0).getExpression()).isInstanceOf(literalExpressionClass);
}
Aggregations