ColumnFactory { public TableColumnExt createAndConfigureTableColumn(TableModel model, int modelIndex) { TableColumnExt column = createTableColumn(modelIndex); if (column != null) { configureTableColumn(model, column); } return column; }  static synchronized ColumnFactory getInstance(); static synchronized void setInstance(ColumnFactory factory); TableColumnExt createAndConfigureTableColumn(TableModel model, int modelIndex); TableColumnExt createTableColumn(int modelIndex); void configureTableColumn(TableModel model, TableColumnExt columnExt); void configureColumnWidths(JXTable table, TableColumnExt columnExt); int getPreferredScrollableViewportWidth(JXTable table); void packColumn(JXTable table, TableColumnExt columnExt, int margin,
            int max); int getDefaultPackMargin(); void setDefaultPackMargin(int margin);  }
@Test public void testCreateNullColumn() { ColumnFactory factory = new ColumnFactory() { @Override public TableColumnExt createTableColumn(int modelIndex) { return null; } }; TableModel model = new DefaultTableModel(0, 10); factory.createAndConfigureTableColumn(model, 0); }
@Test public void testCreateNullColumnFromModelProperty() { ColumnFactory factory = new ColumnFactory() { @Override public TableColumnExt createAndConfigureTableColumn( TableModel model, int modelIndex) { if ("A".equals(model.getColumnName(modelIndex))) return null; return super.createAndConfigureTableColumn(model, modelIndex); } }; TableModel model = new DefaultTableModel(0, 10); TableColumnExt column = factory.createAndConfigureTableColumn(model, 0); assertNull("", column); }