### Question:
OrSpanQuery extends SpanQuery implements Cloneable { @Override public void setAncestorPointer(final NodeQuery ancestor) { super.setAncestorPointer(ancestor); for (SpanQuery clause : clauses) { clause.setAncestorPointer(ancestor); } } OrSpanQuery();  OrSpanQuery(final SpanQuery... clauses); @Override void setLevelConstraint(final int levelConstraint); @Override void setNodeConstraint(final int lowerBound, final int upperBound); @Override void setAncestorPointer(final NodeQuery ancestor); final void addClause(SpanQuery clause); SpanQuery[] getClauses(); @Override Weight createWeight(final IndexSearcher searcher); @Override void extractTerms(final Set<Term> terms); @Override String toString(final String field); @Override OrSpanQuery clone(); @Override Query rewrite(final IndexReader reader); @Override boolean equals(final Object o); @Override int hashCode();  }### Answer:
@Test public void testSetAncestorPointer() { NodeSpanQuery term1 = new NodeSpanQuery(ntq("aaa").getQuery()); NodeSpanQuery term2 = new NodeSpanQuery(ntq("bbb").getQuery()); OrSpanQuery or1 = new OrSpanQuery(new SpanQuery[] {term1, term2}); final TwigQuery twig = new TwigQuery(); or1.setAncestorPointer(twig); assertSame(twig, or1.getAncestorPointer()); assertSame(twig, term1.getAncestorPointer()); NodeSpanQuery term3 = new NodeSpanQuery(ntq("aaa").getQuery()); or1.addClause(term3); assertSame(twig, term3.getAncestorPointer()); }