2016-12-01 11:40:58 -02:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
2017-10-05 14:55:13 -03:00
|
|
|
"github.com/eventials/goevents/messaging"
|
2016-12-01 11:40:58 -02:00
|
|
|
"github.com/stretchr/testify/mock"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Producer struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
2017-10-05 14:55:13 -03:00
|
|
|
func NewMockProducer() messaging.Producer {
|
|
|
|
return &Producer{}
|
|
|
|
}
|
|
|
|
|
2017-03-09 17:32:05 -03:00
|
|
|
func (p *Producer) Publish(action string, data []byte) {
|
2017-03-09 23:17:20 -03:00
|
|
|
p.Called(action, data)
|
2017-03-09 17:32:05 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Producer) Close() {
|
2017-03-09 23:17:20 -03:00
|
|
|
p.Called()
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p *Producer) NotifyClose() <-chan bool {
|
2017-10-05 14:55:13 -03:00
|
|
|
args := p.Called()
|
|
|
|
return args.Get(0).(chan bool)
|
2016-12-01 11:40:58 -02:00
|
|
|
}
|