I am stuck on how to write tests. I have following public function. GetAccountNumber()
has its own logic. I would like to return a mock value for GetAccountNumber()
. In Java, I could do when(object.method()).thenReturn("returnValue")
. Is something similar available for go how can I accomplish that. I am going through bunch of go documentation but have not found anything useful yet.
func GetConfigName() string {
var configName string
accountNumber := GetAccountNumber()
switch *accountNumber {
case "123":
configName = "test1"
case "456":
configName = "test2"
return configName
}