public void testPlaysEvent() throws Exception { Mock mockComponentFinder = mock(ComponentFinder.class); JInternalFrame internalFrame = createInternalFrame(); mockComponentFinder .expects(once()) .method("findInternalFrame") .will(returnValue(internalFrame)); internalFrame.setSelected(false); new CloseInternalFrameEvent("title") .play(null, (ComponentFinder) mockComponentFinder.proxy(), null, null); assertTrue(internalFrame.isClosed()); }
@RunsInCurrentThread private static Pair<Boolean, Point> closeInfo(JInternalFrame internalFrame) { if (internalFrame.isClosed()) return new Pair<Boolean, Point>(true, null); return new Pair<Boolean, Point>(false, closeLocationOf(internalFrame)); }