@Test public void testSetUnaryTestsWhenUnaryTestsIsNull() { final ItemDefinition wb = mock(ItemDefinition.class); final UnaryTests wbAllowedValues = mock(UnaryTests.class); final org.kie.dmn.model.api.ItemDefinition dmn = mock(org.kie.dmn.model.api.ItemDefinition.class); final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = null; when(dmn.getAllowedValues()).thenReturn(dmnAllowedValues); setUnaryTests(wb, dmn); verify(wb, never()).setAllowedValues(wbAllowedValues); verify(wbAllowedValues, never()).setParent(wb); }
static void setUnaryTests(final ItemDefinition wb, final org.kie.dmn.model.api.ItemDefinition dmn) { final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = dmn.getAllowedValues(); final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues)); wbUnaryTests.ifPresent(unaryTests -> { wb.setAllowedValues(unaryTests); unaryTests.setParent(wb); }); }
ItemDefinitionPropertyConverter { static void setUnaryTests(final ItemDefinition wb, final org.kie.dmn.model.api.ItemDefinition dmn) { final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = dmn.getAllowedValues(); final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues)); wbUnaryTests.ifPresent(unaryTests -> { wb.setAllowedValues(unaryTests); unaryTests.setParent(wb); }); } }
ItemDefinitionPropertyConverter { static void setUnaryTests(final ItemDefinition wb, final org.kie.dmn.model.api.ItemDefinition dmn) { final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = dmn.getAllowedValues(); final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues)); wbUnaryTests.ifPresent(unaryTests -> { wb.setAllowedValues(unaryTests); unaryTests.setParent(wb); }); }  }
ItemDefinitionPropertyConverter { static void setUnaryTests(final ItemDefinition wb, final org.kie.dmn.model.api.ItemDefinition dmn) { final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = dmn.getAllowedValues(); final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues)); wbUnaryTests.ifPresent(unaryTests -> { wb.setAllowedValues(unaryTests); unaryTests.setParent(wb); }); }  static ItemDefinition wbFromDMN(final org.kie.dmn.model.api.ItemDefinition dmn); static org.kie.dmn.model.api.ItemDefinition dmnFromWB(final ItemDefinition wb); }
ItemDefinitionPropertyConverter { static void setUnaryTests(final ItemDefinition wb, final org.kie.dmn.model.api.ItemDefinition dmn) { final org.kie.dmn.model.api.UnaryTests dmnAllowedValues = dmn.getAllowedValues(); final Optional<UnaryTests> wbUnaryTests = ofNullable(UnaryTestsPropertyConverter.wbFromDMN(dmnAllowedValues)); wbUnaryTests.ifPresent(unaryTests -> { wb.setAllowedValues(unaryTests); unaryTests.setParent(wb); }); }  static ItemDefinition wbFromDMN(final org.kie.dmn.model.api.ItemDefinition dmn); static org.kie.dmn.model.api.ItemDefinition dmnFromWB(final ItemDefinition wb);  }