I am looking to mock some methods for unit testing. Unfortunately, the code is not structured really well.
var config = struct { abc *abc }
func Init(arg1) {
// config.abc = newAbc(arg2, arg3)
}
func UnitTestThis() {
//some code here
config.abc.Search(arg4,arg5)
//code here
}
How do I unit test the UnitTestThis function, mocking the results of Search method? I have been trying to create an interface and mock the methods, but been unable to do so.