github.com/chenbh/concourse/v6@v6.4.2/atc/wrappa/wrappafakes/fake_handler.go (about) 1 // Code generated by counterfeiter. DO NOT EDIT. 2 package wrappafakes 3 4 import ( 5 "net/http" 6 "sync" 7 ) 8 9 type FakeHandler struct { 10 ServeHTTPStub func(http.ResponseWriter, *http.Request) 11 serveHTTPMutex sync.RWMutex 12 serveHTTPArgsForCall []struct { 13 arg1 http.ResponseWriter 14 arg2 *http.Request 15 } 16 invocations map[string][][]interface{} 17 invocationsMutex sync.RWMutex 18 } 19 20 func (fake *FakeHandler) ServeHTTP(arg1 http.ResponseWriter, arg2 *http.Request) { 21 fake.serveHTTPMutex.Lock() 22 fake.serveHTTPArgsForCall = append(fake.serveHTTPArgsForCall, struct { 23 arg1 http.ResponseWriter 24 arg2 *http.Request 25 }{arg1, arg2}) 26 fake.recordInvocation("ServeHTTP", []interface{}{arg1, arg2}) 27 fake.serveHTTPMutex.Unlock() 28 if fake.ServeHTTPStub != nil { 29 fake.ServeHTTPStub(arg1, arg2) 30 } 31 } 32 33 func (fake *FakeHandler) ServeHTTPCallCount() int { 34 fake.serveHTTPMutex.RLock() 35 defer fake.serveHTTPMutex.RUnlock() 36 return len(fake.serveHTTPArgsForCall) 37 } 38 39 func (fake *FakeHandler) ServeHTTPCalls(stub func(http.ResponseWriter, *http.Request)) { 40 fake.serveHTTPMutex.Lock() 41 defer fake.serveHTTPMutex.Unlock() 42 fake.ServeHTTPStub = stub 43 } 44 45 func (fake *FakeHandler) ServeHTTPArgsForCall(i int) (http.ResponseWriter, *http.Request) { 46 fake.serveHTTPMutex.RLock() 47 defer fake.serveHTTPMutex.RUnlock() 48 argsForCall := fake.serveHTTPArgsForCall[i] 49 return argsForCall.arg1, argsForCall.arg2 50 } 51 52 func (fake *FakeHandler) Invocations() map[string][][]interface{} { 53 fake.invocationsMutex.RLock() 54 defer fake.invocationsMutex.RUnlock() 55 fake.serveHTTPMutex.RLock() 56 defer fake.serveHTTPMutex.RUnlock() 57 copiedInvocations := map[string][][]interface{}{} 58 for key, value := range fake.invocations { 59 copiedInvocations[key] = value 60 } 61 return copiedInvocations 62 } 63 64 func (fake *FakeHandler) recordInvocation(key string, args []interface{}) { 65 fake.invocationsMutex.Lock() 66 defer fake.invocationsMutex.Unlock() 67 if fake.invocations == nil { 68 fake.invocations = map[string][][]interface{}{} 69 } 70 if fake.invocations[key] == nil { 71 fake.invocations[key] = [][]interface{}{} 72 } 73 fake.invocations[key] = append(fake.invocations[key], args) 74 } 75 76 var _ http.Handler = new(FakeHandler)