Schamschi commented on issue #48: [WIP] perform the actual migration to JUnit 5
URL: https://github.com/apache/commons-numbers/pull/48#issuecomment-500170979
 
 
   @grimreaper 
   > what do you think about static imports for "assertEquals" and friends?
   
   I just stumbled upon a curiosity in the class `TestUtils` of the 
`commons-numbers-core` module, which I've overlooked in my last commit. From 
looking at the first two methods `TestUtils.assertEquals(double, double, 
double)` and `TestUtils.assertEquals(String, double, double, double)`, it seems 
to me that the `assertEquals` method invoked in `TestUtils.assertEquals(double, 
double, double)` should actually be the one from `TestUtils`, and not the one 
from `Assert`. Maybe this was originally so, and then somebody carelessly 
refactored the method to invoke the respective method from `Assert` (it's 
impossible to tell from the commit history).
   
   I'm not sure if this is an argument against static imports, but in this 
specific situation, static imports would certainly have caused confusion. Also, 
I'm not sure whether replacing the explicit `Assert`/`Assertions` references 
with static imports is within the scope of this branch. I could imagine that 
the commit history would be easier to follow if we just convert everything from 
JUnit 4 to its closest JUnit 5 equivalent without changing more than necessary 
in this branch, and changing things like static imports or replacing 
try-catch-constructs with assertThrows not before the migration is completely 
performed.
   
   Ironically, the aforementioned `assertEquals` methods declared in 
`TestUtils` are completely pointless anyway, because the `assertEquals` methods 
from JUnit4 `Assert`, as well as from JUnit5 `Assertions` already consider two 
NaN `double`s equal, so they behave exactly like these methods in `TestUtils`. 
But then again, fixing this might be outside the scope of this branch.

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

Reply via email to