### Question:
BooleanQuery extends SubQuery<BooleanParent, BooleanClause> implements DisjunctionMaxClause,
      BooleanClause, BooleanParent, QuerqyQuery<BooleanParent> { @Override public BooleanQuery clone(final BooleanParent newParent) { return clone(newParent, this.occur, this.generated); } BooleanQuery(final BooleanParent parentQuery, final Occur occur, final boolean generated); @Override T accept(final NodeVisitor<T> visitor); @Override String toString(); @Override BooleanQuery clone(final BooleanParent newParent); @Override BooleanQuery clone(final DisjunctionMaxQuery newParent, boolean generated); @Override BooleanClause clone(final BooleanQuery newParent); @Override BooleanQuery clone(final BooleanParent newParent, final boolean generated); @Override BooleanClause clone(final BooleanQuery newParent, final boolean generated); @Override BooleanClause clone(final BooleanQuery newParent, final Occur occur); @Override BooleanClause clone(final BooleanQuery newParent, final Occur occur, final boolean generated); BooleanQuery clone(final BooleanParent newParent, final Occur occur, final boolean generated); @Override void removeClauseAndTraverseTree(final BooleanClause clause); @Override void removeClauseAndTraverseTree(final BooleanQuery clause);  }### Answer:
@Test public void testThatClonePreservesGeneratedAndOccur() throws Exception { BooleanQuery bq = new BooleanQuery(null, MUST_NOT, true); final BooleanClause clone = bq.clone(null); assertEquals(MUST_NOT, clone.getOccur()); assertTrue(clone.isGenerated()); }
@Test public void testThatGeneratedIsPropagatedToClauses() throws Exception { BooleanQuery bq = new BooleanQuery(null, SHOULD, false); DisjunctionMaxQuery dmq = new DisjunctionMaxQuery(bq, Clause.Occur.SHOULD, false); bq.addClause(dmq); dmq.addClause(new Term(dmq, "Test", false)); final BooleanQuery clone = (BooleanQuery) bq.clone(null, MUST, true); assertThat(clone, bq(must(), dmq(should(), term("Test", true)))); assertTrue(clone.isGenerated()); assertTrue(clone.getClauses().get(0).isGenerated()); assertEquals(MUST, clone.getOccur()); }