github.com/oinume/lekcije@v0.0.0-20231017100347-5b4c5eb6ab24/backend/infrastructure/rollbar/client.moq.go (about) 1 // Code generated by moq; DO NOT EDIT. 2 // github.com/matryer/moq 3 4 package rollbar 5 6 import ( 7 "context" 8 "github.com/rollbar/rollbar-go" 9 "sync" 10 ) 11 12 // Ensure, that ClientMock does implement Client. 13 // If this is not the case, regenerate this file with moq. 14 var _ Client = &ClientMock{} 15 16 // ClientMock is a mock implementation of Client. 17 // 18 // func TestSomethingThatUsesClient(t *testing.T) { 19 // 20 // // make and configure a mocked Client 21 // mockedClient := &ClientMock{ 22 // ErrorWithStackSkipWithExtrasAndContextFunc: func(ctx context.Context, level string, err error, skip int, extras map[string]interface{}) { 23 // panic("mock out the ErrorWithStackSkipWithExtrasAndContext method") 24 // }, 25 // SetStackTracerFunc: func(stackTracer rollbar.StackTracerFunc) { 26 // panic("mock out the SetStackTracer method") 27 // }, 28 // } 29 // 30 // // use mockedClient in code that requires Client 31 // // and then make assertions. 32 // 33 // } 34 type ClientMock struct { 35 // ErrorWithStackSkipWithExtrasAndContextFunc mocks the ErrorWithStackSkipWithExtrasAndContext method. 36 ErrorWithStackSkipWithExtrasAndContextFunc func(ctx context.Context, level string, err error, skip int, extras map[string]interface{}) 37 38 // SetStackTracerFunc mocks the SetStackTracer method. 39 SetStackTracerFunc func(stackTracer rollbar.StackTracerFunc) 40 41 // calls tracks calls to the methods. 42 calls struct { 43 // ErrorWithStackSkipWithExtrasAndContext holds details about calls to the ErrorWithStackSkipWithExtrasAndContext method. 44 ErrorWithStackSkipWithExtrasAndContext []struct { 45 // Ctx is the ctx argument value. 46 Ctx context.Context 47 // Level is the level argument value. 48 Level string 49 // Err is the err argument value. 50 Err error 51 // Skip is the skip argument value. 52 Skip int 53 // Extras is the extras argument value. 54 Extras map[string]interface{} 55 } 56 // SetStackTracer holds details about calls to the SetStackTracer method. 57 SetStackTracer []struct { 58 // StackTracer is the stackTracer argument value. 59 StackTracer rollbar.StackTracerFunc 60 } 61 } 62 lockErrorWithStackSkipWithExtrasAndContext sync.RWMutex 63 lockSetStackTracer sync.RWMutex 64 } 65 66 // ErrorWithStackSkipWithExtrasAndContext calls ErrorWithStackSkipWithExtrasAndContextFunc. 67 func (mock *ClientMock) ErrorWithStackSkipWithExtrasAndContext(ctx context.Context, level string, err error, skip int, extras map[string]interface{}) { 68 if mock.ErrorWithStackSkipWithExtrasAndContextFunc == nil { 69 panic("ClientMock.ErrorWithStackSkipWithExtrasAndContextFunc: method is nil but Client.ErrorWithStackSkipWithExtrasAndContext was just called") 70 } 71 callInfo := struct { 72 Ctx context.Context 73 Level string 74 Err error 75 Skip int 76 Extras map[string]interface{} 77 }{ 78 Ctx: ctx, 79 Level: level, 80 Err: err, 81 Skip: skip, 82 Extras: extras, 83 } 84 mock.lockErrorWithStackSkipWithExtrasAndContext.Lock() 85 mock.calls.ErrorWithStackSkipWithExtrasAndContext = append(mock.calls.ErrorWithStackSkipWithExtrasAndContext, callInfo) 86 mock.lockErrorWithStackSkipWithExtrasAndContext.Unlock() 87 mock.ErrorWithStackSkipWithExtrasAndContextFunc(ctx, level, err, skip, extras) 88 } 89 90 // ErrorWithStackSkipWithExtrasAndContextCalls gets all the calls that were made to ErrorWithStackSkipWithExtrasAndContext. 91 // Check the length with: 92 // len(mockedClient.ErrorWithStackSkipWithExtrasAndContextCalls()) 93 func (mock *ClientMock) ErrorWithStackSkipWithExtrasAndContextCalls() []struct { 94 Ctx context.Context 95 Level string 96 Err error 97 Skip int 98 Extras map[string]interface{} 99 } { 100 var calls []struct { 101 Ctx context.Context 102 Level string 103 Err error 104 Skip int 105 Extras map[string]interface{} 106 } 107 mock.lockErrorWithStackSkipWithExtrasAndContext.RLock() 108 calls = mock.calls.ErrorWithStackSkipWithExtrasAndContext 109 mock.lockErrorWithStackSkipWithExtrasAndContext.RUnlock() 110 return calls 111 } 112 113 // SetStackTracer calls SetStackTracerFunc. 114 func (mock *ClientMock) SetStackTracer(stackTracer rollbar.StackTracerFunc) { 115 if mock.SetStackTracerFunc == nil { 116 panic("ClientMock.SetStackTracerFunc: method is nil but Client.SetStackTracer was just called") 117 } 118 callInfo := struct { 119 StackTracer rollbar.StackTracerFunc 120 }{ 121 StackTracer: stackTracer, 122 } 123 mock.lockSetStackTracer.Lock() 124 mock.calls.SetStackTracer = append(mock.calls.SetStackTracer, callInfo) 125 mock.lockSetStackTracer.Unlock() 126 mock.SetStackTracerFunc(stackTracer) 127 } 128 129 // SetStackTracerCalls gets all the calls that were made to SetStackTracer. 130 // Check the length with: 131 // len(mockedClient.SetStackTracerCalls()) 132 func (mock *ClientMock) SetStackTracerCalls() []struct { 133 StackTracer rollbar.StackTracerFunc 134 } { 135 var calls []struct { 136 StackTracer rollbar.StackTracerFunc 137 } 138 mock.lockSetStackTracer.RLock() 139 calls = mock.calls.SetStackTracer 140 mock.lockSetStackTracer.RUnlock() 141 return calls 142 }