func TestDispatcher_Notify(t *testing.T) { m := gomock.NewController(t) defer m.Finish() not := mock_flux.NewMockNotifierInterface(m) a := &st1{} gomock.InOrder(not.EXPECT().NotifyWithData("a", notif1{}, nil).Return(closedChannel())) d := flux.NewDispatcher(not, a) done := d.Dispatch(false) <-done }
func (cb *ClientContextBuilder) SetApp(mockDispatcher, mockNotifier, mockWatcher bool) *ClientContextBuilder { app := &stores.App{ Conn: mock_connection.NewMockInterface(cb.mock), Fail: make(chan error, 1), } ctx := stores.NewContext(cb.Ctx(), app) cb.Base.SetCtx(ctx) app.Init(cb.Ctx()) if mockDispatcher { app.Dispatcher = mock_flux.NewMockDispatcherInterface(cb.mock) } if mockNotifier { app.Notifier = mock_flux.NewMockNotifierInterface(cb.mock) } if mockWatcher { app.Watcher = mock_flux.NewMockWatcherInterface(cb.mock) } return cb }