JDialog child = new JDialog(parent, "child");
grandParent.show();
parent.show();
new Snooze(500);
WindowMonitor windowMonitor = WindowMonitor.getInstance();
WindowId parentId = WindowIdCreator.createWindowId(parent, windowMonitor);
child.show();
new Snooze(500);
WindowId childId = WindowIdCreator.createWindowId(child, windowMonitor);
WindowElement parentAction = new WindowElement(parentId);
WindowElement childAction = new WindowElement(childId);
Window w = windowMonitor.getWindow(parentId.getTitle());
assertEquals("parent", windowMonitor.getNamingStrategy().getName(w));
assertTrue("Parent owns the child", parentAction.owns(childAction));