Source:
public void testOnShapeLocationsChanged() { when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(mock(CanvasHandler.class)); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(0d), eq(0d), eq(100d), eq(100d), eq(overLayer), eq(10.0)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); when(shapeLocationsChangedEvent.getUuids()).thenReturn(new ArrayList<String>()); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(0d), eq(0d), eq(100d), eq(100d), eq(overLayer), eq(10.0)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); ArrayList<String> selectedUUIds = new ArrayList<String>(); selectedUUIds.add("TestUUID"); when(shapeLocationsChangedEvent.getUuids()).thenReturn(selectedUUIds); when(tested.getSelectedItems()).thenReturn(selectedUUIds); when(delegateShapeProvider.getShape()).thenReturn(mock(com.ait.lienzo.client.core.shape.Shape.class)); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectedItems.getBoundingBox()).thenReturn(new BoundingBox(0d, 0d, 100d, 100d)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, times(1)).rebuildBoundingBox(); verify(selectionManager, times(1)).drawSelectionShape(eq(0d), eq(0d), eq(100d), eq(100d), eq(overLayer), eq(10.0)); }

Target:
public void testOnShapeLocationsChanged() { when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(mock(CanvasHandler.class)); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); when(shapeLocationsChangedEvent.getUuids()).thenReturn(new ArrayList<>()); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, never()).rebuildBoundingBox(); verify(selectionManager, never()).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); List<String> selectedUUIds = new ArrayList<>(); selectedUUIds.add("ELEMENT_UUID"); when(shapeLocationsChangedEvent.getUuids()).thenReturn(selectedUUIds); when(tested.getSelectedItems()).thenReturn(selectedUUIds); when(delegateShapeProvider.getShape()).thenReturn(mock(com.ait.lienzo.client.core.shape.Shape.class)); when(selectionManager.getSelectedItems()).thenReturn(selectedItems); when(selectedItems.getBoundingBox()).thenReturn(new BoundingBox(MIN_WIDTH, MIN_HEIGHT, MAX_WIDTH, MAX_HEIGHT)); when(shapeLocationsChangedEvent.getCanvasHandler()).thenReturn(canvasHandler); tested.onShapeLocationsChanged(shapeLocationsChangedEvent); verify(selectedItems, times(1)).rebuildBoundingBox(); verify(selectionManager, times(1)).drawSelectionShape(eq(MIN_WIDTH), eq(MIN_HEIGHT), eq(MAX_WIDTH), eq(MAX_HEIGHT), eq(overLayer)); }