💄 improve assertion error messages in DfsMazeSolverTest
#473
Labels
formatting --- lipstick 💄
Improving the format/structure/layout of content/files
DfsMazeSolverTest
#473
What
Replacing assertions like
assertTrue(solution.equals(x) || solution.equals(y))
with assertions that give more information when they fail. AssertJ's isIn would be ideal, or at least recreating that type of assertion.Why
Tests are substantially more useful when they give information on why they failed. Assertions like
assertTrue
are black holes. The message you get for failures is expectedfalse
to betrue
. TheisIn
assertion gives a message like expectedblah
to be equal to one ofx
,y
,z
, where ittoString
s each of the values. It tells you exactly the expectation, and what you actually gave it.Where
DfsMazeSolverTest
How
Given it's unlikely to onboard AssertJ, simply adding a custom message to the existing assertions is probably sufficient.
The text was updated successfully, but these errors were encountered: