github.com/GetStream/moq@v0.0.0-20181113105103-b721cd3f6524/generate/generated.go (about) 1 // Code generated by moq; DO NOT EDIT. 2 // github.com/matryer/moq 3 4 package generate 5 6 import ( 7 "sync" 8 ) 9 10 var ( 11 lockMyInterfaceMockOne sync.RWMutex 12 lockMyInterfaceMockThree sync.RWMutex 13 lockMyInterfaceMockTwo sync.RWMutex 14 ) 15 16 // MyInterfaceMock is a mock implementation of MyInterface. 17 // 18 // func TestSomethingThatUsesMyInterface(t *testing.T) { 19 // 20 // // make and configure a mocked MyInterface 21 // mockedMyInterface := &MyInterfaceMock{ 22 // OneFunc: func() bool { 23 // panic("TODO: mock out the One method") 24 // }, 25 // ThreeFunc: func() string { 26 // panic("TODO: mock out the Three method") 27 // }, 28 // TwoFunc: func() int { 29 // panic("TODO: mock out the Two method") 30 // }, 31 // } 32 // 33 // // TODO: use mockedMyInterface in code that requires MyInterface 34 // // and then make assertions. 35 // 36 // } 37 type MyInterfaceMock struct { 38 // OneFunc mocks the One method. 39 OneFunc func() bool 40 41 // ThreeFunc mocks the Three method. 42 ThreeFunc func() string 43 44 // TwoFunc mocks the Two method. 45 TwoFunc func() int 46 47 // calls tracks calls to the methods. 48 calls struct { 49 // One holds details about calls to the One method. 50 One []struct { 51 } 52 // Three holds details about calls to the Three method. 53 Three []struct { 54 } 55 // Two holds details about calls to the Two method. 56 Two []struct { 57 } 58 } 59 } 60 61 // One calls OneFunc. 62 func (mock *MyInterfaceMock) One() bool { 63 if mock.OneFunc == nil { 64 panic("MyInterfaceMock.OneFunc: method is nil but MyInterface.One was just called") 65 } 66 callInfo := struct { 67 }{} 68 lockMyInterfaceMockOne.Lock() 69 mock.calls.One = append(mock.calls.One, callInfo) 70 lockMyInterfaceMockOne.Unlock() 71 return mock.OneFunc() 72 } 73 74 // OneCalls gets all the calls that were made to One. 75 // Check the length with: 76 // len(mockedMyInterface.OneCalls()) 77 func (mock *MyInterfaceMock) OneCalls() []struct { 78 } { 79 var calls []struct { 80 } 81 lockMyInterfaceMockOne.RLock() 82 calls = mock.calls.One 83 lockMyInterfaceMockOne.RUnlock() 84 return calls 85 } 86 87 // Three calls ThreeFunc. 88 func (mock *MyInterfaceMock) Three() string { 89 if mock.ThreeFunc == nil { 90 panic("MyInterfaceMock.ThreeFunc: method is nil but MyInterface.Three was just called") 91 } 92 callInfo := struct { 93 }{} 94 lockMyInterfaceMockThree.Lock() 95 mock.calls.Three = append(mock.calls.Three, callInfo) 96 lockMyInterfaceMockThree.Unlock() 97 return mock.ThreeFunc() 98 } 99 100 // ThreeCalls gets all the calls that were made to Three. 101 // Check the length with: 102 // len(mockedMyInterface.ThreeCalls()) 103 func (mock *MyInterfaceMock) ThreeCalls() []struct { 104 } { 105 var calls []struct { 106 } 107 lockMyInterfaceMockThree.RLock() 108 calls = mock.calls.Three 109 lockMyInterfaceMockThree.RUnlock() 110 return calls 111 } 112 113 // Two calls TwoFunc. 114 func (mock *MyInterfaceMock) Two() int { 115 if mock.TwoFunc == nil { 116 panic("MyInterfaceMock.TwoFunc: method is nil but MyInterface.Two was just called") 117 } 118 callInfo := struct { 119 }{} 120 lockMyInterfaceMockTwo.Lock() 121 mock.calls.Two = append(mock.calls.Two, callInfo) 122 lockMyInterfaceMockTwo.Unlock() 123 return mock.TwoFunc() 124 } 125 126 // TwoCalls gets all the calls that were made to Two. 127 // Check the length with: 128 // len(mockedMyInterface.TwoCalls()) 129 func (mock *MyInterfaceMock) TwoCalls() []struct { 130 } { 131 var calls []struct { 132 } 133 lockMyInterfaceMockTwo.RLock() 134 calls = mock.calls.Two 135 lockMyInterfaceMockTwo.RUnlock() 136 return calls 137 }