### Question:
DMNDiagramsSession implements GraphsProvider { @Override public String getCurrentDiagramId() { if (!Objects.isNull(getSessionState())) { final Optional<DMNDiagramElement> current = getCurrentDMNDiagramElement(); if (current.isPresent()) { return current.get().getId().getValue(); } } return null; } DMNDiagramsSession(); @Inject  DMNDiagramsSession(final ManagedInstance<DMNDiagramsSessionState> dmnDiagramsSessionStates,
                              final SessionManager sessionManager,
                              final DMNDiagramUtils dmnDiagramUtils); void destroyState(final Metadata metadata); DMNDiagramsSessionState setState(final Metadata metadata,
                                            final Map<String, Diagram> diagramsByDiagramElementId,
                                            final Map<String, DMNDiagramElement> dmnDiagramsByDiagramElementId); boolean isSessionStatePresent(); DMNDiagramsSessionState getSessionState(); String getCurrentSessionKey(); String getSessionKey(final Metadata metadata); void add(final DMNDiagramElement dmnDiagram,
                    final Diagram stunnerDiagram); void remove(final DMNDiagramElement dmnDiagram); @Override Diagram getDiagram(final String dmnDiagramElementId); @Override String getCurrentDiagramId(); DMNDiagramElement getDMNDiagramElement(final String dmnDiagramElementId); DMNDiagramTuple getDiagramTuple(final String dmnDiagramElementId); List<DMNDiagramTuple> getDMNDiagrams(); void onDMNDiagramSelected(final @Observes DMNDiagramSelected selected); boolean belongsToCurrentSessionState(final DMNDiagramElement diagramElement); Optional<DMNDiagramElement> getCurrentDMNDiagramElement(); Optional<Diagram> getCurrentDiagram(); Diagram getDRGDiagram(); DMNDiagramElement getDRGDiagramElement(); void clear(); List<DRGElement> getModelDRGElements(); List<Import> getModelImports(); @Override boolean isGlobalGraphSelected(); @Override List<Graph> getGraphs(); List<Node> getAllNodes(); Diagram getCurrentGraphDiagram();  }### Answer:
@Test public void testGetCurrentDiagramId() { final DMNDiagramElement diagramElement = mock(DMNDiagramElement.class); final Diagram stunnerDiagram = mock(Diagram.class); final DMNDiagramSelected selectedDiagram = new DMNDiagramSelected(diagramElement); final Id id = mock(Id.class); final String expectedId = "value"; when(id.getValue()).thenReturn(expectedId); when(diagramElement.getId()).thenReturn(id); dmnDiagramsSession.add(diagramElement, stunnerDiagram); dmnDiagramsSession.onDMNDiagramSelected(selectedDiagram); final String actualId = dmnDiagramsSession.getCurrentDiagramId(); assertEquals(expectedId, actualId); }