-
Notifications
You must be signed in to change notification settings - Fork 0
/
generator.go
104 lines (94 loc) · 2.67 KB
/
generator.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
"github.com/ONSdigital/dp-cantabular-csv-exporter/handler"
"sync"
"time"
)
// Ensure, that GeneratorMock does implement handler.Generator.
// If this is not the case, regenerate this file with moq.
var _ handler.Generator = &GeneratorMock{}
// GeneratorMock is a mock implementation of handler.Generator.
//
// func TestSomethingThatUsesGenerator(t *testing.T) {
//
// // make and configure a mocked handler.Generator
// mockedGenerator := &GeneratorMock{
// NewPSKFunc: func() ([]byte, error) {
// panic("mock out the NewPSK method")
// },
// TimestampFunc: func() time.Time {
// panic("mock out the Timestamp method")
// },
// }
//
// // use mockedGenerator in code that requires handler.Generator
// // and then make assertions.
//
// }
type GeneratorMock struct {
// NewPSKFunc mocks the NewPSK method.
NewPSKFunc func() ([]byte, error)
// TimestampFunc mocks the Timestamp method.
TimestampFunc func() time.Time
// calls tracks calls to the methods.
calls struct {
// NewPSK holds details about calls to the NewPSK method.
NewPSK []struct {
}
// Timestamp holds details about calls to the Timestamp method.
Timestamp []struct {
}
}
lockNewPSK sync.RWMutex
lockTimestamp sync.RWMutex
}
// NewPSK calls NewPSKFunc.
func (mock *GeneratorMock) NewPSK() ([]byte, error) {
if mock.NewPSKFunc == nil {
panic("GeneratorMock.NewPSKFunc: method is nil but Generator.NewPSK was just called")
}
callInfo := struct {
}{}
mock.lockNewPSK.Lock()
mock.calls.NewPSK = append(mock.calls.NewPSK, callInfo)
mock.lockNewPSK.Unlock()
return mock.NewPSKFunc()
}
// NewPSKCalls gets all the calls that were made to NewPSK.
// Check the length with:
// len(mockedGenerator.NewPSKCalls())
func (mock *GeneratorMock) NewPSKCalls() []struct {
} {
var calls []struct {
}
mock.lockNewPSK.RLock()
calls = mock.calls.NewPSK
mock.lockNewPSK.RUnlock()
return calls
}
// Timestamp calls TimestampFunc.
func (mock *GeneratorMock) Timestamp() time.Time {
if mock.TimestampFunc == nil {
panic("GeneratorMock.TimestampFunc: method is nil but Generator.Timestamp was just called")
}
callInfo := struct {
}{}
mock.lockTimestamp.Lock()
mock.calls.Timestamp = append(mock.calls.Timestamp, callInfo)
mock.lockTimestamp.Unlock()
return mock.TimestampFunc()
}
// TimestampCalls gets all the calls that were made to Timestamp.
// Check the length with:
// len(mockedGenerator.TimestampCalls())
func (mock *GeneratorMock) TimestampCalls() []struct {
} {
var calls []struct {
}
mock.lockTimestamp.RLock()
calls = mock.calls.Timestamp
mock.lockTimestamp.RUnlock()
return calls
}