github.com/liamawhite/cli-with-i18n@v6.32.1-0.20171122084555-dede0a5c3448+incompatible/cf/manifest/manifestfakes/fake_repository.go (about) 1 // This file was generated by counterfeiter 2 package manifestfakes 3 4 import ( 5 "sync" 6 7 "github.com/liamawhite/cli-with-i18n/cf/manifest" 8 ) 9 10 type FakeRepository struct { 11 ReadManifestStub func(string) (*manifest.Manifest, error) 12 readManifestMutex sync.RWMutex 13 readManifestArgsForCall []struct { 14 arg1 string 15 } 16 readManifestReturns struct { 17 result1 *manifest.Manifest 18 result2 error 19 } 20 invocations map[string][][]interface{} 21 invocationsMutex sync.RWMutex 22 } 23 24 func (fake *FakeRepository) ReadManifest(arg1 string) (*manifest.Manifest, error) { 25 fake.readManifestMutex.Lock() 26 fake.readManifestArgsForCall = append(fake.readManifestArgsForCall, struct { 27 arg1 string 28 }{arg1}) 29 fake.recordInvocation("ReadManifest", []interface{}{arg1}) 30 fake.readManifestMutex.Unlock() 31 if fake.ReadManifestStub != nil { 32 return fake.ReadManifestStub(arg1) 33 } else { 34 return fake.readManifestReturns.result1, fake.readManifestReturns.result2 35 } 36 } 37 38 func (fake *FakeRepository) ReadManifestCallCount() int { 39 fake.readManifestMutex.RLock() 40 defer fake.readManifestMutex.RUnlock() 41 return len(fake.readManifestArgsForCall) 42 } 43 44 func (fake *FakeRepository) ReadManifestArgsForCall(i int) string { 45 fake.readManifestMutex.RLock() 46 defer fake.readManifestMutex.RUnlock() 47 return fake.readManifestArgsForCall[i].arg1 48 } 49 50 func (fake *FakeRepository) ReadManifestReturns(result1 *manifest.Manifest, result2 error) { 51 fake.ReadManifestStub = nil 52 fake.readManifestReturns = struct { 53 result1 *manifest.Manifest 54 result2 error 55 }{result1, result2} 56 } 57 58 func (fake *FakeRepository) Invocations() map[string][][]interface{} { 59 fake.invocationsMutex.RLock() 60 defer fake.invocationsMutex.RUnlock() 61 fake.readManifestMutex.RLock() 62 defer fake.readManifestMutex.RUnlock() 63 return fake.invocations 64 } 65 66 func (fake *FakeRepository) recordInvocation(key string, args []interface{}) { 67 fake.invocationsMutex.Lock() 68 defer fake.invocationsMutex.Unlock() 69 if fake.invocations == nil { 70 fake.invocations = map[string][][]interface{}{} 71 } 72 if fake.invocations[key] == nil { 73 fake.invocations[key] = [][]interface{}{} 74 } 75 fake.invocations[key] = append(fake.invocations[key], args) 76 } 77 78 var _ manifest.Repository = new(FakeRepository)