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

mock: in order mock calls #1637

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ReyOrtiz
Copy link

@ReyOrtiz ReyOrtiz commented Sep 6, 2024

Summary

Add helper method to declare the order of the mock calls.

Changes

  • add InOrder(calls ...*Call) helper method to declare the order of mock calls by calling NotBefore()

Motivation

This is probably the only feature I miss from gomock.InOrder(), it is more intuitive and cleaner to declare the order of the mock calls. Probably most cases can be satisfied with this method.

InOrder(
	mockedService1.On("TheExampleMethod", 1, 2, 3).Return(4, nil),
	mockedService2.On("TheExampleMethod2", true).Return(),
	mockedService3.On("TheExampleMethod3", "abc", 3).Return(false, nil),
)

Related issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants