### Question:
WiresLayer extends LienzoLayer { public WiresLayer dock(final WiresContainer parent, final WiresShape child) { final WiresDockingControl dockingControl = child.getControl().getDockingControl(); dockingControl.dock(parent); final Point2D candidateLocation = dockingControl.getCandidateLocation(); if (null != candidateLocation) { child.setLocation(candidateLocation); } return this; }  WiresLayer use(final WiresManager wiresManager); LienzoLayer add(final WiresShape wiresShape); LienzoLayer add(final WiresConnector wiresConnector); LienzoLayer delete(final WiresShape wiresShape); LienzoLayer delete(final WiresConnector wiresConnector); WiresLayer addChild(final WiresContainer parent,
                               final WiresShape child); WiresLayer deleteChild(final WiresContainer parent,
                                  final WiresShape child); WiresLayer dock(final WiresContainer parent,
                           final WiresShape child); WiresLayer undock(final WiresShape child); WiresManager getWiresManager(); @Override void destroy();  }### Answer:
@Test public void testDock() { WiresShapeControl control = mock(WiresShapeControl.class); WiresDockingControl dockingControl = mock(WiresDockingControl.class); when(control.getDockingControl()).thenReturn(dockingControl); when(shape.getControl()).thenReturn(control); Point2D location = new Point2D(1, 1); when(dockingControl.getCandidateLocation()).thenReturn(location); WiresShape parent = mock(WiresShape.class); tested.dock(parent, shape); verify(dockingControl, times(1)).dock(eq(parent)); verify(shape, times(1)).setLocation(eq(location)); }
@Test public void testDockButNoContext() { WiresShapeControl control = mock(WiresShapeControl.class); WiresDockingControl dockingControl = mock(WiresDockingControl.class); when(control.getDockingControl()).thenReturn(dockingControl); when(shape.getControl()).thenReturn(control); when(dockingControl.getCandidateLocation()).thenReturn(null); WiresShape parent = mock(WiresShape.class); tested.dock(parent, shape); verify(dockingControl, times(1)).dock(eq(parent)); verify(shape, never()).setLocation(any(Point2D.class)); }