jpountz commented on a change in pull request #769: LUCENE-8905: Better Error 
Handling For Illegal Arguments
URL: https://github.com/apache/lucene-solr/pull/769#discussion_r302182252
 
 

 ##########
 File path: 
lucene/core/src/test/org/apache/lucene/search/TestTopDocsCollector.java
 ##########
 @@ -179,6 +179,22 @@ public void testGetResultsFromStart() throws Exception {
     // get the last 5 only.
     assertEquals(5, tdc.topDocs(10).scoreDocs.length);
   }
+
+  public void testIllegalArguments() throws Exception {
+    final TopDocsCollector<ScoreDoc> tdc = doSearch(15);
+
+    IllegalArgumentException expected = 
expectThrows(IllegalArgumentException.class, () -> {
+      tdc.topDocs(20);
+    });
+
+    assertEquals(expected.getMessage(), "Illegal arguments when requesting top 
docs");
 
 Review comment:
   nit: Junit assumes that the expected value is the first argument and the 
second value is what the test produced. Swapping both would produce better 
error messages.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to