Closed evgeniyasti closed 4 years ago
Hey, I think you want should try to create an Interface that Dialer
satisfies. Then you should be able to mock it!
Sorry, but I think this deserves an example. If we continue with the above example,
any function that takes a kafka.Dialer, won't take my kafka.DialerIface. So defining the interface type won't help. Maybe it should be called out very explicitly that this approach only works for a small subset of go librarys that expose interfaces, right?
Hello.
I want to mock this class: https://github.com/segmentio/kafka-go/blob/master/dialer.go
I'm spinning in circles without any tangible results. Can someone please give me a hint on how to mock the
Dialer
struct and its functions?Thanks