1
0
mirror of https://github.com/eventials/goevents.git synced 2025-04-26 13:48:59 +08:00
eventials.goevents/mock/producer.go
Alexandre Vicenzi 3e5e24f212 Fix mock object.
2017-10-05 14:55:13 -03:00

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)
}