public void testImport(int childIndex) throws Exception {
// To verify (AbstractComponent cannot be entirely stubbed)
final Collection<AbstractComponent> added = new ArrayList<AbstractComponent>();
// Set up the root node.
View rootView = mock(View.class);
MCTMutableTreeNode root = createMockNode(rootView);
when(model.getRoot()).thenReturn(root);
DataFlavor[] flavors = new DataFlavor[]{GOOD_FLAVOR};
Transferable transferable = createMockTransferable(flavors);
Component mockTree = mock(Component.class);
TransferSupport support = createDropTransferSupport(mockTree, transferable, flavors);
View targetView = mock(View.class);
MCTMutableTreeNode target = createMockNode(targetView);
AbstractComponent targetComponent = new AbstractComponent() {
@Override
protected void addDelegateComponentsCallback(Collection<AbstractComponent> childComponents) {
added.addAll(childComponents);
super.addDelegateComponentsCallback(childComponents);
}
};
when(targetView.getManifestedComponent()).thenReturn(targetComponent);
View mockView = mock(View.class);
AbstractComponent mockComponent = new AbstractComponent() {};
when(mockView.getManifestedComponent()).thenReturn(mockComponent);
when(transferable.getTransferData(eq(GOOD_FLAVOR))).thenReturn(new View[]{mockView});
// Mock persistence provider, policy manager, and platform
PlatformAccess access = new PlatformAccess();