public void testSetsActiveWindowToNullIfThereIsNoRootPaneContainer() {
   JButton button = new JButton();
   KeyboardFocusManager.setCurrentKeyboardFocusManager(new TestKeyboardFocusManager(button));
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, button));
   assertNull(windowContext.activeWindow());
 }
 protected void tearDown() throws Exception {
   super.tearDown();
   windowContext.close();
   KeyboardFocusManager.setCurrentKeyboardFocusManager(defaultKeyboardFocusManager);
 }
 public void testSetsActiveWindowWhenFocusChanges() {
   JFrame frame = new JFrame();
   KeyboardFocusManager.setCurrentKeyboardFocusManager(new TestKeyboardFocusManager(frame));
   windowContext.propertyChange(new PropertyChangeEvent(this, "focusOwner", null, frame));
   assertSame(frame, windowContext.activeWindow());
 }
 private void setFocusManager(Component component) {
   KeyboardFocusManager.setCurrentKeyboardFocusManager(new TestKeyboardFocusManager(component));
 }