### Question:
PropertiesPanelNotifier { Optional<Graph<?, Node>> getGraph() { final Optional<CanvasHandler> canvasHandler = getCurrentSession().map(ClientSession::getCanvasHandler); final Optional<Diagram> diagram = canvasHandler.map(CanvasHandler::getDiagram); return diagram.map(Diagram::getGraph); } @Inject  PropertiesPanelNotifier(final Event<RefreshFormPropertiesEvent> refreshFormPropertiesEvent,
                                   final SessionManager sessionManager); PropertiesPanelNotifier withOldLocalPart(final String oldLocalPart); PropertiesPanelNotifier withNewQName(final QName newQName); void notifyPanel();  }### Answer:
@Test public void testGetGraph() { final ClientSession clientSession = mock(ClientSession.class); final CanvasHandler canvasHandler = mock(CanvasHandler.class); final Diagram diagram = mock(Diagram.class); final Optional<Graph> expected = Optional.of(mock(Graph.class)); when(diagram.getGraph()).thenReturn(expected.get()); when(canvasHandler.getDiagram()).thenReturn(diagram); when(clientSession.getCanvasHandler()).thenReturn(canvasHandler); when(sessionManager.getCurrentSession()).thenReturn(clientSession); final Optional<Graph<?, Node>> actual = notifier.getGraph(); assertEquals(expected, actual); }