@Test public void testGetNode() { final Node node1 = mock(Node.class); final Node node2 = mock(Node.class); final Node node3 = mock(Node.class); final String id = "id"; when(node1.getUUID()).thenReturn(id); when(node2.getUUID()).thenReturn("id2"); when(node3.getUUID()).thenReturn("id3"); when(graphUtils.getNodeStream()).thenReturn(Stream.of(node1, node2, node3)); final Optional<Node> node = synchronizer.getNode(id); assertTrue(node.isPresent()); assertEquals(node1, node.get()); }
Optional<Node> getNode(final String nodeUUID) { return graphUtils .getNodeStream() .filter(node -> Objects.equals(node.getUUID(), nodeUUID)) .findFirst(); }
DMNElementsSynchronizer { Optional<Node> getNode(final String nodeUUID) { return graphUtils .getNodeStream() .filter(node -> Objects.equals(node.getUUID(), nodeUUID)) .findFirst(); } }
DMNElementsSynchronizer { Optional<Node> getNode(final String nodeUUID) { return graphUtils .getNodeStream() .filter(node -> Objects.equals(node.getUUID(), nodeUUID)) .findFirst(); } @Inject  DMNElementsSynchronizer(final DMNDiagramsSession dmnDiagramsSession,
                                   final Event<RefreshDecisionComponents> refreshDecisionComponentsEvent,
                                   final DMNGraphUtils graphUtils,
                                   final NodeTextSetter nodeTextSetter); }
DMNElementsSynchronizer { Optional<Node> getNode(final String nodeUUID) { return graphUtils .getNodeStream() .filter(node -> Objects.equals(node.getUUID(), nodeUUID)) .findFirst(); } @Inject  DMNElementsSynchronizer(final DMNDiagramsSession dmnDiagramsSession,
                                   final Event<RefreshDecisionComponents> refreshDecisionComponentsEvent,
                                   final DMNGraphUtils graphUtils,
                                   final NodeTextSetter nodeTextSetter); void onExpressionEditorChanged(final @Observes ExpressionEditorChanged event); void onPropertyChanged(final @Observes FormFieldChanged event); void synchronizeElementsFrom(final DRGElement drgElement); void synchronizeFromNode(final Optional<Node> node); }
DMNElementsSynchronizer { Optional<Node> getNode(final String nodeUUID) { return graphUtils .getNodeStream() .filter(node -> Objects.equals(node.getUUID(), nodeUUID)) .findFirst(); } @Inject  DMNElementsSynchronizer(final DMNDiagramsSession dmnDiagramsSession,
                                   final Event<RefreshDecisionComponents> refreshDecisionComponentsEvent,
                                   final DMNGraphUtils graphUtils,
                                   final NodeTextSetter nodeTextSetter); void onExpressionEditorChanged(final @Observes ExpressionEditorChanged event); void onPropertyChanged(final @Observes FormFieldChanged event); void synchronizeElementsFrom(final DRGElement drgElement); void synchronizeFromNode(final Optional<Node> node);  }