I am using gomock for my unit test. I need to assert the type of param passed in the EXPECT setup. For example below, I need to assert the first param is any of type String, then any of type Integer, and then any of type MyStruct.
mockFoo.EXPECT().MyFunc(gomock.Any(), gomock.Any(), gomock.Any()).Return(true)
In Java, I'd do something like this:
Foo mockFoo = mock(Foo.class);
when(mockFoo.myFunc(anyString(), anyInt(), any(MyStruct.class))).thenReturn(true);
I couldn't find anything in the documentation.
Implements a custom Matcher for required args. For example:
PLAYGROUND
☝ It's the simplest example.
For mote flexibility implement a custom Matcher with any required logic. Also try to use generics, for example:
PLAYGROUND