EventBus.go RawHistoryFolder
1// Code generated by mockery; DO NOT EDIT.
2// github.com/vektra/mockery
3// template: testify
4
5package mocks
6
7import (
8 "context"
9
10 "bnema.dev/ermite/internal/domain"
11 mock "github.com/stretchr/testify/mock"
12)
13
14// NewEventBus creates a new instance of EventBus. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
15// The first argument is typically a *testing.T value.
16func NewEventBus(t interface {
17 mock.TestingT
18 Cleanup(func())
19}) *EventBus {
20 if helper, ok := t.(interface{ Helper() }); ok {
21 helper.Helper()
22 }
23
24 mock := &EventBus{}
25 mock.Mock.Test(t)
26
27 t.Cleanup(func() {
28 if helper, ok := t.(interface{ Helper() }); ok {
29 helper.Helper()
30 }
31 mock.AssertExpectations(t)
32 })
33
34 return mock
35}
36
37// EventBus is an autogenerated mock type for the EventBus type
38type EventBus struct {
39 mock.Mock
40}
41
42type EventBus_Expecter struct {
43 mock *mock.Mock
44}
45
46func (_m *EventBus) EXPECT() *EventBus_Expecter {
47 return &EventBus_Expecter{mock: &_m.Mock}
48}
49
50// Publish provides a mock function for the type EventBus
51func (_mock *EventBus) Publish(ctx context.Context, ev domain.Event) {
52 _mock.Called(ctx, ev)
53 return
54}
55
56// EventBus_Publish_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Publish'
57type EventBus_Publish_Call struct {
58 *mock.Call
59}
60
61// Publish is a helper method to define mock.On call
62// - ctx context.Context
63// - ev domain.Event
64func (_e *EventBus_Expecter) Publish(ctx any, ev any) *EventBus_Publish_Call {
65 return &EventBus_Publish_Call{Call: _e.mock.On("Publish", ctx, ev)}
66}
67
68func (_c *EventBus_Publish_Call) Run(run func(ctx context.Context, ev domain.Event)) *EventBus_Publish_Call {
69 _c.Call.Run(func(args mock.Arguments) {
70 var arg0 context.Context
71 if args[0] != nil {
72 arg0 = args[0].(context.Context)
73 }
74 var arg1 domain.Event
75 if args[1] != nil {
76 arg1 = args[1].(domain.Event)
77 }
78 run(
79 arg0,
80 arg1,
81 )
82 })
83 return _c
84}
85
86func (_c *EventBus_Publish_Call) Return() *EventBus_Publish_Call {
87 _c.Call.Return()
88 return _c
89}
90
91func (_c *EventBus_Publish_Call) RunAndReturn(run func(ctx context.Context, ev domain.Event)) *EventBus_Publish_Call {
92 _c.Run(run)
93 return _c
94}
95
96// Subscribe provides a mock function for the type EventBus
97func (_mock *EventBus) Subscribe(ctx context.Context) <-chan domain.Event {
98 ret := _mock.Called(ctx)
99
100 if len(ret) == 0 {
101 panic("no return value specified for Subscribe")
102 }
103
104 var r0 <-chan domain.Event
105 if returnFunc, ok := ret.Get(0).(func(context.Context) <-chan domain.Event); ok {
106 r0 = returnFunc(ctx)
107 } else {
108 if ret.Get(0) != nil {
109 r0 = ret.Get(0).(<-chan domain.Event)
110 }
111 }
112 return r0
113}
114
115// EventBus_Subscribe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Subscribe'
116type EventBus_Subscribe_Call struct {
117 *mock.Call
118}
119
120// Subscribe is a helper method to define mock.On call
121// - ctx context.Context
122func (_e *EventBus_Expecter) Subscribe(ctx any) *EventBus_Subscribe_Call {
123 return &EventBus_Subscribe_Call{Call: _e.mock.On("Subscribe", ctx)}
124}
125
126func (_c *EventBus_Subscribe_Call) Run(run func(ctx context.Context)) *EventBus_Subscribe_Call {
127 _c.Call.Run(func(args mock.Arguments) {
128 var arg0 context.Context
129 if args[0] != nil {
130 arg0 = args[0].(context.Context)
131 }
132 run(
133 arg0,
134 )
135 })
136 return _c
137}
138
139func (_c *EventBus_Subscribe_Call) Return(eventCh <-chan domain.Event) *EventBus_Subscribe_Call {
140 _c.Call.Return(eventCh)
141 return _c
142}
143
144func (_c *EventBus_Subscribe_Call) RunAndReturn(run func(ctx context.Context) <-chan domain.Event) *EventBus_Subscribe_Call {
145 _c.Call.Return(run)
146 return _c
147}