@Test public void testGetShapeIndex_diagram() throws Exception { when(containmentControl.getShape()).thenReturn(mock(CaseManagementDiagramShapeView.class)); OptionalInt result = control.getShapeIndex(); assertEquals(0, result.getAsInt()); }
@Test public void testGetShapeIndex_noShape() throws Exception { when(containmentControl.getShape()).thenReturn(null); OptionalInt result = control.getShapeIndex(); assertFalse(result.isPresent()); }
@Test public void testGetShapeIndex_noParent() throws Exception { when(containmentControl.getParent()).thenReturn(null); OptionalInt result = control.getShapeIndex(); assertFalse(result.isPresent()); } }
@Override public void onMoveStart(double x, double y) { containmentControl.onMoveStart(x, y); if (!(getShape() instanceof CaseManagementShapeView)) { state.setGhost(Optional.empty()); state.setOriginalIndex(OptionalInt.empty()); state.setOriginalParent(Optional.empty()); return; } state.setOriginalParent(Optional.ofNullable(getParent())); state.setOriginalIndex(getShapeIndex()); state.setGhost(Optional.ofNullable(((CaseManagementShapeView) getShape()).getGhost())); final WiresParentPickerControl.Index index = containmentControl.getParentPickerControl().getIndex(); index.clear(); if (state.getGhost().isPresent()) { index.exclude(state.getGhost().get()); } if ((getParent() instanceof CaseManagementShapeView)) { ((CaseManagementShapeView) getParent()).logicallyReplace((CaseManagementShapeView) getShape(), state.getGhost().get()); } }