### Question:
GenerateMojo extends AbstractMojo { protected Map<Table, List<Column>> collectColumns(Collection<Table> tables) throws MojoExecutionException { ResultSet rscolumns = null; try { Map<Table, List<Column>> map = new LinkedHashMap<Table, List<Column>>(); DatabaseMetaData metaData = connection.getMetaData(); rscolumns = metaData.getColumns(null, schemaPattern, "%", "%"); while (rscolumns.next()) { String tableName = rscolumns.getString("TABLE_NAME"); Table table = find(tables, tableName); if (table == null) continue; List<Column> columns = map.get(table); if (columns == null) { columns = new LinkedList<Column>(); map.put(table, columns); } String columnName = rscolumns.getString("COLUMN_NAME"); int dataType = rscolumns.getInt("DATA_TYPE"); int columnSize = rscolumns.getInt("COLUMN_SIZE"); int decimalDigits = rscolumns.getInt("DECIMAL_DIGITS"); int nullable = rscolumns.getInt("NULLABLE"); String remarks = rscolumns.getString("REMARKS"); Column column = new Column(columnName, dataType, columnSize, decimalDigits, nullable == DatabaseMetaData.columnNullable, remarks); columns.add(column); } return map; } catch (SQLException e) { throw new MojoExecutionException("Unable to generate database adapter due to a '" + e.getClass().getName() + "' with message '" + e.getMessage() + "'", e); } finally { if (rscolumns != null) { try { rscolumns.close(); } catch (SQLException ignore) { } } } } GenerateMojo();   GenerateMojo(String driverClass, String url, String username, String password, String schemaPattern, String[] includes, String[] excludes, Template[] templates); void execute();  }### Answer:
@Test public void collectColumns_returns20Columns() throws MojoExecutionException { GenerateMojo generateMojo = new GenerateMojo("oracle.jdbc.driver.OracleDriver", "jdbc:oracle:thin:@10.0.0.46:1551:ORA10A", "DIPMASTER", "DIPMASTER", "DIPMASTER", new String[]{ "CDC_CROCIERA", "CDC_DEPLOYMENT" }, null, USELESS_TEMPLATES_FOR_TEST_PURPOSE); Map<Table, List<Column>> tablesColumns = generateMojo.collectColumns(Arrays.asList(new Table("CDC_CROCIERA"))); assertEquals(20, tablesColumns.values().iterator().next().size()); }