That section referred to the implementation detail testing: assertion of how the software works instead of what it does. The getUser method can be implemented differently. For example, in the future, you may decide that you can resolve the user from elsewhere than sessions (abstract examples). If your test checks that lookupSessionsmust be called, the test would fail, while the functionality remains.
The goal of any test is to verify the intention behind the implementation, but not the implementation itself. Relying on the latter is often what makes tests brittle, and, most importantly, useless when refactoring.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, Alexander! Thank you for spotting the typo!
That section referred to the implementation detail testing: assertion of how the software works instead of what it does. The
getUser
method can be implemented differently. For example, in the future, you may decide that you can resolve the user from elsewhere than sessions (abstract examples). If your test checks thatlookupSessions
must be called, the test would fail, while the functionality remains.The goal of any test is to verify the intention behind the implementation, but not the implementation itself. Relying on the latter is often what makes tests brittle, and, most importantly, useless when refactoring.