Fix and simplify the test (#11734).

This commit is contained in:
Dawid Weiss 2022-09-24 12:51:01 +02:00
parent 188a78d769
commit 8bdfa90ea9
1 changed files with 2 additions and 7 deletions

View File

@ -20,8 +20,6 @@ package org.apache.lucene.analysis.opennlp;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.stream.Collectors;
import org.apache.lucene.analysis.custom.CustomAnalyzer;
import org.apache.lucene.analysis.miscellaneous.KeywordRepeatFilterFactory;
import org.apache.lucene.analysis.miscellaneous.RemoveDuplicatesTokenFilterFactory;
@ -332,11 +330,8 @@ public class TestOpenNLPLemmatizerFilterFactory extends BaseTokenStreamTestCase
earlyExitOutput = loader.openResource("data/early-exit-bug-output.txt");
String earlyExitOutputText =
new String(earlyExitOutput.readAllBytes(), StandardCharsets.UTF_8);
String[] earlyExitOutputTexts =
Arrays.stream(earlyExitOutputText.split("\\s"))
.filter(text -> text != "")
.collect(Collectors.joining(" "))
.split(" ");
String[] earlyExitOutputTexts = earlyExitOutputText.split("[\\s\\r\\n]+");
CustomAnalyzer analyzer =
CustomAnalyzer.builder(new ClasspathResourceLoader(getClass()))
.withTokenizer(