gnodet-bot commented on code in PR #2356:
URL: https://github.com/apache/maven-resolver/pull/2356#discussion_r4720097926


##########
maven-resolver-util/src/test/java/org/eclipse/aether/util/version/GenericVersionTest.java:
##########
@@ -36,9 +38,18 @@ protected Version newVersion(String version) {
         return new GenericVersion(version);
     }
 
-    @Test
-    void testEmptyVersion() {
-        assertOrder(X_EQ_Y, "0", "");
+    @ParameterizedTest(name = "{0}: {1} {2} {3}")
+    @CsvFileSource(resources = "/version-comparison.csv", encoding = "UTF-8", 
numLinesToSkip = 1)
+    void testVersionComparisons(String testCase, String left, String operator, 
String right) {
+        int expected;
+        if ("LT".equals(operator)) {
+            expected = X_LT_Y;
+        } else if ("GT".equals(operator)) {
+            expected = X_GT_Y;
+        } else {
+            expected = X_EQ_Y;
+        }

Review Comment:
   The `else` branch silently maps any unrecognized operator to `X_EQ_Y`. A CSV 
typo (e.g. `eq` instead of `EQ`, or a stray value) would cause the test to pass 
with `EQ` semantics rather than fail with a clear error, masking bad test data.
   
   ```suggestion
           } else if ("EQ".equals(operator)) {
               expected = X_EQ_Y;
           } else {
               Assertions.fail("Unknown operator: " + operator);
               return;
           }
   ```



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

Reply via email to