package main_test
import (
"testing"
"github.com/stretchr/testify/mock"
)
type Foo interface {
Bar()
}
type MockFoo struct {
mock.Mock
}
// Bar provides a mock function with given fields:
func (_m *MockFoo) Bar() {
_m.Called()
}
func TestFoo(t *testing.T) {
foo := new(MockFoo)
foo.On("Bar", mock.Anything).Return()
foo.Bar() // expected error for unmocked call
}
The logic in Arguments.Diff does not check whether a given argument is required by the function signature before checking if the value is Anything. Phrased another way, there is no explicit arity check on the mocked method.
The logic in
Arguments.Diffdoes not check whether a given argument is required by the function signature before checking if the value isAnything. Phrased another way, there is no explicit arity check on the mocked method.