Files
moq/generate/generated.go
Lucas Bremgartner b21592468b Add static interface implementation check
Add an additional line of code per interface to the generated mock file,
which allows the go compiler to statically check if the mock implements
the mocked interface.
2019-01-17 20:20:37 +01:00

142 lines
3.5 KiB
Go

// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package generate
import (
"sync"
)
var (
lockMyInterfaceMockOne sync.RWMutex
lockMyInterfaceMockThree sync.RWMutex
lockMyInterfaceMockTwo sync.RWMutex
)
// Ensure, that MyInterfaceMock does implement MyInterface.
// If this is not the case, regenerate this file with moq.
var _ MyInterface = &MyInterfaceMock{}
// MyInterfaceMock is a mock implementation of MyInterface.
//
// func TestSomethingThatUsesMyInterface(t *testing.T) {
//
// // make and configure a mocked MyInterface
// mockedMyInterface := &MyInterfaceMock{
// OneFunc: func() bool {
// panic("TODO: mock out the One method")
// },
// ThreeFunc: func() string {
// panic("TODO: mock out the Three method")
// },
// TwoFunc: func() int {
// panic("TODO: mock out the Two method")
// },
// }
//
// // TODO: use mockedMyInterface in code that requires MyInterface
// // and then make assertions.
//
// }
type MyInterfaceMock struct {
// OneFunc mocks the One method.
OneFunc func() bool
// ThreeFunc mocks the Three method.
ThreeFunc func() string
// TwoFunc mocks the Two method.
TwoFunc func() int
// calls tracks calls to the methods.
calls struct {
// One holds details about calls to the One method.
One []struct {
}
// Three holds details about calls to the Three method.
Three []struct {
}
// Two holds details about calls to the Two method.
Two []struct {
}
}
}
// One calls OneFunc.
func (mock *MyInterfaceMock) One() bool {
if mock.OneFunc == nil {
panic("MyInterfaceMock.OneFunc: method is nil but MyInterface.One was just called")
}
callInfo := struct {
}{}
lockMyInterfaceMockOne.Lock()
mock.calls.One = append(mock.calls.One, callInfo)
lockMyInterfaceMockOne.Unlock()
return mock.OneFunc()
}
// OneCalls gets all the calls that were made to One.
// Check the length with:
// len(mockedMyInterface.OneCalls())
func (mock *MyInterfaceMock) OneCalls() []struct {
} {
var calls []struct {
}
lockMyInterfaceMockOne.RLock()
calls = mock.calls.One
lockMyInterfaceMockOne.RUnlock()
return calls
}
// Three calls ThreeFunc.
func (mock *MyInterfaceMock) Three() string {
if mock.ThreeFunc == nil {
panic("MyInterfaceMock.ThreeFunc: method is nil but MyInterface.Three was just called")
}
callInfo := struct {
}{}
lockMyInterfaceMockThree.Lock()
mock.calls.Three = append(mock.calls.Three, callInfo)
lockMyInterfaceMockThree.Unlock()
return mock.ThreeFunc()
}
// ThreeCalls gets all the calls that were made to Three.
// Check the length with:
// len(mockedMyInterface.ThreeCalls())
func (mock *MyInterfaceMock) ThreeCalls() []struct {
} {
var calls []struct {
}
lockMyInterfaceMockThree.RLock()
calls = mock.calls.Three
lockMyInterfaceMockThree.RUnlock()
return calls
}
// Two calls TwoFunc.
func (mock *MyInterfaceMock) Two() int {
if mock.TwoFunc == nil {
panic("MyInterfaceMock.TwoFunc: method is nil but MyInterface.Two was just called")
}
callInfo := struct {
}{}
lockMyInterfaceMockTwo.Lock()
mock.calls.Two = append(mock.calls.Two, callInfo)
lockMyInterfaceMockTwo.Unlock()
return mock.TwoFunc()
}
// TwoCalls gets all the calls that were made to Two.
// Check the length with:
// len(mockedMyInterface.TwoCalls())
func (mock *MyInterfaceMock) TwoCalls() []struct {
} {
var calls []struct {
}
lockMyInterfaceMockTwo.RLock()
calls = mock.calls.Two
lockMyInterfaceMockTwo.RUnlock()
return calls
}