Buggy code:
public class TestSpans extends LuceneTestCase { private IndexSearcher searcher ; public static final String field = "field" ; @ Override public void setUp ( ) throws Exception { } private String [ ] docFields = new String [ ] { "w1<seq2seq4repair_space>w2<seq2seq4repair_space>w3<seq2seq4repair_space>w4<seq2seq4repair_space>w5" , "w1<seq2seq4repair_space>w3<seq2seq4repair_space>w2<seq2seq4repair_space>w3" , "w1<seq2seq4repair_space>xx<seq2seq4repair_space>w2<seq2seq4repair_space>yy<seq2seq4repair_space>w3" , "w1<seq2seq4repair_space>w3<seq2seq4repair_space>xx<seq2seq4repair_space>w2<seq2seq4repair_space>yy<seq2seq4repair_space>w3" , "u2<seq2seq4repair_space>u2<seq2seq4repair_space>u1" , "u2<seq2seq4repair_space>xx<seq2seq4repair_space>u2<seq2seq4repair_space>u1" , "u2<seq2seq4repair_space>u2<seq2seq4repair_space>xx<seq2seq4repair_space>u1" , "u2<seq2seq4repair_space>xx<seq2seq4repair_space>u2<seq2seq4repair_space>yy<seq2seq4repair_space>u1" , "u2<seq2seq4repair_space>xx<seq2seq4repair_space>u1<seq2seq4repair_space>u2" , "u2<seq2seq4repair_space>u1<seq2seq4repair_space>xx<seq2seq4repair_space>u2" , "u1<seq2seq4repair_space>u2<seq2seq4repair_space>xx<seq2seq4repair_space>u2" , "t1<seq2seq4repair_space>t2<seq2seq4repair_space>t1<seq2seq4repair_space>t3<seq2seq4repair_space>t2<seq2seq4repair_space>t3" } ; public SpanTermQuery makeSpanTermQuery ( String text ) { } private void checkHits ( Query query , int [ ] results ) throws IOException { } private void orderedSlopTest3SQ ( SpanQuery q1 , SpanQuery q2 , SpanQuery q3 , int slop , int [ ] expectedDocs ) throws IOException { } public void orderedSlopTest3 ( int slop , int [ ] expectedDocs ) throws IOException { } public void orderedSlopTest3Equal ( int slop , int [ ] expectedDocs ) throws IOException { } public void orderedSlopTest1Equal ( int slop , int [ ] expectedDocs ) throws IOException { } public void testSpanNearOrdered01 ( ) throws Exception { } public void testSpanNearOrdered02 ( ) throws Exception { } public void testSpanNearOrdered03 ( ) throws Exception { } public void testSpanNearOrdered04 ( ) throws Exception { } public void testSpanNearOrdered05 ( ) throws Exception { } public void testSpanNearOrderedEqual01 ( ) throws Exception { } public void testSpanNearOrderedEqual02 ( ) throws Exception { } public void testSpanNearOrderedEqual03 ( ) throws Exception { } public void testSpanNearOrderedEqual04 ( ) throws Exception { } public void testSpanNearOrderedEqual11 ( ) throws Exception { } public void testSpanNearOrderedEqual12 ( ) throws Exception { } public void testSpanNearOrderedEqual13 ( ) throws Exception { } public void testSpanNearOrderedEqual14 ( ) throws Exception { } public void testSpanNearOrderedEqual15 ( ) throws Exception { } public void testSpanNearOrderedOverlap ( ) throws Exception { } public void testSpanNearUnOrdered ( ) throws Exception { } private Spans orSpans ( String [ ] terms ) throws Exception { } private void tstNextSpans ( Spans spans , int doc , int start , int end ) throws Exception { } public void testSpanOrEmpty ( ) throws Exception { } public void testSpanOrSingle ( ) throws Exception { } public void testSpanOrMovesForward ( ) throws Exception { } public void testSpanOrDouble ( ) throws Exception { } public void testSpanOrDoubleSkip ( ) throws Exception { } public void testSpanOrUnused ( ) throws Exception { } public void testSpanOrTripleSameDoc ( ) throws Exception { } public void testSpanScorerZeroSloppyFreq ( ) throws Exception { } private void addDoc ( IndexWriter writer , String id , String text ) throws IOException { } private int hitCount ( Searcher searcher , String word ) throws Throwable { } private SpanQuery createSpan ( String value ) { } private SpanQuery createSpan ( int slop , boolean ordered , SpanQuery [ ] clauses ) { } private SpanQuery createSpan ( int slop , boolean ordered , String term1 , String term2 ) { } public void testNPESpanQuery ( ) throws Throwable { final Directory dir = new MockRAMDirectory ( ) ; <START_BUG> final IndexWriter writer = new IndexWriter ( dir , new org . apache . lucene . analysis . standard . StandardAnalyzer ( Version . LUCENE_CURRENT , Collections . emptySet ( ) ) , MaxFieldLength . LIMITED ) ; <END_BUG> addDoc ( writer , "1" , "the<seq2seq4repair_space>big<seq2seq4repair_space>dogs<seq2seq4repair_space>went<seq2seq4repair_space>running<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>market" ) ; addDoc ( writer , "2" , "the<seq2seq4repair_space>cat<seq2seq4repair_space>chased<seq2seq4repair_space>the<seq2seq4repair_space>mouse,<seq2seq4repair_space>then<seq2seq4repair_space>the<seq2seq4repair_space>cat<seq2seq4repair_space>ate<seq2seq4repair_space>the<seq2seq4repair_space>mouse<seq2seq4repair_space>quickly" ) ; writer . close ( ) ; final IndexReader reader = IndexReader . open ( dir , true ) ; final IndexSearcher searcher = new IndexSearcher ( reader ) ; assertEquals ( 2 , hitCount ( searcher , "the" ) ) ; assertEquals ( 1 , hitCount ( searcher , "cat" ) ) ; assertEquals ( 1 , hitCount ( searcher , "dogs" ) ) ; assertEquals ( 0 , hitCount ( searcher , "rabbit" ) ) ; assertEquals ( 1 , searcher . search ( createSpan ( 0 , true , new SpanQuery [ ] { createSpan ( 4 , false , "chased" , "cat" ) , createSpan ( "ate" ) } ) , 10 ) . totalHits ) ; reader . close ( ) ; dir . close ( ) ; } }

Fix:
final IndexWriter writer = new IndexWriter ( dir , new org . apache . lucene . analysis . standard . StandardAnalyzer ( TEST_VERSION_CURRENT , Collections . emptySet ( ) ) , MaxFieldLength . LIMITED ) ;