Lately, when writing JUnit tests I’ve been doing things like:
... String result = some.method(); assertTrue("Expected " + expected + " but was " + result, result.equals(expected)); ...
However, a similar result can be achieved with the semantically more accurate
... assertEquals(expected, result); ...
This is even easier to type
I did know this, honest!
You must be logged in to post a comment.
Tip for a forgetful software developer
Lately, when writing JUnit tests I’ve been doing things like:
However, a similar result can be achieved with the semantically more accurate
This is even easier to type
I did know this, honest!