jpountz commented on code in PR #13785: URL: https://github.com/apache/lucene/pull/13785#discussion_r1760649790
########## lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinBulkScorer.java: ########## @@ -283,7 +292,33 @@ public void collect(int doc) throws IOException { null, 0, NO_MORE_DOCS); - assertEquals(expectedScores, actualScores); + + if (expectedScoresList.size() == 1) { + assertEquals(expectedScoresList.getFirst(), actualScores); + } else { + assertEqualsToOneOf(expectedScoresList, actualScores); + } + } + + private static void assertEqualsToOneOf(List<?> expectedList, Object actual) { + boolean foundMatch = false; + for (Object expected : expectedList) { + if (expected == null) { + if (actual == null) { + foundMatch = true; + break; + } + } else { + foundMatch = expected.equals(actual); + if (foundMatch) { + break; + } + } Review Comment: nit: maybe merge these two conditions under a single `if (Objects.equals(expected, actual))` which would take care of the `null` case? ########## lucene/join/src/test/org/apache/lucene/search/join/TestBlockJoinBulkScorer.java: ########## @@ -283,7 +292,33 @@ public void collect(int doc) throws IOException { null, 0, NO_MORE_DOCS); - assertEquals(expectedScores, actualScores); + + if (expectedScoresList.size() == 1) { + assertEquals(expectedScoresList.getFirst(), actualScores); + } else { + assertEqualsToOneOf(expectedScoresList, actualScores); + } Review Comment: I'm curious why you don't call `assertEqualsToOneOf` all the time, shouldn't it also work in the size==1 case? -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org