### Question:
CopySelectionSessionCommand extends AbstractSelectionAwareSessionCommand<EditorSession> { @Override public <V> void execute(final Callback<V> callback) { if (getSession() != null && null != getSession().getSelectionControl()) { try { final SelectionControl<AbstractCanvasHandler, Element> selectionControl = getSession().getSelectionControl(); clipboardControl.set(selectionControl.getSelectedItems().stream() .map(this::getElement) .toArray(Element[]::new)); final Set<String> clipboardNodes = clipboardControl.getElements().stream() .filter(element -> element instanceof Node) .map(Element::getUUID) .collect(Collectors.toSet()); clipboardControl.getEdgeMap().clear(); clipboardControl.getEdgeMap().putAll(clipboardControl.getElements().stream() .filter(element -> element instanceof Edge) .map(edge -> (Edge) edge) .collect(Collectors.toList()).stream() .filter(edge -> clipboardNodes.contains(edge.getSourceNode().getUUID()) && clipboardNodes.contains(edge.getTargetNode().getUUID())) .collect(Collectors.toMap(Edge::getUUID, edge -> clipboardControl.buildNewEdgeClipboard(edge.getSourceNode().getUUID(), (Connection) ((ViewConnector) edge.getContent()).getSourceConnection().orElse(null), edge.getTargetNode().getUUID(), (Connection) ((ViewConnector) edge.getContent()).getTargetConnection().orElse(null)) ))); commandExecutedEvent.fire(new CopySelectionSessionCommandExecutedEvent(this, getSession())); callback.onSuccess(); } catch (Exception e) { LOGGER.severe("Error on copy selection." + e.getMessage()); return; } } } CopySelectionSessionCommand(); @Inject  CopySelectionSessionCommand(final Event<CopySelectionSessionCommandExecutedEvent> commandExecutedEvent, final SessionManager sessionManager); static CopySelectionSessionCommand getInstance(SessionManager sessionManager); static CopySelectionSessionCommand getInstance(final Event<CopySelectionSessionCommandExecutedEvent> commandExecutedEvent, SessionManager sessionManager); @Override void bind(final EditorSession session); @Override boolean accepts(final ClientSession session); @Override void execute(final Callback<V> callback);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testExecute() { copySelectionSessionCommand.bind(session); copySelectionSessionCommand.execute(callback); verify(selectionControl, atLeastOnce()).getSelectedItems(); verify(clipboardControl, times(1)).set(node); verify(callback, times(1)).onSuccess(); verify(commandExecutedEvent, times(1)).fire(eventArgumentCaptor.capture()); assertEquals(session, eventArgumentCaptor.getValue().getClientSession()); assertEquals(copySelectionSessionCommand, eventArgumentCaptor.getValue().getExecutedCommand()); reset(callback); when(selectionControl.getSelectedItems()).thenThrow(new RuntimeException()); copySelectionSessionCommand.execute(callback); verify(callback, never()).onSuccess(); }