### Question:
QueryAnalyzer { public Set<QueryTerm> collectTerms(QueryTree queryTree) { Set<QueryTerm> terms = new HashSet<>(); queryTree.collectTerms(terms); return terms; } QueryAnalyzer(List<QueryTreeBuilder<?>> queryTreeBuilders);  QueryAnalyzer(QueryTreeBuilder<?>... queryTreeBuilders); static QueryAnalyzer fromComponents(PresearcherComponent... components); @SuppressWarnings("unchecked") QueryTree buildTree(Query luceneQuery, TermWeightor weightor); QueryTreeBuilder getTreeBuilderForQuery(Class<? extends Query> queryClass); Set<QueryTerm> collectTerms(QueryTree queryTree); Set<QueryTerm> collectTerms(Query luceneQuery, TermWeightor weightor);  }### Answer:
@Test public void testDisjunctionsWithAnyClausesOnlyReturnANYTOKEN() throws Exception { Query q = ParserUtils.parse("hello goodbye (*:* -term)"); assertThat(analyzer.collectTerms(q, WEIGHTOR)) .extracting("type") .containsOnly(QueryTerm.Type.ANY); }
@Test public void testMinWeightAdvances() { QueryTree tree = DisjunctionNode.build( ConjunctionNode.build( new TermNode(new QueryTerm("field", "term1", QueryTerm.Type.EXACT), 1), new TermNode(new QueryTerm("field", "term2", QueryTerm.Type.EXACT), 0.1), new AnyNode("*:*") ), ConjunctionNode.build( DisjunctionNode.build( new TermNode(new QueryTerm("field", "term4", QueryTerm.Type.EXACT), 0.2), new TermNode(new QueryTerm("field", "term5", QueryTerm.Type.EXACT), 1) ), new TermNode(new QueryTerm("field", "term3", QueryTerm.Type.EXACT), 0.5) ) ); assertThat(analyzer.collectTerms(tree)) .extracting("term") .containsOnly(new Term("field", "term1"), new Term("field", "term3")); assertTrue(tree.advancePhase(0.1f)); assertThat(analyzer.collectTerms(tree)) .extracting("term") .containsOnly(new Term("field", "term1"), new Term("field", "term4"), new Term("field", "term5")); assertFalse(tree.advancePhase(0.1f)); }