### Question:
NodeProxy implements ShapeProxy { public NodeProxy setTargetNode(Node<View<?>, Edge> targetNode) { this.targetNode = targetNode; return this; } @Inject  NodeProxy(final ElementProxy proxy,
                     final ShapeProxyView<NodeShape> view); @PostConstruct void init(); NodeProxy setCanvasHandler(final AbstractCanvasHandler canvasHandler); NodeProxy setTargetNode(Node<View<?>, Edge> targetNode); NodeProxy setEdge(Edge<ViewConnector<?>, Node> edge); NodeProxy setSourceNode(Node<View<?>, Edge> sourceNode); NodeProxy start(final AbstractMouseEvent event); @Override void start(final double x,
                      final double y); @Override void destroy();  }### Answer:
@Test @SuppressWarnings("all") public void testCreateTargetNode() { CanvasCommand<AbstractCanvasHandler> addConnector = mock(CanvasCommand.class); CanvasCommand<AbstractCanvasHandler> addNode = mock(CanvasCommand.class); CanvasCommand<AbstractCanvasHandler> setTargetNode = mock(CanvasCommand.class); doReturn(addConnector).when(commandFactory).addConnector(eq(sourceNode), eq(edge), any(MagnetConnection.class), eq(SHAPE_SET_ID)); doReturn(addNode).when(commandFactory).addNode(eq(targetNode), eq(SHAPE_SET_ID)); doReturn(setTargetNode).when(commandFactory).setTargetNode(eq(targetNode), eq(edge), any()); verifyCreateTargetNode(addConnector, addNode, setTargetNode); }
@Test @SuppressWarnings("all") public void testCreateTargetNodeInSomeParent() { Node<View<?>, Edge> parentNode = new NodeImpl<>(PARENT_NODE_ID); parentNode.setContent(new ViewImpl<>(mock(Object.class), Bounds.create())); DirectGraphCommandExecutionContext context = new DirectGraphCommandExecutionContext(definitionManager, factoryManager, new MapIndexBuilder().build(graph)); new AddNodeCommand(parentNode).execute(context); new SetChildrenCommand(parentNode, sourceNode).execute(context); CanvasCommand<AbstractCanvasHandler> addConnector = mock(CanvasCommand.class); CanvasCommand<AbstractCanvasHandler> addNode = mock(CanvasCommand.class); CanvasCommand<AbstractCanvasHandler> setTargetNode = mock(CanvasCommand.class); doReturn(addConnector).when(commandFactory).addConnector(eq(sourceNode), eq(edge), any(MagnetConnection.class), eq(SHAPE_SET_ID)); doReturn(addNode).when(commandFactory).addChildNode(eq(parentNode), eq(targetNode), eq(SHAPE_SET_ID)); doReturn(setTargetNode).when(commandFactory).setTargetNode(eq(targetNode), eq(edge), any()); verifyCreateTargetNode(addConnector, addNode, setTargetNode); }