### Question:
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);  }### Answer:
@Test public void testSetUnaryTestsWhenUnaryTestsIsNotNull() { final ItemDefinition wb = mock(ItemDefinition.class); final ArgumentCaptor<UnaryTests> argument = ArgumentCaptor.forClass(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 = mock(org.kie.dmn.model.api.UnaryTests.class); when(dmn.getAllowedValues()).thenReturn(dmnAllowedValues); setUnaryTests(wb, dmn); verify(wb).setAllowedValues(argument.capture()); assertEquals(wb, argument.getValue().getParent()); }
@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); }