Skip to content

Commit 8667726

Browse files
committed
Don't need real LeafReaderContext in test any more
1 parent a5b9f18 commit 8667726

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhaseTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
package org.elasticsearch.search.fetch.subphase;
1010

11-
import org.apache.lucene.index.LeafReaderContext;
12-
import org.apache.lucene.index.memory.MemoryIndex;
1311
import org.elasticsearch.common.Strings;
1412
import org.elasticsearch.common.bytes.BytesReference;
1513
import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -147,14 +145,10 @@ private HitContext hitExecuteMultiple(XContentBuilder source, boolean fetchSourc
147145
when(fetchContext.getSearchExecutionContext()).thenReturn(sec);
148146

149147
final SearchHit searchHit = new SearchHit(1, null, nestedIdentity, null, null);
150-
151-
// We don't need a real index, just a LeafReaderContext which cannot be mocked.
152-
MemoryIndex index = new MemoryIndex();
153-
LeafReaderContext leafReaderContext = index.createSearcher().getIndexReader().leaves().get(0);
154148
ValuesLookup valuesLookup = source == null
155149
? ValuesLookup.sourceOnly(Collections.emptyMap())
156150
: ValuesLookup.sourceOnly(BytesReference.bytes(source));
157-
HitContext hitContext = new HitContext(searchHit, valuesLookup, leafReaderContext, 1);
151+
HitContext hitContext = new HitContext(searchHit, valuesLookup, null, 1);
158152

159153
FetchSourcePhase phase = new FetchSourcePhase();
160154
FetchSubPhaseProcessor processor = phase.getProcessor(fetchContext);

0 commit comments

Comments
 (0)