### Question:
CanvasBoundsIndexerImpl implements CanvasBoundsIndexer<AbstractCanvasHandler> { @Override @SuppressWarnings("unchecked") public Node<View<?>, Edge> getAt(final double x, final double y) { final WiresCanvas canvas = (WiresCanvas) canvasHandler.getAbstractCanvas(); final LienzoLayer lienzoLayer = canvas.getView().getLayer(); final String viewUUID = LienzoLayerUtils.getUUID_At(lienzoLayer, x, y); if (null != viewUUID && viewUUID.trim().length() > 0) { final Shape<?> shape = canvas.getShape(viewUUID); if (null != shape) { return canvasHandler.getGraphIndex().getNode(shape.getUUID()); } } return null; }  BoundsIndexer<AbstractCanvasHandler, Node<View<?>, Edge>> build(final AbstractCanvasHandler context); @Override @SuppressWarnings("unchecked") Node<View<?>, Edge> getAt(final double x,
                                     final double y); @Override @SuppressWarnings("unchecked") Node<View<?>, Edge> getAt(final double x,
                                     final double y,
                                     final double width,
                                     final double height,
                                     final Element parentNode); @Override double[] getTrimmedBounds(); @Override void destroy();  }### Answer:
@Test public void testGetAt() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(20), eq(20))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20); assertNotNull(node); Node<View<?>, Edge> nodeAtFreePosition = canvasBoundsIndexerImpl.getAt(400, 400); assertNull(nodeAtFreePosition); }
@Test public void testGetAreaAtUL() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(20), eq(20))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20, 100, 100, parentNode); assertNotNull(node); }
@Test public void testGetAreaAtUR() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(120), eq(20))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20, 100, 100, parentNode); assertNotNull(node); }
@Test public void testGetAreaAtCC() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(70), eq(70))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20, 100, 100, parentNode); assertNotNull(node); }
@Test public void testGetAreaAtWhitParentLL() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(20), eq(120))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20, 100, 100, parentNode); assertNotNull(node); }
@Test public void testGetAreaAtWhitParentLR() { when(lienzoLayer.getLienzoLayer().getLayer().findShapeAtPoint(eq(120), eq(120))).thenReturn(shape); Node<View<?>, Edge> node = canvasBoundsIndexerImpl.getAt(20, 20, 100, 100, parentNode); assertNotNull(node); }
@Test public void testGetAreaAtFreePosition() { Node<View<?>, Edge> nodeFreePosition = canvasBoundsIndexerImpl.getAt(0, 600, 100, 10, parentNode); assertNull(nodeFreePosition); }