panic when GetMethod on interface{} with message: reflect: call of reflect.Value.Interface on zero Value
To Reproduce
run this test
type A interface {
Foo()
}
type a struct {
A
}
type b struct {
i int
}
func (*b) Foo() {
fmt.Println("abc")
}
func NewA() A {
return &a{A: new(b)}
}
func TestXxx(t *testing.T) {
mockey.PatchConvey("sample", t, func() {
obj := NewA()
mockey.Mock(mockey.GetMethod(obj, "Foo")).Build()
})
}
Describe the bug
panic when GetMethod on interface{} with message:
reflect: call of reflect.Value.Interface on zero Value
To Reproduce
run this test
Expected behavior
Not panic, mock successfully
Mockey version:
v1.2.0