Reputation: 470
Why is assertEquals(double,double) no longer deprecated in JUnit 5?
Upvotes: 0
Views: 185
Reputation: 5351
Jupiter has both, an assert method to compare two doubles exactly and one to compare them with a given delta. You usually want the latter if any kind of calculation is involved that might come with rounding errors. Sometimes, however, you want to make sure that a calculation has an exact result; that’s when ˋassertEquals(double, double)ˋ comes in handy.
The danger of having this method is that people might confuse the two use cases and use exact comparison when delta comparison would be the better choice. The designers of JUnit 4 considered that risk to be dangerous enough to steer users away from it. The devs of Jupiter made a different judgement call.
Upvotes: 1