public void testFiresDialogOpenedEventWhenDialogIsShown() {
   Mock mockWindowContextListener = mock(WindowContextListener.class);
   windowContext.addWindowContextListener(
       (WindowContextListener) mockWindowContextListener.proxy());
   mockWindowContextListener.expects(once()).method("dialogShown");
   windowContext.setActiveWindow(new JDialog((Frame) null, "test"));
 }
 public void testListenerIsNotNotifiedWhenRemoved() {
   Mock mockWindowContextListener = mock(WindowContextListener.class);
   WindowContextListener listener = (WindowContextListener) mockWindowContextListener.proxy();
   windowContext.addWindowContextListener(listener);
   windowContext.removeWindowContextListener(listener);
   mockWindowContextListener.expects(never()).method("dialogShown");
   windowContext.setActiveWindow(new JDialog((Frame) null, "test"));
 }