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