net.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // Code generated by Clue Mock Generator v0.17.0, DO NOT EDIT.
  2. //
  3. // Command:
  4. // $ cmg gen douglasthrift.net/presence/wrap
  5. package mockwrap
  6. import (
  7. "net"
  8. "testing"
  9. "goa.design/clue/mock"
  10. "douglasthrift.net/presence/wrap"
  11. )
  12. type (
  13. Net struct {
  14. m *mock.Mock
  15. t *testing.T
  16. }
  17. NetInterfaceByNameFunc func(name string) (*net.Interface, error)
  18. NetInterfacesFunc func() ([]net.Interface, error)
  19. )
  20. func NewNet(t *testing.T) *Net {
  21. var (
  22. m = &Net{mock.New(), t}
  23. _ wrap.Net = m
  24. )
  25. return m
  26. }
  27. func (m *Net) AddInterfaceByName(f NetInterfaceByNameFunc) {
  28. m.m.Add("InterfaceByName", f)
  29. }
  30. func (m *Net) SetInterfaceByName(f NetInterfaceByNameFunc) {
  31. m.m.Set("InterfaceByName", f)
  32. }
  33. func (m *Net) InterfaceByName(name string) (*net.Interface, error) {
  34. if f := m.m.Next("InterfaceByName"); f != nil {
  35. return f.(NetInterfaceByNameFunc)(name)
  36. }
  37. m.t.Helper()
  38. m.t.Error("unexpected InterfaceByName call")
  39. return nil, nil
  40. }
  41. func (m *Net) AddInterfaces(f NetInterfacesFunc) {
  42. m.m.Add("Interfaces", f)
  43. }
  44. func (m *Net) SetInterfaces(f NetInterfacesFunc) {
  45. m.m.Set("Interfaces", f)
  46. }
  47. func (m *Net) Interfaces() ([]net.Interface, error) {
  48. if f := m.m.Next("Interfaces"); f != nil {
  49. return f.(NetInterfacesFunc)()
  50. }
  51. m.t.Helper()
  52. m.t.Error("unexpected Interfaces call")
  53. return nil, nil
  54. }
  55. func (m *Net) HasMore() bool {
  56. return m.m.HasMore()
  57. }