### Question:
ClientUtils { public static String getSelectedElementUUID(ClientSession clientSession) { Optional<Collection<String>> selectedItems = Optional.empty(); if (clientSession instanceof EditorSession) { selectedItems = Optional.ofNullable(((EditorSession) clientSession).getSelectionControl().getSelectedItems()); } else if (clientSession instanceof ViewerSession) { selectedItems = Optional.ofNullable(((ViewerSession) clientSession).getSelectionControl().getSelectedItems()); } return selectedItems.map(strings -> strings.stream().findFirst().orElse(null)).orElse(null); }  static String getSelectedElementUUID(ClientSession clientSession); static Node getSelectedNode(Diagram diagram, ClientSession clientSession);  }### Answer:
@Test public void testGetSelectedElementUUIDWhenSelected() { assertEquals(ITEM_UUID, ClientUtils.getSelectedElementUUID(viewerSession)); assertEquals(ITEM_UUID, ClientUtils.getSelectedElementUUID(editorSession)); }
@Test public void testGetSelectedElementUUIDWhenNotSelected() { selectedItems.clear(); assertNull(ClientUtils.getSelectedElementUUID(viewerSession)); assertNull(ClientUtils.getSelectedElementUUID(editorSession)); }