github.com/hechain20/hechain@v0.0.0-20220316014945-b544036ba106/core/middleware/fakes/http_handler.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package fakes
     3  
     4  import (
     5  	"net/http"
     6  	"sync"
     7  )
     8  
     9  type HTTPHandler 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 *HTTPHandler) 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 *HTTPHandler) ServeHTTPCallCount() int {
    34  	fake.serveHTTPMutex.RLock()
    35  	defer fake.serveHTTPMutex.RUnlock()
    36  	return len(fake.serveHTTPArgsForCall)
    37  }
    38  
    39  func (fake *HTTPHandler) 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 *HTTPHandler) 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 *HTTPHandler) 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 *HTTPHandler) 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  }