On Thu, 26 Nov 2026 22:14:52 GMT, David Holmes <[email protected]> wrote:

> It is not generally appropriate to describe the lhs as "expected" and the rhs 
> as actual. 

This topic has been discussed ad nauseam over the years in the Java testing 
frameworks and wider afield in other languages and eco systems. JUnit, the most 
popular testing framework in the Java ecosystem, uses `assertEquals(expected, 
actual)`. There has been suggestions over the years to change it, I think 
rejected as Java developers have got used to the "spec before implementation" 
order. There's note somewhere from Ken Beck (one of the original JUnit folks) 
that they chose the order for readability when there are a lot of assertEquals 
in a test. TestNG and others use `assertEquals(actual, expected)`, something 
that comes up periodically here when JDK tests are migrated from TestNG to 
JUnit. Rust seems to use left and right. Pytest uses the assert statement.  The 
jdk.test.lib.Asserts class that used mostly by hotspot tests is left + right 
and not clear what the reason is for getting into the "positional ambiguity" 
debate now.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/34040#issuecomment-7213282599

Reply via email to