### Question:
AnalyzingQuerqyParser implements QuerqyParser { @Override public Query parse(String input) { checkNotNull(input); try (TokenStream queryTokens = queryAnalyzer.tokenStream("querqy", new CharSequenceReader(input))) { Query query = new Query(); queryTokens.reset(); CharTermAttribute original = queryTokens.addAttribute(CharTermAttribute.class); while (queryTokens.incrementToken()) { DisjunctionMaxQuery dmq = new DisjunctionMaxQuery(query, Occur.SHOULD, false); dmq.addClause(new Term(dmq, original.toString())); query.addClause(dmq); if (optSynonymAnalyzer != null) { addSynonyms(dmq, original); } } queryTokens.end(); if (query.getClauses().isEmpty()) { DisjunctionMaxQuery dmq = new DisjunctionMaxQuery(query, Occur.SHOULD, false); dmq.addClause(new Term(dmq, input)); query.addClause(dmq); } return query; } catch (IOException e) { throw new RuntimeException(e); } } AnalyzingQuerqyParser(Analyzer queryAnalyzer, Analyzer optSynonymAnalyzer); @Override Query parse(String input); static void checkNotNull(Object obj);  }### Answer:
@Test public void parse_withoutSynonyms() { QuerqyParser parser = new AnalyzingQuerqyParser(queryAnalyzer, null); Query query = parser.parse("test dummy"); assertThat(query, bq(dmq(term("test")), dmq(term("dummy")))); }
@Test public void parse_withSynonyms() { QuerqyParser parser = new AnalyzingQuerqyParser(queryAnalyzer, synonymAnalyzer); Query query = parser.parse("test dummy"); assertThat(query, bq(dmq(term("test"), term("synonym1"), term("synonym2")), dmq(term("dummy")))); }