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")); }