### Question:
AddCanvasDockedNodeCommand extends AbstractCanvasCommand { @Override @SuppressWarnings("unchecked") public CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context) { context.register(ssid, candidate); context.applyElementMutation(candidate, MutationContext.STATIC); context.applyElementMutation(parent, MutationContext.STATIC); if (!context.dock(parent, candidate)) { return new CanvasCommandResultBuilder() .addViolation(CanvasViolationImpl.Builder .build(new DockingRuleViolation(parent.getUUID(), candidate.getUUID()))) .build(); } return buildResult(); } AddCanvasDockedNodeCommand(final Node parent,
                                      final Node candidate,
                                      final String ssid); @Override @SuppressWarnings("unchecked") CommandResult<CanvasViolation> execute(final AbstractCanvasHandler context); @Override CommandResult<CanvasViolation> undo(final AbstractCanvasHandler context); @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)).register(eq(SHAPE_SET_ID), eq(candidate)); verify(canvasHandler, times(1)).dock(eq(parent), eq(candidate)); verify(canvasHandler, times(1)).applyElementMutation(eq(candidate), any(MutationContext.class)); verify(canvasHandler, times(1)).applyElementMutation(eq(parent), any(MutationContext.class)); verify(canvasHandler, never()).addChild(eq(parent), eq(candidate)); }