This is why I do PREDICTIVE TDD and made it a core of JitterTed's TDD Game. It's saved me time troubleshooting the wrong problem. (On today's stream, this happened 5 times!)
Attending JCON Europe or COMO Camp? Save shipping: I can personally deliver it!
Yes.
*And Also*
Read the exception error message carefully.
Is it readable?
Easily?
Well formatted?
And, most importantly …
If/when it throws this months or years later, does it give us enough information to track down and fix the error without too much additional effort?
…
(And we didn't get the 'assertEquals' parameters in the wrong order again, did we? 🙄 )
Exactly. How can you tell if failed as desired/expected if you can’t understand the failure message.
And, as you say, later you won’t have the context you have now, so make it extra obvious what the failure is.
(Using AssertJ means one never gets assertion parameters out of order.)
All new tests are supposed to fail. It's when they pass that you should get worried!
(But yeah, check that it's failing for the right reason...)