Closed abhinav3295 closed 5 years ago
@abhinav3295 You've to add the value to the context before calling funcA
.
ctx := context.Background()
ctx = context.WithValue(ctx, "asas", "some")
return m.helper.funcA(ctx)
makes the test pass.
Thanks for sharing the code which's easy to reproduce and help 👍
Perhaps this bug should get closed?
Thanks!
I am trying to mock a function that has
context.Context
as an argument. But when I usemock.Anything
tests run fine, but on usingmock.MatchedBy
I am always gettingUnexpected Method Call
sample project to reproduce the bug is attached. reproduceStrecherBug.zip