Documentation ¶
Index ¶
- type LoggerMock
- func (mock *LoggerMock) Debug(msg string)
- func (mock *LoggerMock) DebugCalls() []struct{ ... }
- func (mock *LoggerMock) Error(msg string)
- func (mock *LoggerMock) ErrorCalls() []struct{ ... }
- func (mock *LoggerMock) Info(msg string)
- func (mock *LoggerMock) InfoCalls() []struct{ ... }
- func (mock *LoggerMock) Warn(msg string)
- func (mock *LoggerMock) WarnCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggerMock ¶
type LoggerMock struct { // DebugFunc mocks the Debug method. DebugFunc func(msg string) // ErrorFunc mocks the Error method. ErrorFunc func(msg string) // InfoFunc mocks the Info method. InfoFunc func(msg string) // WarnFunc mocks the Warn method. WarnFunc func(msg string) // contains filtered or unexported fields }
LoggerMock is a mock implementation of Logger.
func TestSomethingThatUsesLogger(t *testing.T) { // make and configure a mocked Logger mockedLogger := &LoggerMock{ DebugFunc: func(msg string) { panic("mock out the Debug method") }, ErrorFunc: func(msg string) { panic("mock out the Error method") }, InfoFunc: func(msg string) { panic("mock out the Info method") }, WarnFunc: func(msg string) { panic("mock out the Warn method") }, } // use mockedLogger in code that requires Logger // and then make assertions. }
func NewLoggerMock ¶
func NewLoggerMock() *LoggerMock
func (*LoggerMock) DebugCalls ¶
func (mock *LoggerMock) DebugCalls() []struct { Msg string }
DebugCalls gets all the calls that were made to Debug. Check the length with:
len(mockedLogger.DebugCalls())
func (*LoggerMock) ErrorCalls ¶
func (mock *LoggerMock) ErrorCalls() []struct { Msg string }
ErrorCalls gets all the calls that were made to Error. Check the length with:
len(mockedLogger.ErrorCalls())
func (*LoggerMock) InfoCalls ¶
func (mock *LoggerMock) InfoCalls() []struct { Msg string }
InfoCalls gets all the calls that were made to Info. Check the length with:
len(mockedLogger.InfoCalls())
func (*LoggerMock) WarnCalls ¶
func (mock *LoggerMock) WarnCalls() []struct { Msg string }
WarnCalls gets all the calls that were made to Warn. Check the length with:
len(mockedLogger.WarnCalls())
Click to show internal directories.
Click to hide internal directories.