use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests in project kie-wb-common by kiegroup.
the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenNonNullWithNonEmptyString.
@Test
public void testDMNFromWBWhenNonNullWithNonEmptyString() {
final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
wb.getText().setValue(TEXT);
final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNotNull();
verify(jsitUnaryTests).setText(TEXT);
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests in project kie-wb-common by kiegroup.
the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenNonNullWithEmptyString.
@Test
public void testDMNFromWBWhenNonNullWithEmptyString() {
final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
wb.getText().setValue("");
final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNull();
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests in project kie-wb-common by kiegroup.
the class OutputClauseUnaryTestsPropertyConverterTest method testDMNFromWBWhenTextIsNull.
@Test
public void testDMNFromWBWhenTextIsNull() {
final OutputClauseUnaryTests wb = new OutputClauseUnaryTests();
wb.setText(null);
final JSITUnaryTests dmn = OutputClauseUnaryTestsPropertyConverter.dmnFromWB(wb);
assertThat(dmn).isNull();
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests in project kie-wb-common by kiegroup.
the class OutputClauseUnaryTestsPropertyConverter method wbFromDMN.
public static OutputClauseUnaryTests wbFromDMN(final org.kie.dmn.model.api.UnaryTests dmn) {
if (dmn == null) {
return null;
}
final Id id = new Id(dmn.getId());
final QName key = new QName(DMNModelInstrumentedBase.Namespace.KIE.getUri(), ConstraintType.CONSTRAINT_KEY, DMNModelInstrumentedBase.Namespace.KIE.getPrefix());
final String constraintString = dmn.getAdditionalAttributes().getOrDefault(key, "");
final ConstraintType constraint = ConstraintType.fromString(constraintString);
final OutputClauseUnaryTests result = new OutputClauseUnaryTests(id, new Text(dmn.getText()), constraint);
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.OutputClauseUnaryTests in project kie-wb-common by kiegroup.
the class OutputClausePropertyConverter method wbFromDMN.
public static OutputClause wbFromDMN(final org.kie.dmn.model.api.OutputClause dmn) {
final Id id = new Id(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final OutputClauseUnaryTests outputValues = OutputClauseUnaryTestsPropertyConverter.wbFromDMN(dmn.getOutputValues());
final OutputClauseLiteralExpression defaultOutputEntry = OutputClauseLiteralExpressionPropertyConverter.wbFromDMN(dmn.getDefaultOutputEntry());
final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
final OutputClause result = new OutputClause();
result.setId(id);
result.setName(dmn.getName());
result.setDescription(description);
result.setOutputValues(outputValues);
result.setDefaultOutputEntry(defaultOutputEntry);
result.setTypeRef(typeRef);
if (outputValues != null) {
outputValues.setParent(result);
}
if (defaultOutputEntry != null) {
defaultOutputEntry.setParent(result);
}
return result;
}
Aggregations