/
command_moq.go
80 lines (73 loc) · 2.25 KB
/
command_moq.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package clientsholder
import (
"sync"
)
// Ensure, that CommandMock does implement Command.
// If this is not the case, regenerate this file with moq.
var _ Command = &CommandMock{}
// CommandMock is a mock implementation of Command.
//
// func TestSomethingThatUsesCommand(t *testing.T) {
//
// // make and configure a mocked Command
// mockedCommand := &CommandMock{
// ExecCommandContainerFunc: func(context Context, s string) (string, string, error) {
// panic("mock out the ExecCommandContainer method")
// },
// }
//
// // use mockedCommand in code that requires Command
// // and then make assertions.
//
// }
type CommandMock struct {
// ExecCommandContainerFunc mocks the ExecCommandContainer method.
ExecCommandContainerFunc func(context Context, s string) (string, string, error)
// calls tracks calls to the methods.
calls struct {
// ExecCommandContainer holds details about calls to the ExecCommandContainer method.
ExecCommandContainer []struct {
// Context is the context argument value.
Context Context
// S is the s argument value.
S string
}
}
lockExecCommandContainer sync.RWMutex
}
// ExecCommandContainer calls ExecCommandContainerFunc.
func (mock *CommandMock) ExecCommandContainer(context Context, s string) (string, string, error) {
if mock.ExecCommandContainerFunc == nil {
panic("CommandMock.ExecCommandContainerFunc: method is nil but Command.ExecCommandContainer was just called")
}
callInfo := struct {
Context Context
S string
}{
Context: context,
S: s,
}
mock.lockExecCommandContainer.Lock()
mock.calls.ExecCommandContainer = append(mock.calls.ExecCommandContainer, callInfo)
mock.lockExecCommandContainer.Unlock()
return mock.ExecCommandContainerFunc(context, s)
}
// ExecCommandContainerCalls gets all the calls that were made to ExecCommandContainer.
// Check the length with:
//
// len(mockedCommand.ExecCommandContainerCalls())
func (mock *CommandMock) ExecCommandContainerCalls() []struct {
Context Context
S string
} {
var calls []struct {
Context Context
S string
}
mock.lockExecCommandContainer.RLock()
calls = mock.calls.ExecCommandContainer
mock.lockExecCommandContainer.RUnlock()
return calls
}