Documentation
¶
Index ¶
- Variables
- func NewHttpTestEchoHandler() *httptest.Server
- type HttpServerStub
- type LoggerMock
- func (c LoggerMock) Debug(message string, args ...interface{})
- func (c LoggerMock) Error(message string, args ...interface{})
- func (c LoggerMock) Info(message string, args ...interface{})
- func (c LoggerMock) IsInterfaceNil() bool
- func (c LoggerMock) LogIfError(err error, args ...interface{})
- func (c LoggerMock) Trace(message string, args ...interface{})
- func (c LoggerMock) Warn(message string, args ...interface{})
- type LoggerStub
- func (l *LoggerStub) Debug(message string, args ...interface{})
- func (l *LoggerStub) Error(message string, args ...interface{})
- func (l *LoggerStub) Info(message string, args ...interface{})
- func (l *LoggerStub) IsInterfaceNil() bool
- func (l *LoggerStub) LogIfError(err error, args ...interface{})
- func (l *LoggerStub) Trace(message string, args ...interface{})
- func (l *LoggerStub) Warn(message string, args ...interface{})
- type MarshallerMock
- type PayloadHandlerStub
- type WebsocketConnectionStub
- func (w *WebsocketConnectionStub) Close() error
- func (w *WebsocketConnectionStub) GetID() string
- func (w *WebsocketConnectionStub) IsInterfaceNil() bool
- func (w *WebsocketConnectionStub) OpenConnection(url string) error
- func (w *WebsocketConnectionStub) ReadMessage() (messageType int, payload []byte, err error)
- func (w *WebsocketConnectionStub) WriteMessage(messageType int, data []byte) error
Constants ¶
This section is empty.
Variables ¶
var ErrMockMarshaller = errors.New("MarshallerMock generic error")
ErrMockMarshaller -
var ErrNilObjectToMarshal = errors.New("nil object to serialize from")
ErrNilObjectToMarshal -
Functions ¶
func NewHttpTestEchoHandler ¶
NewHttpTestEchoHandler -
Types ¶
type HttpServerStub ¶
type HttpServerStub struct {
ListenAndServeCalled func() error
ShutdownCalled func(ctx context.Context) error
}
HttpServerStub -
func (*HttpServerStub) ListenAndServe ¶
func (h *HttpServerStub) ListenAndServe() error
ListenAndServe -
type LoggerMock ¶
type LoggerMock struct {
}
LoggerMock -
func (LoggerMock) Debug ¶
func (c LoggerMock) Debug(message string, args ...interface{})
Debug will print a debug log
func (LoggerMock) Error ¶
func (c LoggerMock) Error(message string, args ...interface{})
Error will print an error log
func (LoggerMock) Info ¶
func (c LoggerMock) Info(message string, args ...interface{})
Info will print an info log
func (LoggerMock) IsInterfaceNil ¶
func (c LoggerMock) IsInterfaceNil() bool
IsInterfaceNil returns false as the struct doesn't use pointer receivers
func (LoggerMock) LogIfError ¶
func (c LoggerMock) LogIfError(err error, args ...interface{})
LogIfError will print an error if it is not nil
func (LoggerMock) Trace ¶
func (c LoggerMock) Trace(message string, args ...interface{})
Trace will print a trace log
func (LoggerMock) Warn ¶
func (c LoggerMock) Warn(message string, args ...interface{})
Warn will print a warn log
type LoggerStub ¶
type LoggerStub struct {
TraceCalled func(message string, args ...interface{})
DebugCalled func(message string, args ...interface{})
InfoCalled func(message string, args ...interface{})
WarnCalled func(message string, args ...interface{})
ErrorCalled func(message string, args ...interface{})
LogIfErrorCalled func(err error, args ...interface{})
}
LoggerStub -
func (*LoggerStub) LogIfError ¶
func (l *LoggerStub) LogIfError(err error, args ...interface{})
LogIfError -
type MarshallerMock ¶
type MarshallerMock struct {
Fail bool
}
MarshallerMock that will be used for testing
func (*MarshallerMock) IsInterfaceNil ¶
func (mm *MarshallerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MarshallerMock) Marshal ¶
func (mm *MarshallerMock) Marshal(obj interface{}) ([]byte, error)
Marshal converts the input object in a slice of bytes
func (*MarshallerMock) Unmarshal ¶
func (mm *MarshallerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal applies the serialized values over an instantiated object
type PayloadHandlerStub ¶
type PayloadHandlerStub struct {
ProcessPayloadCalled func(payload []byte, topic string) error
CloseCalled func() error
}
PayloadHandlerStub -
func (*PayloadHandlerStub) IsInterfaceNil ¶
func (ph *PayloadHandlerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*PayloadHandlerStub) ProcessPayload ¶
func (ph *PayloadHandlerStub) ProcessPayload(payload []byte, topic string) error
ProcessPayload -
type WebsocketConnectionStub ¶
type WebsocketConnectionStub struct {
OpenConnectionCalled func(url string) error
ReadMessageCalled func() (messageType int, payload []byte, err error)
WriteMessageCalled func(messageType int, data []byte) error
GetIDCalled func() string
CloseCalled func() error
}
WebsocketConnectionStub -
func (*WebsocketConnectionStub) IsInterfaceNil ¶
func (w *WebsocketConnectionStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*WebsocketConnectionStub) OpenConnection ¶
func (w *WebsocketConnectionStub) OpenConnection(url string) error
OpenConnection -
func (*WebsocketConnectionStub) ReadMessage ¶
func (w *WebsocketConnectionStub) ReadMessage() (messageType int, payload []byte, err error)
ReadMessage -
func (*WebsocketConnectionStub) WriteMessage ¶
func (w *WebsocketConnectionStub) WriteMessage(messageType int, data []byte) error
WriteMessage -