You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Meta is an autogenerated mock type for the Meta typetypeMetastruct {
mock.Mock
}
// MultiPut provides a mock function with given fields: ctx, keys, valuesfunc (_m*Meta) MultiPut(ctx context.Context, keys []string, values []string) error {
ret:=_m.Called(ctx, keys, values)
varr0errorifrf, ok:=ret.Get(0).(func(context.Context, []string, []string) error); ok {
r0=rf(ctx, keys, values)
} else {
r0=ret.Error(0)
}
returnr0
}
I have multiple mock.On with mock.MatchedBy. As the function is called multiple times, I want later function call is matched by later mock.On
However, in some scenarios, exact arguments can be complicated to build or we may only want to match some parts of a Struct. Is it possible to retire a previous mock.On match so that later mock.On will be matched against?
I also tried to use call.Once, it does not seem to work
My interface is like this
We use mockery to generate the following mocks
I have multiple mock.On with mock.MatchedBy. As the function is called multiple times, I want later function call is matched by later mock.On
However, I got the following error. Clearly the first mock.On is used against the second function call.
One work around is to build the exact arguments instead of using mock.MatchedBy
However, in some scenarios, exact arguments can be complicated to build or we may only want to match some parts of a Struct. Is it possible to retire a previous mock.On match so that later mock.On will be matched against?
I also tried to use call.Once, it does not seem to work
Thanks for any guidance.
The text was updated successfully, but these errors were encountered: