stefanvodita commented on code in PR #13418:
URL: https://github.com/apache/lucene/pull/13418#discussion_r1619076421


##########
lucene/core/src/test/org/apache/lucene/document/TestIntRange.java:
##########
@@ -23,4 +23,16 @@ public void testToString() {
     IntRange range = new IntRange("foo", new int[] {1, 11, 21, 31}, new int[] 
{2, 12, 22, 32});
     assertEquals("IntRange <foo: [1 : 2] [11 : 12] [21 : 22] [31 : 32]>", 
range.toString());
   }
+
+  public void testInvalidRangeInput() {
+    String actualMessage = "";
+    try {
+      IntRange range = new IntRange("foo", new int[] {-1, 11, 21, 31}, new 
int[] {-3, 12, 22, 32});
+      range.toString();

Review Comment:
   This doesn't run, right? The exception is thrown from the constructor call.



##########
lucene/core/src/test/org/apache/lucene/document/TestIntRange.java:
##########
@@ -23,4 +23,16 @@ public void testToString() {
     IntRange range = new IntRange("foo", new int[] {1, 11, 21, 31}, new int[] 
{2, 12, 22, 32});
     assertEquals("IntRange <foo: [1 : 2] [11 : 12] [21 : 22] [31 : 32]>", 
range.toString());
   }
+
+  public void testInvalidRangeInput() {
+    String actualMessage = "";
+    try {
+      IntRange range = new IntRange("foo", new int[] {-1, 11, 21, 31}, new 
int[] {-3, 12, 22, 32});
+      range.toString();
+    } catch (IllegalArgumentException exception) {
+      actualMessage = exception.getMessage();
+    }
+    String expectedMessage = "min value (-1) is greater than max value (-3)";

Review Comment:
   There are several different `InvalidArgumentException`s. Why are we 
targeting this specific one?



-- 
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

Reply via email to