diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestHunspell.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestHunspell.java index f7170bc80e2..d7bf91f8c21 100644 --- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestHunspell.java +++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestHunspell.java @@ -166,7 +166,10 @@ public class TestHunspell extends LuceneTestCase { } private Hunspell loadNoTimeout(String name) throws Exception { - Dictionary dictionary = loadDictionary(false, name + ".aff", name + ".dic"); + return loadNoTimeout(loadDictionary(false, name + ".aff", name + ".dic")); + } + + private static Hunspell loadNoTimeout(Dictionary dictionary) { return new Hunspell(dictionary, TimeoutPolicy.NO_TIMEOUT, () -> {}); } @@ -265,8 +268,8 @@ public class TestHunspell extends LuceneTestCase { assertFalse(new Hunspell(small).spell(original)); - List smallSug = new Hunspell(small).suggest(original); - List largerSug = new Hunspell(larger).suggest(original); + List smallSug = loadNoTimeout(small).suggest(original); + List largerSug = loadNoTimeout(larger).suggest(original); assertEquals(smallSug.toString(), 4, smallSug.size()); assertEquals(smallSug, largerSug); }