### Question:
DMNElementsSynchronizer { public void synchronizeFromNode(final Optional<Node> node) { node.ifPresent(n -> { if (n.getContent() instanceof Definition) { final Definition definition = (Definition) n.getContent(); if (definition.getDefinition() instanceof DRGElement) { final DRGElement drgElement = (DRGElement) definition.getDefinition(); synchronizeElementsFrom(drgElement); } } }); } @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);  }### Answer:
@Test public void testSynchronizeFromNode() { final Node node = mock(Node.class); final Optional<Node> optional = Optional.of(node); final Definition definition = mock(Definition.class); final DRGElement drgElement = mock(DRGElement.class); doNothing().when(synchronizer).synchronizeElementsFrom(drgElement); when(definition.getDefinition()).thenReturn(drgElement); when(node.getContent()).thenReturn(definition); synchronizer.synchronizeFromNode(optional); verify(synchronizer).synchronizeElementsFrom(drgElement); }