I have the following code in Go:
func (s UserServer) getUser(user string) (*User, error) {
conn, err := grpc.DialContext(ctx, s.userSvcAddr,
grpc.WithInsecure(),
grpc.WithStatsHandler(&ClientHandler{}))
if err != nil {
return nil, fmt.Errorf("could not get the user: %+v", err)
}
defer conn.Close()
user, err := s.NewUser(conn)
return user, nil
}
How to mock the grpc.DialContext in the unit test?