-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Verify after ThenReturn does not seem to work with Never() #83
Comments
Unfortunately, I cannot reproduce this behaviour.
Example above works as expected and fails with error:
Can you please provide fully reproducible example of you behaviour? |
Ah, sorry, I believe this is due to the use of StrictVerify. As described in its comment:
This is what adds the e.g. this passes: func TestVerifyNeverInReturner(t *testing.T) {
SetUp(t)
m := Mock[iface]()
WhenSingle(m.Foo(12)).Verify(Never())
} While this fails: func TestVerifyNeverInReturner(t *testing.T) {
- SetUp(t)
+ SetUp(t, mockopts.StrictVerify())
m := Mock[iface]()
WhenSingle(m.Foo(12)).Verify(Never())
}
I can see how this might be a bit of an annoying edge case to support when using |
I see the problem now.
The fix is made in
Can you please verify that everything is working now, and close the issue? |
Looks good, thanks for the quick fix! 🙂 |
Just double checking if this is a bug or simply not how the API is meant to be used -- the docs explain that the following is available to verify a stub was used correctly:
However, if I try to use this with
Never()
, like so:I receive the following error when running the test:
This is the case whether I include a
.ThenReturn()
in the chain or not. Is it intentional that using Verify in this way is not compatible withNever()
?The text was updated successfully, but these errors were encountered: