### Question:
GenerateMojo extends AbstractMojo { protected Collection<Table> collectTables() throws MojoExecutionException { ResultSet rstables = null; try { List<Table> tables = new LinkedList<Table>(); DatabaseMetaData metaData = connection.getMetaData(); rstables = metaData.getTables(null, schemaPattern, "%", new String[]{ "TABLE" }); while (rstables.next()) { String schema = rstables.getString("TABLE_SCHEM"); String table = rstables.getString("TABLE_NAME"); String type = rstables.getString("TABLE_TYPE"); String remarks = rstables.getString("REMARKS"); getLog().debug("... found table " + schema + "." + table + " (" + type + ")..."); if (isToInclude(table)) { if (! isToExclude(table)) { getLog().debug("... processing..."); Table t = new Table(table, remarks); tables.add(t); } else { getLog().debug("... skipping due to 'excludes' pattern(s)"); } } else { getLog().debug("... skipping due to 'includes' pattern(s)"); } } getLog().info("... found to process " + tables.size() + " tables: " + tables); return tables; } catch (SQLException e) { throw new MojoExecutionException("Unable to generate database adapter due to a '" + e.getClass().getName() + "' with message '" + e.getMessage() + "'", e); } finally { if (rstables != null) { try { rstables.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 collectTables_returns2Tables() 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); Collection<Table> tables = generateMojo.collectTables(); assertEquals(2, tables.size()); }