Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

💄 improve assertion error messages in DfsMazeSolverTest #473

Open
twentylemon opened this issue Feb 19, 2022 · 1 comment
Open

💄 improve assertion error messages in DfsMazeSolverTest #473

twentylemon opened this issue Feb 19, 2022 · 1 comment
Labels
formatting --- lipstick 💄 Improving the format/structure/layout of content/files

Comments

@twentylemon
Copy link
Collaborator

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 expected false to be true. The isIn assertion gives a message like expected blah to be equal to one of x, y, z, where it toStrings 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.

@twentylemon twentylemon added the formatting --- lipstick 💄 Improving the format/structure/layout of content/files label Feb 19, 2022
@jameshughes89
Copy link
Owner

AssertJ may make an entrance next year since, if simple unit testing is done in cs101, then adding more to the testing at this stage seems more doable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatting --- lipstick 💄 Improving the format/structure/layout of content/files
Projects
None yet
Development

No branches or pull requests

2 participants