# Testing: Don't Require mock.Anything for context.Context parameter

**URL:** <https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291>\
**Category:** Community Support\
**Tags:** general-impl\
**Created:** [January 12, 2021, 1:37am UTC](https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291 "2021-01-12T01:37:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shannon\_Tan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/shannon_tan/32/131_2.png) [@Shannon\_Tan](https://community.temporal.io/u/Shannon_Tan)\
**Post date:** [January 12, 2021, 1:37am UTC](https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291/1 "2021-01-12T01:37:16Z")

</div>

When executing activities, I believe `context.Context` can be omitted as an argument since that’s propagated. However, when mocking activities - it appears that it is required to pass in `mock.Anything`. Failure to do so results in a mismatched mock of the registered activities.

It would be nice to not have to pass in `mock.Anything` for the context argument, but not sure if the requirement of it was intentional.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [January 12, 2021, 6:16pm UTC](https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291/2 "2021-01-12T18:16:38Z")

</div>

Sounds like a good idea. Would you file an issue against Go SDK to get this fixed. Or you can submit a pull request with the fix if you want to contribute.

---

<div class="post-metadata">

**Author:** ![Shannon\_Tan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/shannon_tan/32/131_2.png) [@Shannon\_Tan](https://community.temporal.io/u/Shannon_Tan)\
**Post date:** [January 13, 2021, 1:48am UTC](https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291/3 "2021-01-13T01:48:42Z")

</div>

I’ve added this to the Go-SDK issues.

---

<div class="post-metadata">

**Author:** ![nathan\_hyland](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/nathan_hyland/32/1054_2.png) [@nathan\_hyland](https://community.temporal.io/u/nathan_hyland)\
**Post date:** [June 15, 2021, 3:06pm UTC](https://community.temporal.io/t/testing-dont-require-mock-anything-for-context-context-parameter/1291/4 "2021-06-15T15:06:56Z")

</div>

You can use `mock.AnythingOfType()` for it, or

`var MockContext = mock.MatchedBy(func(c context.Context) bool { return true })`
