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

detect expectations that don't match something #70

Open
christophsturm opened this issue Aug 13, 2018 · 3 comments
Open

detect expectations that don't match something #70

christophsturm opened this issue Aug 13, 2018 · 3 comments
Labels
🦄 enhancement New feature or request

Comments

@christophsturm
Copy link
Contributor

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.

@schoepke
Copy link

+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 ...

@robfletcher robfletcher added the 🦄 enhancement New feature or request label Aug 15, 2018
@robfletcher
Copy link
Owner

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.

@christophsturm
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🦄 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants