### Question:
FusionIndexReader extends FusionIndexBase<IndexReader> implements IndexReader { @Override public PrimitiveLongResourceIterator query( IndexQuery... predicates ) throws IndexNotApplicableKernelException { IndexSlot slot = slotSelector.selectSlot( predicates, IndexQuery::valueGroup ); return slot != null ? instanceSelector.select( slot ).query( predicates ) : concat( instanceSelector.transform( reader -> reader.query( predicates ) ) ); } FusionIndexReader( SlotSelector slotSelector, LazyInstanceSelector<IndexReader> instanceSelector, IndexDescriptor descriptor ); @Override void close(); @Override long countIndexedNodes( long nodeId, int[] propertyKeyIds, Value... propertyValues ); @Override IndexSampler createSampler(); @Override PrimitiveLongResourceIterator query( IndexQuery... predicates ); @Override void query( IndexProgressor.NodeValueClient cursor, IndexOrder indexOrder, boolean needsValues, IndexQuery... predicates ); @Override void distinctValues( IndexProgressor.NodeValueClient cursor, NodePropertyAccessor propertyAccessor, boolean needsValues ); @Override boolean hasFullValuePrecision( IndexQuery... predicates );  }### Answer:
@Test public void mustCombineResultFromExistsPredicate() throws Exception { IndexQuery.ExistsPredicate exists = IndexQuery.exists( PROP_KEY ); long lastId = 0; for ( IndexReader aliveReader : aliveReaders ) { when( aliveReader.query( exists ) ).thenReturn( PrimitiveLongResourceCollections.iterator( null, lastId++, lastId++ ) ); } LongIterator result = fusionIndexReader.query( exists ); LongSet resultSet = PrimitiveLongCollections.asSet( result ); for ( long i = 0L; i < lastId; i++ ) { assertTrue( "Expected to contain " + i + ", but was " + resultSet, resultSet.contains( i ) ); } }
@Test public void shouldInstantiatePartLazilyForSpecificValueGroupQuery() throws IndexNotApplicableKernelException { EnumMap<IndexSlot,Value[]> values = FusionIndexTestHelp.valuesByGroup(); for ( IndexSlot i : IndexSlot.values() ) { if ( readers.get( i ) != IndexReader.EMPTY ) { Value value = values.get( i )[0]; fusionIndexReader.query( IndexQuery.exact( 0, value ) ); for ( IndexSlot j : IndexSlot.values() ) { if ( readers.get( j ) != IndexReader.EMPTY ) { if ( i == j ) { verify( readers.get( i ) ).query( any( IndexQuery.class ) ); } else { verifyNoMoreInteractions( readers.get( j ) ); } } } } initiateMocks(); } }