### Question:
DMNElementsSynchronizer { boolean definitionContainsDRGElement(final Node node) { return node.getContent() instanceof Definition && ((Definition) node.getContent()).getDefinition() instanceof 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 testDefinitionContainsDRGElement() { final Node node = mock(Node.class); final Definition definition = mock(Definition.class); final DRGElement drgElement = mock(DRGElement.class); when(definition.getDefinition()).thenReturn(drgElement); when(node.getContent()).thenReturn(definition); final boolean containsDRGElement = synchronizer.definitionContainsDRGElement(node); assertTrue(containsDRGElement); }
@Test public void testDefinitionContainsDRGElement_WhenDoesNotContains() { final Node node = mock(Node.class); final Definition definition = mock(Definition.class); final Object obj = mock(Object.class); when(definition.getDefinition()).thenReturn(obj); when(node.getContent()).thenReturn(definition); final boolean containsDRGElement = synchronizer.definitionContainsDRGElement(node); assertFalse(containsDRGElement); }
@Test public void testDefinitionContainsDRGElement_WhenContentIsNotDefinition() { final Node node = mock(Node.class); final Object obj = mock(Definition.class); when(node.getContent()).thenReturn(obj); final boolean containsDRGElement = synchronizer.definitionContainsDRGElement(node); assertFalse(containsDRGElement); }