DdlParsers { public AstNode parseUsing( final String ddl, final String parserId ) throws ParsingException { CheckArg.isNotEmpty(ddl, "ddl"); CheckArg.isNotEmpty(parserId, "parserId"); DdlParser parser = getParser(parserId); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(parserId)); } AstNode astRoot = createDdlStatementsContainer(parserId); parser.parse(ddl, astRoot, null); return astRoot; } DdlParsers();  DdlParsers( List<DdlParser> parsers ); DdlParser getParser( final String id ); Set<DdlParser> getParsers(); AstNode parseUsing( final String ddl,
                               final String parserId ); List<ParsingResult> parseUsing( final String ddl,
                                           final String firstParserId,
                                           final String secondParserId,
                                           final String... additionalParserIds ); List<ParsingResult> parseUsingAll( final String ddl ); AstNode parse( final String ddl,
                          final String fileName ); static final List<DdlParser> BUILTIN_PARSERS; }
@Test( expected = ParsingException.class ) public void shouldErrorWhenInvalidParserId() { final String content = getFileContent(DDL_TEST_FILE_PATH + "dialect/derby/derby_test_statements.ddl"); this.parsers.parseUsing(content, "BOGUS"); }
@Test public void shouldReturnCorrectNumberOfResults() { printTest("shouldReturnCorrectNumberOfResults()"); final List<DdlParser> myParsers = new ArrayList<DdlParser>(2); myParsers.add(new PostgresDdlParser()); myParsers.add(new OracleDdlParser()); final DdlParsers ddlParsers = new DdlParsers(myParsers); final String ddl = getFileContent(DDL_TEST_FILE_PATH + "dialect/oracle/oracle_test_statements_3.ddl"); final List<ParsingResult> results = ddlParsers.parseUsing(ddl, myParsers.get(0).getId(), myParsers.get(1).getId(), (String[])null); assertThat(results.size(), is(myParsers.size())); }