### Question:
SetCanvasChildrenCommand extends AbstractCanvasCommand { @Override @SuppressWarnings("unchecked") public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { candidates.forEach(candidate -> setCanvasChild(context, candidate)); return buildResult(); } SetCanvasChildrenCommand(final Node parent,
                                    final Collection<Node<?, Edge>> candidates); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); Node getParent(); Collection<Node<?, Edge>> getCandidates(); @Override String toString();  }### Answer:
@Test @SuppressWarnings("unchecked") public void testExecute() { final CommandResult<CanvasViolation> result = tested.execute(canvasHandler); assertNotEquals(CommandResult.Type.ERROR, result.getType()); verify(canvasHandler, times(1)).addChild(eq(graph1Instance.startNode), eq(graph1Instance.intermNode)); verify(canvasHandler, never()).applyElementMutation(eq(graph1Instance.intermNode), any(MutationContext.class)); verify(canvasHandler, never()).applyElementMutation(eq(graph1Instance.startNode), any(MutationContext.class)); verify(canvasHandler, times(0)).dock(any(Node.class), any(Node.class)); verify(connectorShapeView1, times(1)).moveToTop(); verify(connectorShapeView1, never()).moveToBottom(); verify(connectorShapeView1, never()).moveUp(); verify(connectorShapeView1, never()).moveDown(); verify(connectorShapeView2, times(1)).moveToTop(); verify(connectorShapeView2, never()).moveToBottom(); verify(connectorShapeView2, never()).moveUp(); verify(connectorShapeView2, never()).moveDown(); }
@Test @SuppressWarnings("unchecked") public void testSkipExecutionAsDockIsPresent() { final Edge dockEdge = mock(Edge.class); when(dockEdge.getContent()).thenReturn(new Dock()); graph1Instance.intermNode.getInEdges().add(dockEdge); final CommandResult<CanvasViolation> result = tested.execute(canvasHandler); assertNotEquals(CommandResult.Type.ERROR, result.getType()); verify(canvasHandler, never()).addChild(eq(graph1Instance.startNode), eq(graph1Instance.intermNode)); verify(canvasHandler, never()).applyElementMutation(eq(graph1Instance.intermNode), any(MutationContext.class)); verify(canvasHandler, never()).applyElementMutation(eq(graph1Instance.startNode), any(MutationContext.class)); verify(canvasHandler, never()).dock(any(Node.class), any(Node.class)); verify(connectorShapeView1, never()).moveToTop(); verify(connectorShapeView1, never()).moveToBottom(); verify(connectorShapeView1, never()).moveUp(); verify(connectorShapeView1, never()).moveDown(); verify(connectorShapeView2, never()).moveToTop(); verify(connectorShapeView2, never()).moveToBottom(); verify(connectorShapeView2, never()).moveUp(); verify(connectorShapeView2, never()).moveDown(); }