### Question:
ClientUtils { public static Node getSelectedNode(Diagram diagram, ClientSession clientSession) { String uuid = getSelectedElementUUID(clientSession); return uuid != null ? diagram.getGraph().getNode(uuid) : null; }  static String getSelectedElementUUID(ClientSession clientSession); static Node getSelectedNode(Diagram diagram, ClientSession clientSession);  }### Answer:
@Test public void testGetSelectedNodeWhenSelected() { Node node = mock(Node.class); when(graph.getNode(ITEM_UUID)).thenReturn(node); assertEquals(node, ClientUtils.getSelectedNode(diagram, viewerSession)); assertEquals(node, ClientUtils.getSelectedNode(diagram, editorSession)); }
@Test public void testGetSelectedNodeWhenNotSelected() { selectedItems.clear(); assertNull(ClientUtils.getSelectedNode(diagram, viewerSession)); assertNull(ClientUtils.getSelectedNode(diagram, editorSession)); }