AbstractQueryBuilderFactory { public void addRuleParserAt(IRuleParser parser, Class<? extends IRuleParser> atParser) { int index = getIndexOfClass(ruleParsers, atParser); if (index == -1) { throw new ParserAddException("parser " + atParser.getSimpleName() + " has not been added"); } ruleParsers.remove(index); ruleParsers.add(index, parser); } AbstractQueryBuilderFactory(); abstract AbstractBuilder builder(); void addFilter(IRuleFilter filter); void addFilterBefore(IRuleFilter filter, Class<? extends IRuleFilter> beforeFilter); void addFilterAfter(IRuleFilter filter, Class<? extends IRuleFilter> afterFilter); void addFilterAt(IRuleFilter filter, Class<? extends IRuleFilter> atFilter); void addRuleParser(IRuleParser parser); void addRuleParserBefore(IRuleParser parser, Class<? extends IRuleParser> beforeParser); void addRuleParserAfter(IRuleParser parser, Class<? extends IRuleParser> afterParser); void addRuleParserAt(IRuleParser parser, Class<? extends IRuleParser> atParser); List<IRuleFilter> getFilters(); List<IRuleParser> getRuleParsers(); IGroupParser getGroupParser(); void setGroupParser(IGroupParser groupParser);  }
@Test(expected = ParserAddException.class) public void addParserAtUnknownClass() throws Exception { AbstractQueryBuilderFactory factory = new SqlQueryBuilderFactory(); factory.addRuleParserAt(testParser, Test2Parser.class); }