@Test public void testGetOptionalHasExpressionWhenNodeIsDecision() { final View content = mock(View.class); final Decision expectedHasExpression = mock(Decision.class); when(node.getContent()).thenReturn(content); when(content.getDefinition()).thenReturn(expectedHasExpression); final Optional<HasExpression> actualHasExpression = helper.getOptionalHasExpression(node); assertTrue(actualHasExpression.isPresent()); assertEquals(expectedHasExpression, actualHasExpression.get()); }
public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) { final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression expression; if (definition instanceof BusinessKnowledgeModel) { expression = ((BusinessKnowledgeModel) definition).asHasExpression(); } else if (definition instanceof Decision) { expression = (Decision) definition; } else { expression = null; } return Optional.ofNullable(expression); }
BoxedExpressionHelper { public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) { final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression expression; if (definition instanceof BusinessKnowledgeModel) { expression = ((BusinessKnowledgeModel) definition).asHasExpression(); } else if (definition instanceof Decision) { expression = (Decision) definition; } else { expression = null; } return Optional.ofNullable(expression); } }
BoxedExpressionHelper { public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) { final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression expression; if (definition instanceof BusinessKnowledgeModel) { expression = ((BusinessKnowledgeModel) definition).asHasExpression(); } else if (definition instanceof Decision) { expression = (Decision) definition; } else { expression = null; } return Optional.ofNullable(expression); }  }
BoxedExpressionHelper { public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) { final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression expression; if (definition instanceof BusinessKnowledgeModel) { expression = ((BusinessKnowledgeModel) definition).asHasExpression(); } else if (definition instanceof Decision) { expression = (Decision) definition; } else { expression = null; } return Optional.ofNullable(expression); }  Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node); Optional<Expression> getOptionalExpression(final Node<View, Edge> node); Expression getExpression(final Node<View, Edge> node); HasExpression getHasExpression(final Node<View, Edge> node); }
BoxedExpressionHelper { public Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node) { final Object definition = DefinitionUtils.getElementDefinition(node); final HasExpression expression; if (definition instanceof BusinessKnowledgeModel) { expression = ((BusinessKnowledgeModel) definition).asHasExpression(); } else if (definition instanceof Decision) { expression = (Decision) definition; } else { expression = null; } return Optional.ofNullable(expression); }  Optional<HasExpression> getOptionalHasExpression(final Node<View, Edge> node); Optional<Expression> getOptionalExpression(final Node<View, Edge> node); Expression getExpression(final Node<View, Edge> node); HasExpression getHasExpression(final Node<View, Edge> node);  }