QueryParsers { public QueryCommand parse( TypeSystem typeSystem, String language, String query ) { CheckArg.isNotNull(language, "language"); CheckArg.isNotNull(typeSystem, "typeSystem"); CheckArg.isNotNull(query, "query"); QueryParser parser = parsers.get(language.trim().toLowerCase()); if (parser == null) { throw new IllegalArgumentException(GraphI18n.unknownQueryLanguage.text(language)); } return parser.parseQuery(query, typeSystem); } QueryParsers( QueryParser... parsers );  QueryParsers( Iterable<QueryParser> parsers ); void addLanguage( QueryParser languageParser ); void addLanguages( QueryParser firstLanguage,
                              QueryParser... additionalLanguages ); void addLanguages( Iterable<QueryParser> languages ); QueryParser removeLanguage( String language ); Collection<QueryParser> removeLanguages( String firstLanguage,
                                                    String... additionalLanguages ); Set<String> getLanguages(); QueryParser getParserFor( String language ); QueryCommand parse( TypeSystem typeSystem,
                               String language,
                               String query ); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString();  }
@Test( expected = IllegalArgumentException.class ) public void shouldFailToParseUnknownLanguage() { TypeSystem typeSystem = new ExecutionContext().getValueFactories().getTypeSystem(); parsers.parse(typeSystem, "unknown language", "This is a bogus query"); }