@Test
public void testPopupMenuListenerNotificationPickerIsSourceOnHiding() 
    throws InterruptedException, InvocationTargetException {

    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run testLinkPanelNull - headless");
        return;
    }
    final JXDatePicker picker = new JXDatePicker();
    final JXFrame frame = new JXFrame("showing", false);
    frame.add(picker);
    frame.pack();
    frame.setVisible(true);
    final Action togglePopup = picker.getActionMap().get("TOGGLE_POPUP");
    togglePopup.actionPerformed(null);
    final PopupMenuReport report = new PopupMenuReport();
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            picker.addPopupMenuListener(report);
            togglePopup.actionPerformed(null);
            
        }
    });
    
    SwingUtilities.invokeAndWait(new Runnable() {
        @Override
        public void run() {
            assertEquals(1, report.getInvisibleEventCount());
            assertEquals(picker, report.getLastEvent().getSource());
            frame.dispose();
            
        }
    });
}