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

43 lines
919 B
Go

package mock
import (
"github.com/eventials/goevents/messaging"
"github.com/stretchr/testify/mock"
)
type Connection struct {
mock.Mock
}
func NewMockConnection() messaging.Connection {
return &Connection{}
}
func (c *Connection) Consumer(autoAck bool, exchange, queue string) (messaging.Consumer, error) {
args := c.Called(autoAck, exchange, queue)
return args.Get(0).(messaging.Consumer), args.Error(1)
}
func (c *Connection) Producer(exchange string) (messaging.Producer, error) {
args := c.Called(exchange)
return args.Get(0).(messaging.Producer), args.Error(1)
}
func (c *Connection) Close() {
c.Called()
}
func (c *Connection) NotifyConnectionClose() <-chan error {
args := c.Called()
return args.Get(0).(chan error)
}
func (c *Connection) NotifyReestablish() <-chan bool {
args := c.Called()
return args.Get(0).(chan bool)
}
func (c *Connection) WaitUntilConnectionCloses() {
c.Called()
}