Open christophsturm opened 6 years ago
+1 from my side, as this happened to me several times (with another fluent lib). It would be nice if strikt could tell the tester that he's shooting his own foot in such cases ...
Never trust a test you have never seen fail!
Seriously, though. I think it's a good suggestion. I'm not sure how it could be implemented right now. I'd need to somehow detect that no methods were ever called on the Assertion.Builder
returned by expect
.
it probably would need to be test runner specific. all expectations in a test case need to be registered and then checked afterwards. or you could use a threadlocal where each expect checks that the expect before it had a check.
one downside of fluent assertion libs like strikt compared to simple assertEquals(a,b) is that its possible to write assertions that can never fail.
for example this code that tries to assert on a jackson property:
expect(offer.has("id"))
it would be great if we could find a way that can potentially find such asserts, possibly at runtime.