mirror of
https://github.com/eventials/goevents.git
synced 2025-04-24 13:48:53 +08:00
28 lines
438 B
Go
28 lines
438 B
Go
package mock
|
|
|
|
import (
|
|
"github.com/eventials/goevents/messaging"
|
|
"github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
type Producer struct {
|
|
mock.Mock
|
|
}
|
|
|
|
func NewMockProducer() messaging.Producer {
|
|
return &Producer{}
|
|
}
|
|
|
|
func (p *Producer) Publish(action string, data []byte) {
|
|
p.Called(action, data)
|
|
}
|
|
|
|
func (p *Producer) Close() {
|
|
p.Called()
|
|
}
|
|
|
|
func (p *Producer) NotifyClose() <-chan bool {
|
|
args := p.Called()
|
|
return args.Get(0).(chan bool)
|
|
}
|