This question already has an answer here:
So I am a beginner with mocking struct and functions in Golang. I basically want to check if a function has been called for unit testing purpose. Here is the code:
type A struct {
}
func (a *A) Foo (){}
type B struct {
a *A
}
func (b* B) Bar () {
a.Foo()
}
I basically want to check that Foo is indeed called when Bar is called
I know there is some mock framework available for Golang but they are pretty complicated when it comes to testing existing struct and struct methods
</div>