dweiss commented on code in PR #12982: URL: https://github.com/apache/lucene/pull/12982#discussion_r1437755617
########## lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java: ########## @@ -685,8 +669,8 @@ public void testMultipleSegments() throws Exception { PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "abc_")); TopSuggestDocs suggest = - indexSearcher.suggest(query, (entries.size() == 0) ? 1 : entries.size(), false); - assertSuggestions(suggest, entries.toArray(new Entry[entries.size()])); + indexSearcher.suggest(query, entries.isEmpty() ? 1 : entries.size(), false); + assertSuggestions(suggest, entries.toArray(new Entry[0])); Review Comment: The same? ########## lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java: ########## @@ -485,7 +470,7 @@ public void testNRTDeletedDocFiltering() throws Exception { PrefixCompletionQuery query = new PrefixCompletionQuery(analyzer, new Term("suggest_field", "abc_")); TopSuggestDocs suggest = indexSearcher.suggest(query, numLive, false); - assertSuggestions(suggest, expectedEntries.toArray(new Entry[expectedEntries.size()])); + assertSuggestions(suggest, expectedEntries.toArray(new Entry[0])); Review Comment: This is a weird idiom. Could we use the Entry::new instead? It's short and, I think, more intuitive. ########## lucene/suggest/src/test/org/apache/lucene/search/suggest/document/TestSuggestField.java: ########## @@ -766,12 +749,12 @@ public void testScoring() throws Exception { assertTrue(topScore >= scoreDoc.score); } topScore = scoreDoc.score; - assertThat((float) mappings.get(scoreDoc.key.toString()), equalTo(scoreDoc.score)); + assertEquals(scoreDoc.score, (float) mappings.get(scoreDoc.key.toString()), 1.0e-8); Review Comment: I'm not a fan of those magic constants or deltas in assertions in particular... Maybe it'd be better to add assertEquals(float, float) to LuceneTestCase and do a Float.compare assertion there (with proper exception in case of a mismatch)? -- 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