dweiss commented on code in PR #975:
URL: https://github.com/apache/lucene/pull/975#discussion_r906645910
##########
lucene/analysis/common/src/test/org/apache/lucene/analysis/hunspell/TestHunspell.java:
##########
@@ -134,4 +138,32 @@ private Hunspell loadNoTimeout(String name) throws
Exception {
Dictionary dictionary = loadDictionary(false, name + ".aff", name +
".dic");
return new Hunspell(dictionary, TimeoutPolicy.NO_TIMEOUT, () -> {});
}
+
+ @Test
+ public void testExpandRootApi() throws Exception {
+ Hunspell h = loadNoTimeout("base");
+ String[] createFormsBase = {
+ "create", "created", "creates", "creating", "creation", "creations"
+ };
+ List<String> expected =
+ Stream.concat(
+ Stream.of(createFormsBase).flatMap(s -> Stream.of(s, "pro" +
s, "re" + s)),
+ Stream.of("creative"))
+ .sorted()
+ .toList();
+
+ Map<String, AffixedWord> expanded =
+ TestSpellChecking.checkExpansionGeneratesCorrectWords(h, "create",
"base").stream()
+ .collect(Collectors.toMap(w -> w.getWord(), w -> w));
+ assertEquals(expected, expanded.keySet().stream().sorted().toList());
Review Comment:
Yeah... I like assertj for this reason more.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]