### Question:
DMNGraphUtils { public Definitions getDefinitions(final Diagram diagram) { return dmnDiagramUtils.getDefinitions(diagram); } DMNGraphUtils(); @Inject  DMNGraphUtils(final SessionManager sessionManager,
                         final DMNDiagramUtils dmnDiagramUtils,
                         final DMNDiagramsSession dmnDiagramsSession); Definitions getModelDefinitions(); List<DRGElement> getModelDRGElements(); Definitions getDefinitions(final Diagram diagram); List<DRGElement> getDRGElements(final Diagram diagram); Stream<Node> getNodeStream(final Diagram diagram); Optional<ClientSession> getCurrentSession(); Stream<Node> getNodeStream(); CanvasHandler getCanvasHandler();  }### Answer:
@Test public void testGetDefinitions() { final Definitions expectedDefinitions = mock(Definitions.class); when(dmnDiagramsSession.getDRGDiagram()).thenReturn(diagram); when(dmnDiagramUtils.getDefinitions(diagram)).thenReturn(expectedDefinitions); final Definitions actualDefinitions = utils.getModelDefinitions(); assertNotNull(actualDefinitions); assertEquals(expectedDefinitions, actualDefinitions); }
@Test public void testGetDefinitionsWithDiagram() { final Definitions expectedDefinitions = mock(Definitions.class); final Diagram diagram = mock(Diagram.class); when(dmnDiagramUtils.getDefinitions(diagram)).thenReturn(expectedDefinitions); final Definitions actualDefinitions = utils.getDefinitions(diagram); assertNotNull(actualDefinitions); assertEquals(expectedDefinitions, actualDefinitions); }