zabetak commented on code in PR #4597:
URL: https://github.com/apache/calcite/pull/4597#discussion_r2460001919


##########
testkit/src/test/java/org/apache/calcite/test/DiffRepositoryTest.java:
##########
@@ -57,4 +57,21 @@ public class DiffRepositoryTest {
     }
     assertThat("First assertion must always fail", assertPassed, is(false));
   }
+
+  @Test void testOutOfOrderTestCases() {

Review Comment:
   I am wondering if it's safe to put this test together with the rest. Aren't 
we risking getting the ordering error on another test case of this class (e.g. 
testAssertEqualsUpdatesLogFileUponFailure)?



##########
testkit/src/test/java/org/apache/calcite/test/DiffRepositoryTest.java:
##########
@@ -57,4 +57,21 @@ public class DiffRepositoryTest {
     }
     assertThat("First assertion must always fail", assertPassed, is(false));
   }
+
+  @Test void testOutOfOrderTestCases() {
+    // testOutOfOrderTestCases is out-of-order in the XML (comes after testZ)
+    DiffRepository r = DiffRepository.lookup(DiffRepositoryTest.class);
+
+    IllegalArgumentException thrown = null;
+    try {
+      r.assertEquals("data", "data", "data");
+    } catch (IllegalArgumentException e) {
+      thrown = e;
+    }
+
+    // Verify that the out-of-order error was thrown
+    assert thrown != null : "Expected IllegalArgumentException for 
out-of-order test";

Review Comment:
   It's better to avoid Java assertions (i.e., `assert`) for validating 
expectations in unit tests. The APIs provided by testing frameworks (JUnit, 
etc.) are usually superior. There are various discussions about this online 
e.g: https://stackoverflow.com/questions/2966347/assert-vs-junit-assertions



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