### Question:
UpdateElementPositionCommand extends AbstractGraphCommand { @Override @SuppressWarnings("unchecked") public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) { return execute(context, bounds -> node.getContent().setBounds(bounds)); } UpdateElementPositionCommand(final @MapsTo("uuid") String uuid,
                                        final @MapsTo("location") Point2D location,
                                        final @MapsTo("previousLocation") Point2D previousLocation);  UpdateElementPositionCommand(final Node<? extends View<?>, Edge> node,
                                        final Point2D location); Point2D getLocation(); Point2D getPreviousLocation(); Node<?, Edge> getNode(); String getUuid(); @Override @SuppressWarnings("unchecked") CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context); @Override CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context); static Bounds computeCandidateBounds(final Element<? extends View<?>> element,
                                                final Point2D location); @Override String toString();  }### Answer:
@Test public void testExecute() { CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); ArgumentCaptor<Bounds> bounds = ArgumentCaptor.forClass(Bounds.class); verify(content, times(1)).setBounds(bounds.capture()); assertEquals(CommandResult.Type.INFO, result.getType()); Bounds b = bounds.getValue(); assertEquals(UUID, tested.getUuid()); assertEquals(LOCATION, tested.getLocation()); assertEquals(PREVIOUS_LOCATION, tested.getPreviousLocation()); assertEquals(PREVIOUS_LOCATION.getY(), tested.getPreviousLocation().getY() , 0d); assertEquals(Double.valueOf(LOCATION.getX() + W), b.getLowerRight().getX()); assertEquals(Double.valueOf(LOCATION.getY() + H), b.getLowerRight().getY()); }
@Test @SuppressWarnings("unchecked") public void testExecuteDockedNode() { ArgumentCaptor<Bounds> boundsArgumentCaptor = ArgumentCaptor.forClass(Bounds.class); this.tested = new UpdateElementPositionCommand(dockedNode, new Point2D(600d, 600d)); final CommandResult<RuleViolation> result = tested.execute(graphCommandExecutionContext); verify((View) dockedNode.getContent(), times(1)).setBounds(boundsArgumentCaptor.capture()); assertEquals(CommandResult.Type.INFO, result.getType()); Bounds bounds = boundsArgumentCaptor.getValue(); assertEquals(bounds.getUpperLeft(), Bound.create(600d, 600d)); assertEquals(bounds.getLowerRight(), Bound.create(650d, 650d)); }