state.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Code generated by Clue Mock Generator v0.17.0, DO NOT EDIT.
  2. //
  3. // Command:
  4. // $ cmg gen douglasthrift.net/presence/neighbors
  5. package mockneighbors
  6. import (
  7. "testing"
  8. "goa.design/clue/mock"
  9. "douglasthrift.net/presence/neighbors"
  10. )
  11. type (
  12. State struct {
  13. m *mock.Mock
  14. t *testing.T
  15. }
  16. StatePresentFunc func() bool
  17. StateChangedFunc func() bool
  18. StateSetFunc func(present bool)
  19. StateResetFunc func()
  20. )
  21. func NewState(t *testing.T) *State {
  22. var (
  23. m = &State{mock.New(), t}
  24. _ neighbors.State = m
  25. )
  26. return m
  27. }
  28. func (m *State) AddPresent(f StatePresentFunc) {
  29. m.m.Add("Present", f)
  30. }
  31. func (m *State) SetPresent(f StatePresentFunc) {
  32. m.m.Set("Present", f)
  33. }
  34. func (m *State) Present() bool {
  35. if f := m.m.Next("Present"); f != nil {
  36. return f.(StatePresentFunc)()
  37. }
  38. m.t.Helper()
  39. m.t.Error("unexpected Present call")
  40. return false
  41. }
  42. func (m *State) AddChanged(f StateChangedFunc) {
  43. m.m.Add("Changed", f)
  44. }
  45. func (m *State) SetChanged(f StateChangedFunc) {
  46. m.m.Set("Changed", f)
  47. }
  48. func (m *State) Changed() bool {
  49. if f := m.m.Next("Changed"); f != nil {
  50. return f.(StateChangedFunc)()
  51. }
  52. m.t.Helper()
  53. m.t.Error("unexpected Changed call")
  54. return false
  55. }
  56. func (m *State) AddSet(f StateSetFunc) {
  57. m.m.Add("Set", f)
  58. }
  59. func (m *State) SetSet(f StateSetFunc) {
  60. m.m.Set("Set", f)
  61. }
  62. func (m *State) Set(present bool) {
  63. if f := m.m.Next("Set"); f != nil {
  64. f.(StateSetFunc)(present)
  65. return
  66. }
  67. m.t.Helper()
  68. m.t.Error("unexpected Set call")
  69. }
  70. func (m *State) AddReset(f StateResetFunc) {
  71. m.m.Add("Reset", f)
  72. }
  73. func (m *State) SetReset(f StateResetFunc) {
  74. m.m.Set("Reset", f)
  75. }
  76. func (m *State) Reset() {
  77. if f := m.m.Next("Reset"); f != nil {
  78. f.(StateResetFunc)()
  79. return
  80. }
  81. m.t.Helper()
  82. m.t.Error("unexpected Reset call")
  83. }
  84. func (m *State) HasMore() bool {
  85. return m.m.HasMore()
  86. }