detector.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Code generated by Clue Mock Generator v0.17.0, DO NOT EDIT.
  2. //
  3. // Command:
  4. // $ cmg gen douglasthrift.net/presence
  5. package mockpresence
  6. import (
  7. "context"
  8. "testing"
  9. "goa.design/clue/mock"
  10. "douglasthrift.net/presence"
  11. "douglasthrift.net/presence/ifttt"
  12. )
  13. type (
  14. Detector struct {
  15. m *mock.Mock
  16. t *testing.T
  17. }
  18. DetectorDetectFunc func(ctx context.Context) error
  19. DetectorConfigFunc func(config *presence.Config)
  20. DetectorClientFunc func(client ifttt.Client)
  21. )
  22. func NewDetector(t *testing.T) *Detector {
  23. var (
  24. m = &Detector{mock.New(), t}
  25. _ presence.Detector = m
  26. )
  27. return m
  28. }
  29. func (m *Detector) AddDetect(f DetectorDetectFunc) {
  30. m.m.Add("Detect", f)
  31. }
  32. func (m *Detector) SetDetect(f DetectorDetectFunc) {
  33. m.m.Set("Detect", f)
  34. }
  35. func (m *Detector) Detect(ctx context.Context) error {
  36. if f := m.m.Next("Detect"); f != nil {
  37. return f.(DetectorDetectFunc)(ctx)
  38. }
  39. m.t.Helper()
  40. m.t.Error("unexpected Detect call")
  41. return nil
  42. }
  43. func (m *Detector) AddConfig(f DetectorConfigFunc) {
  44. m.m.Add("Config", f)
  45. }
  46. func (m *Detector) SetConfig(f DetectorConfigFunc) {
  47. m.m.Set("Config", f)
  48. }
  49. func (m *Detector) Config(config *presence.Config) {
  50. if f := m.m.Next("Config"); f != nil {
  51. f.(DetectorConfigFunc)(config)
  52. return
  53. }
  54. m.t.Helper()
  55. m.t.Error("unexpected Config call")
  56. }
  57. func (m *Detector) AddClient(f DetectorClientFunc) {
  58. m.m.Add("Client", f)
  59. }
  60. func (m *Detector) SetClient(f DetectorClientFunc) {
  61. m.m.Set("Client", f)
  62. }
  63. func (m *Detector) Client(client ifttt.Client) {
  64. if f := m.m.Next("Client"); f != nil {
  65. f.(DetectorClientFunc)(client)
  66. return
  67. }
  68. m.t.Helper()
  69. m.t.Error("unexpected Client call")
  70. }
  71. func (m *Detector) HasMore() bool {
  72. return m.m.HasMore()
  73. }