// Setup selected nodes, including a parent
int nodes = Math.max(canCompose.length, canDelete.length);
selectedTreePaths = new TreePath[nodes];
AbstractComponent mockParent = mockComponent(canDeleteParent, canComposeParent);
MCTMutableTreeNode mockParentNode = Mockito.mock(MCTMutableTreeNode.class);
View mockParentView = mockView(mockParent, ViewType.NODE);
Mockito.when(mockParentNode.getUserObject()).thenReturn(mockParentView);
for (int i = 0; i < nodes; i++) {
AbstractComponent mockChild =
mockComponent(canDelete [i % canDelete.length ],
canCompose[i % canCompose.length]);
TreePath mockPath = Mockito.mock(TreePath.class);
MCTMutableTreeNode mockTreeNode = Mockito.mock(MCTMutableTreeNode.class);
Mockito.when(mockPath.getLastPathComponent()).thenReturn(mockTreeNode);
View mockView = mockView(mockChild, ViewType.NODE);
Mockito.when(mockTreeNode.getUserObject()).thenReturn(mockView);
Mockito.when(mockTreeNode.getParent()).thenReturn(mockParentNode);
selectedTreePaths[i] = mockPath;
}
// Verify precondition; obey ContextAwareAction life cycle
Assert.assertTrue(deleteAll.canHandle(mockContext));