github.com/olli-ai/jx/v2@v2.0.400-0.20210921045218-14731b4dd448/pkg/kube/resources/mocks/installer.go (about) 1 // Code generated by pegomock. DO NOT EDIT. 2 // Source: github.com/olli-ai/jx/v2/pkg/kube/resources (interfaces: Installer) 3 4 package resources_test 5 6 import ( 7 "reflect" 8 "time" 9 10 pegomock "github.com/petergtz/pegomock" 11 ) 12 13 type MockInstaller struct { 14 fail func(message string, callerSkip ...int) 15 } 16 17 func NewMockInstaller(options ...pegomock.Option) *MockInstaller { 18 mock := &MockInstaller{} 19 for _, option := range options { 20 option.Apply(mock) 21 } 22 return mock 23 } 24 25 func (mock *MockInstaller) SetFailHandler(fh pegomock.FailHandler) { mock.fail = fh } 26 func (mock *MockInstaller) FailHandler() pegomock.FailHandler { return mock.fail } 27 28 func (mock *MockInstaller) Install(_param0 string) (string, error) { 29 if mock == nil { 30 panic("mock must not be nil. Use myMock := NewMockInstaller().") 31 } 32 params := []pegomock.Param{_param0} 33 result := pegomock.GetGenericMockFrom(mock).Invoke("Install", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 34 var ret0 string 35 var ret1 error 36 if len(result) != 0 { 37 if result[0] != nil { 38 ret0 = result[0].(string) 39 } 40 if result[1] != nil { 41 ret1 = result[1].(error) 42 } 43 } 44 return ret0, ret1 45 } 46 47 func (mock *MockInstaller) InstallDir(_param0 string) (string, error) { 48 if mock == nil { 49 panic("mock must not be nil. Use myMock := NewMockInstaller().") 50 } 51 params := []pegomock.Param{_param0} 52 result := pegomock.GetGenericMockFrom(mock).Invoke("InstallDir", params, []reflect.Type{reflect.TypeOf((*string)(nil)).Elem(), reflect.TypeOf((*error)(nil)).Elem()}) 53 var ret0 string 54 var ret1 error 55 if len(result) != 0 { 56 if result[0] != nil { 57 ret0 = result[0].(string) 58 } 59 if result[1] != nil { 60 ret1 = result[1].(error) 61 } 62 } 63 return ret0, ret1 64 } 65 66 func (mock *MockInstaller) VerifyWasCalledOnce() *VerifierMockInstaller { 67 return &VerifierMockInstaller{ 68 mock: mock, 69 invocationCountMatcher: pegomock.Times(1), 70 } 71 } 72 73 func (mock *MockInstaller) VerifyWasCalled(invocationCountMatcher pegomock.Matcher) *VerifierMockInstaller { 74 return &VerifierMockInstaller{ 75 mock: mock, 76 invocationCountMatcher: invocationCountMatcher, 77 } 78 } 79 80 func (mock *MockInstaller) VerifyWasCalledInOrder(invocationCountMatcher pegomock.Matcher, inOrderContext *pegomock.InOrderContext) *VerifierMockInstaller { 81 return &VerifierMockInstaller{ 82 mock: mock, 83 invocationCountMatcher: invocationCountMatcher, 84 inOrderContext: inOrderContext, 85 } 86 } 87 88 func (mock *MockInstaller) VerifyWasCalledEventually(invocationCountMatcher pegomock.Matcher, timeout time.Duration) *VerifierMockInstaller { 89 return &VerifierMockInstaller{ 90 mock: mock, 91 invocationCountMatcher: invocationCountMatcher, 92 timeout: timeout, 93 } 94 } 95 96 type VerifierMockInstaller struct { 97 mock *MockInstaller 98 invocationCountMatcher pegomock.Matcher 99 inOrderContext *pegomock.InOrderContext 100 timeout time.Duration 101 } 102 103 func (verifier *VerifierMockInstaller) Install(_param0 string) *MockInstaller_Install_OngoingVerification { 104 params := []pegomock.Param{_param0} 105 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "Install", params, verifier.timeout) 106 return &MockInstaller_Install_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 107 } 108 109 type MockInstaller_Install_OngoingVerification struct { 110 mock *MockInstaller 111 methodInvocations []pegomock.MethodInvocation 112 } 113 114 func (c *MockInstaller_Install_OngoingVerification) GetCapturedArguments() string { 115 _param0 := c.GetAllCapturedArguments() 116 return _param0[len(_param0)-1] 117 } 118 119 func (c *MockInstaller_Install_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { 120 params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) 121 if len(params) > 0 { 122 _param0 = make([]string, len(c.methodInvocations)) 123 for u, param := range params[0] { 124 _param0[u] = param.(string) 125 } 126 } 127 return 128 } 129 130 func (verifier *VerifierMockInstaller) InstallDir(_param0 string) *MockInstaller_InstallDir_OngoingVerification { 131 params := []pegomock.Param{_param0} 132 methodInvocations := pegomock.GetGenericMockFrom(verifier.mock).Verify(verifier.inOrderContext, verifier.invocationCountMatcher, "InstallDir", params, verifier.timeout) 133 return &MockInstaller_InstallDir_OngoingVerification{mock: verifier.mock, methodInvocations: methodInvocations} 134 } 135 136 type MockInstaller_InstallDir_OngoingVerification struct { 137 mock *MockInstaller 138 methodInvocations []pegomock.MethodInvocation 139 } 140 141 func (c *MockInstaller_InstallDir_OngoingVerification) GetCapturedArguments() string { 142 _param0 := c.GetAllCapturedArguments() 143 return _param0[len(_param0)-1] 144 } 145 146 func (c *MockInstaller_InstallDir_OngoingVerification) GetAllCapturedArguments() (_param0 []string) { 147 params := pegomock.GetGenericMockFrom(c.mock).GetInvocationParams(c.methodInvocations) 148 if len(params) > 0 { 149 _param0 = make([]string, len(c.methodInvocations)) 150 for u, param := range params[0] { 151 _param0[u] = param.(string) 152 } 153 } 154 return 155 }