### Question:
ContextEntryPropertyConverter { public static org.kie.dmn.model.api.ContextEntry dmnFromWB(final ContextEntry wb, final Consumer<ComponentWidths> componentWidthsConsumer) { final org.kie.dmn.model.api.ContextEntry result = new org.kie.dmn.model.v1_2.TContextEntry(); final org.kie.dmn.model.api.InformationItem variable = InformationItemPropertyConverter.dmnFromWB(wb.getVariable()); if (Objects.nonNull(variable)) { variable.setParent(result); } org.kie.dmn.model.api.Expression expression = ExpressionPropertyConverter.dmnFromWB(wb.getExpression(), componentWidthsConsumer); if (Objects.isNull(expression)) { final org.kie.dmn.model.v1_2.TLiteralExpression literalExpression = new org.kie.dmn.model.v1_2.TLiteralExpression(); literalExpression.setText(ContextEntry.DEFAULT_EXPRESSION_VALUE); expression = literalExpression; } expression.setParent(result); result.setVariable(variable); result.setExpression(expression); return result; }  static ContextEntry wbFromDMN(final org.kie.dmn.model.api.ContextEntry dmn,
                                         final BiConsumer<String, HasComponentWidths> hasComponentWidthsConsumer); static org.kie.dmn.model.api.ContextEntry dmnFromWB(final ContextEntry wb,
                                                               final Consumer<ComponentWidths> componentWidthsConsumer);  }### Answer:
@Test public void testDMNFromWB() { final ContextEntry wb = new ContextEntry(); final InformationItem informationItem = new InformationItem(); wb.setVariable(informationItem); final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.getComponentWidths().set(0, 200.0); literalExpression.getId().setValue(EXPRESSION_UUID); wb.setExpression(literalExpression); final org.kie.dmn.model.api.ContextEntry dmn = ContextEntryPropertyConverter.dmnFromWB(wb, componentWidthsConsumer); assertThat(dmn).isNotNull(); assertThat(dmn.getVariable()).isNotNull(); assertThat(dmn.getExpression()).isNotNull(); assertThat(dmn.getExpression().getId()).isEqualTo(EXPRESSION_UUID); verify(componentWidthsConsumer).accept(componentWidthsCaptor.capture()); final ComponentWidths componentWidths = componentWidthsCaptor.getValue(); assertThat(componentWidths).isNotNull(); assertThat(componentWidths.getDmnElementRef().getLocalPart()).isEqualTo(EXPRESSION_UUID); assertThat(componentWidths.getWidths().size()).isEqualTo(literalExpression.getRequiredComponentWidthCount()); assertThat(componentWidths.getWidths().get(0)).isEqualTo(200.0); }
@Test public void testDMNFromWBWithNullWBExpression() { final ContextEntry wb = new ContextEntry(); final InformationItem informationItem = new InformationItem(); wb.setVariable(informationItem); wb.setExpression(null); final org.kie.dmn.model.api.ContextEntry dmn = ContextEntryPropertyConverter.dmnFromWB(wb, componentWidthsConsumer); assertThat(dmn).isNotNull(); assertThat(dmn.getVariable()).isNotNull(); assertThat(dmn.getExpression()).isNotNull(); assertThat(dmn.getExpression()).isInstanceOf(org.kie.dmn.model.api.LiteralExpression.class); final org.kie.dmn.model.api.LiteralExpression literalExpression = (org.kie.dmn.model.api.LiteralExpression) dmn.getExpression(); assertThat(literalExpression.getText()).isEqualTo(ContextEntry.DEFAULT_EXPRESSION_VALUE); }