github.com/jghiloni/cli@v6.28.1-0.20170628223758-0ce05fe032a2+incompatible/command/common/commonfakes/fake_help_actor.go (about)

     1  // Code generated by counterfeiter. DO NOT EDIT.
     2  package commonfakes
     3  
     4  import (
     5  	"sync"
     6  
     7  	"code.cloudfoundry.org/cli/actor/sharedaction"
     8  	"code.cloudfoundry.org/cli/command/common"
     9  )
    10  
    11  type FakeHelpActor struct {
    12  	CommandInfoByNameStub        func(interface{}, string) (sharedaction.CommandInfo, error)
    13  	commandInfoByNameMutex       sync.RWMutex
    14  	commandInfoByNameArgsForCall []struct {
    15  		arg1 interface{}
    16  		arg2 string
    17  	}
    18  	commandInfoByNameReturns struct {
    19  		result1 sharedaction.CommandInfo
    20  		result2 error
    21  	}
    22  	commandInfoByNameReturnsOnCall map[int]struct {
    23  		result1 sharedaction.CommandInfo
    24  		result2 error
    25  	}
    26  	CommandInfosStub        func(interface{}) map[string]sharedaction.CommandInfo
    27  	commandInfosMutex       sync.RWMutex
    28  	commandInfosArgsForCall []struct {
    29  		arg1 interface{}
    30  	}
    31  	commandInfosReturns struct {
    32  		result1 map[string]sharedaction.CommandInfo
    33  	}
    34  	commandInfosReturnsOnCall map[int]struct {
    35  		result1 map[string]sharedaction.CommandInfo
    36  	}
    37  	invocations      map[string][][]interface{}
    38  	invocationsMutex sync.RWMutex
    39  }
    40  
    41  func (fake *FakeHelpActor) CommandInfoByName(arg1 interface{}, arg2 string) (sharedaction.CommandInfo, error) {
    42  	fake.commandInfoByNameMutex.Lock()
    43  	ret, specificReturn := fake.commandInfoByNameReturnsOnCall[len(fake.commandInfoByNameArgsForCall)]
    44  	fake.commandInfoByNameArgsForCall = append(fake.commandInfoByNameArgsForCall, struct {
    45  		arg1 interface{}
    46  		arg2 string
    47  	}{arg1, arg2})
    48  	fake.recordInvocation("CommandInfoByName", []interface{}{arg1, arg2})
    49  	fake.commandInfoByNameMutex.Unlock()
    50  	if fake.CommandInfoByNameStub != nil {
    51  		return fake.CommandInfoByNameStub(arg1, arg2)
    52  	}
    53  	if specificReturn {
    54  		return ret.result1, ret.result2
    55  	}
    56  	return fake.commandInfoByNameReturns.result1, fake.commandInfoByNameReturns.result2
    57  }
    58  
    59  func (fake *FakeHelpActor) CommandInfoByNameCallCount() int {
    60  	fake.commandInfoByNameMutex.RLock()
    61  	defer fake.commandInfoByNameMutex.RUnlock()
    62  	return len(fake.commandInfoByNameArgsForCall)
    63  }
    64  
    65  func (fake *FakeHelpActor) CommandInfoByNameArgsForCall(i int) (interface{}, string) {
    66  	fake.commandInfoByNameMutex.RLock()
    67  	defer fake.commandInfoByNameMutex.RUnlock()
    68  	return fake.commandInfoByNameArgsForCall[i].arg1, fake.commandInfoByNameArgsForCall[i].arg2
    69  }
    70  
    71  func (fake *FakeHelpActor) CommandInfoByNameReturns(result1 sharedaction.CommandInfo, result2 error) {
    72  	fake.CommandInfoByNameStub = nil
    73  	fake.commandInfoByNameReturns = struct {
    74  		result1 sharedaction.CommandInfo
    75  		result2 error
    76  	}{result1, result2}
    77  }
    78  
    79  func (fake *FakeHelpActor) CommandInfoByNameReturnsOnCall(i int, result1 sharedaction.CommandInfo, result2 error) {
    80  	fake.CommandInfoByNameStub = nil
    81  	if fake.commandInfoByNameReturnsOnCall == nil {
    82  		fake.commandInfoByNameReturnsOnCall = make(map[int]struct {
    83  			result1 sharedaction.CommandInfo
    84  			result2 error
    85  		})
    86  	}
    87  	fake.commandInfoByNameReturnsOnCall[i] = struct {
    88  		result1 sharedaction.CommandInfo
    89  		result2 error
    90  	}{result1, result2}
    91  }
    92  
    93  func (fake *FakeHelpActor) CommandInfos(arg1 interface{}) map[string]sharedaction.CommandInfo {
    94  	fake.commandInfosMutex.Lock()
    95  	ret, specificReturn := fake.commandInfosReturnsOnCall[len(fake.commandInfosArgsForCall)]
    96  	fake.commandInfosArgsForCall = append(fake.commandInfosArgsForCall, struct {
    97  		arg1 interface{}
    98  	}{arg1})
    99  	fake.recordInvocation("CommandInfos", []interface{}{arg1})
   100  	fake.commandInfosMutex.Unlock()
   101  	if fake.CommandInfosStub != nil {
   102  		return fake.CommandInfosStub(arg1)
   103  	}
   104  	if specificReturn {
   105  		return ret.result1
   106  	}
   107  	return fake.commandInfosReturns.result1
   108  }
   109  
   110  func (fake *FakeHelpActor) CommandInfosCallCount() int {
   111  	fake.commandInfosMutex.RLock()
   112  	defer fake.commandInfosMutex.RUnlock()
   113  	return len(fake.commandInfosArgsForCall)
   114  }
   115  
   116  func (fake *FakeHelpActor) CommandInfosArgsForCall(i int) interface{} {
   117  	fake.commandInfosMutex.RLock()
   118  	defer fake.commandInfosMutex.RUnlock()
   119  	return fake.commandInfosArgsForCall[i].arg1
   120  }
   121  
   122  func (fake *FakeHelpActor) CommandInfosReturns(result1 map[string]sharedaction.CommandInfo) {
   123  	fake.CommandInfosStub = nil
   124  	fake.commandInfosReturns = struct {
   125  		result1 map[string]sharedaction.CommandInfo
   126  	}{result1}
   127  }
   128  
   129  func (fake *FakeHelpActor) CommandInfosReturnsOnCall(i int, result1 map[string]sharedaction.CommandInfo) {
   130  	fake.CommandInfosStub = nil
   131  	if fake.commandInfosReturnsOnCall == nil {
   132  		fake.commandInfosReturnsOnCall = make(map[int]struct {
   133  			result1 map[string]sharedaction.CommandInfo
   134  		})
   135  	}
   136  	fake.commandInfosReturnsOnCall[i] = struct {
   137  		result1 map[string]sharedaction.CommandInfo
   138  	}{result1}
   139  }
   140  
   141  func (fake *FakeHelpActor) Invocations() map[string][][]interface{} {
   142  	fake.invocationsMutex.RLock()
   143  	defer fake.invocationsMutex.RUnlock()
   144  	fake.commandInfoByNameMutex.RLock()
   145  	defer fake.commandInfoByNameMutex.RUnlock()
   146  	fake.commandInfosMutex.RLock()
   147  	defer fake.commandInfosMutex.RUnlock()
   148  	copiedInvocations := map[string][][]interface{}{}
   149  	for key, value := range fake.invocations {
   150  		copiedInvocations[key] = value
   151  	}
   152  	return copiedInvocations
   153  }
   154  
   155  func (fake *FakeHelpActor) recordInvocation(key string, args []interface{}) {
   156  	fake.invocationsMutex.Lock()
   157  	defer fake.invocationsMutex.Unlock()
   158  	if fake.invocations == nil {
   159  		fake.invocations = map[string][][]interface{}{}
   160  	}
   161  	if fake.invocations[key] == nil {
   162  		fake.invocations[key] = [][]interface{}{}
   163  	}
   164  	fake.invocations[key] = append(fake.invocations[key], args)
   165  }
   166  
   167  var _ common.HelpActor = new(FakeHelpActor)