@Test
public void testColumnControlInvisibleColumns() {

    final JXTable table = new JXTable(sortableTableModel);
    // columns set to invisible before setting the columnControl
    // will not be inserted into the column control's list
    table.getColumnExt("Last Name").setVisible(false);
    table.setColumnControlVisible(true);
    int totalColumnCount = table.getColumnCount();
    final TableColumnExt priorityColumn = table.getColumnExt("First Name");
    priorityColumn.setVisible(false);
    ColumnControlButton columnControl = (ColumnControlButton) table.getColumnControl();
    assertNotNull("popup menu not null", columnControl.popup);
    int columnMenuItems = 0;
    Component[] items = ((DefaultColumnControlPopup) columnControl.getColumnControlPopup()).getPopupMenu().getComponents();
    for (int i = 0; i < items.length; i++) {
        if (!(items[i] instanceof JMenuItem)) {
            break;
        }
        columnMenuItems++;
    }
    // wrong assumption - has separator and actions!
    assertEquals("menu items must be equal to columns", totalColumnCount, 
            columnMenuItems);
    JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) ((DefaultColumnControlPopup) columnControl.getColumnControlPopup()).getPopupMenu()
        .getComponent(0);
    // sanit assert
    assertEquals(priorityColumn.getHeaderValue(), menuItem.getText());
    assertEquals("selection of menu must be equal to column visibility", 
            priorityColumn.isVisible(), menuItem.isSelected());
}