1
- /**
2
- * Copyright (c), FinancialForce.com, inc
3
- * All rights reserved.
4
- *
5
- * Redistribution and use in source and binary forms, with or without modification,
6
- * are permitted provided that the following conditions are met:
7
- *
8
- * - Redistributions of source code must retain the above copyright notice,
9
- * this list of conditions and the following disclaimer.
10
- * - Redistributions in binary form must reproduce the above copyright notice,
11
- * this list of conditions and the following disclaimer in the documentation
12
- * and/or other materials provided with the distribution.
13
- * - Neither the name of the FinancialForce.com, inc nor the names of its contributors
14
- * may be used to endorse or promote products derived from this software without
15
- * specific prior written permission.
16
- *
17
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
20
- * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
- **/
26
-
27
- /**
28
- * This is a generated class with some manual modifications
29
- * Use the Apex Mocks Generator, then re-apply the 'virtual' modifier
30
- **/
31
- @IsTest
32
- public class fflib_SObjectMocks
1
+ /* Generated by apex-mocks-generator version 4.0.0 */
2
+ @isTest
3
+ public class fflib_SObjectMocks
33
4
{
34
5
public virtual class SObjectDomain implements fflib_ISObjectDomain
35
6
{
@@ -40,67 +11,15 @@ public class fflib_SObjectMocks
40
11
this .mocks = mocks ;
41
12
}
42
13
43
- public SObjectType sObjectType ()
14
+ public Schema. SObjectType sObjectType ()
44
15
{
45
- if (mocks .Verifying )
46
- {
47
- mocks .verifyMethodCall (this , ' sObjectType' , new List <Object > {});
48
- }
49
- else if (mocks .Stubbing )
50
- {
51
- mocks .prepareMethodReturnValue (this , ' sObjectType' , new List <Object > {});
52
- return null ;
53
- }
54
- else
55
- {
56
- mocks .recordMethod (this , ' sObjectType' , new List <Object > {});
57
-
58
- fflib_MethodReturnValue methodReturnValue = mocks .getMethodReturnValue (this , ' sObjectType' , new List <Object > {});
59
-
60
- if (methodReturnValue != null )
61
- {
62
- if (methodReturnValue .ReturnValue instanceof Exception )
63
- {
64
- throw ((Exception ) methodReturnValue .ReturnValue );
65
- }
66
-
67
- return (SObjectType ) methodReturnValue .ReturnValue ;
68
- }
69
- }
70
-
71
- return null ;
16
+ return (Schema .SObjectType ) mocks .mockNonVoidMethod (this , ' sObjectType' , new List <Type > {}, new List <Object > {});
72
17
}
73
18
74
19
public List <SObject > getRecords ()
75
20
{
76
- if (mocks .Verifying )
77
- {
78
- mocks .verifyMethodCall (this , ' getRecords' , new List <Object > {});
79
- }
80
- else if (mocks .Stubbing )
81
- {
82
- mocks .prepareMethodReturnValue (this , ' getRecords' , new List <Object > {});
83
- return null ;
84
- }
85
- else
86
- {
87
- mocks .recordMethod (this , ' getRecords' , new List <Object > {});
88
-
89
- fflib_MethodReturnValue methodReturnValue = mocks .getMethodReturnValue (this , ' getRecords' , new List <Object > {});
90
-
91
- if (methodReturnValue != null )
92
- {
93
- if (methodReturnValue .ReturnValue instanceof Exception )
94
- {
95
- throw ((Exception ) methodReturnValue .ReturnValue );
96
- }
97
-
98
- return (List <SObject >) methodReturnValue .ReturnValue ;
99
- }
100
- }
101
-
102
- return null ;
103
- }
21
+ return (List <SObject >) mocks .mockNonVoidMethod (this , ' getRecords' , new List <Type > {}, new List <Object > {});
22
+ }
104
23
}
105
24
106
25
public virtual class SObjectSelector implements fflib_ISObjectSelector
@@ -114,64 +33,12 @@ public class fflib_SObjectMocks
114
33
115
34
public Schema.SObjectType sObjectType ()
116
35
{
117
- if (mocks .Verifying )
118
- {
119
- mocks .verifyMethodCall (this , ' sObjectType' , new List <Object > {});
120
- }
121
- else if (mocks .Stubbing )
122
- {
123
- mocks .prepareMethodReturnValue (this , ' sObjectType' , new List <Object > {});
124
- return null ;
125
- }
126
- else
127
- {
128
- mocks .recordMethod (this , ' sObjectType' , new List <Object > {});
129
-
130
- fflib_MethodReturnValue methodReturnValue = mocks .getMethodReturnValue (this , ' sObjectType' , new List <Object > {});
131
-
132
- if (methodReturnValue != null )
133
- {
134
- if (methodReturnValue .ReturnValue instanceof Exception )
135
- {
136
- throw ((Exception ) methodReturnValue .ReturnValue );
137
- }
138
-
139
- return (Schema .SObjectType ) methodReturnValue .ReturnValue ;
140
- }
141
- }
142
-
143
- return null ;
36
+ return (Schema .SObjectType ) mocks .mockNonVoidMethod (this , ' sObjectType' , new List <Type > {}, new List <Object > {});
144
37
}
145
38
146
39
public List <SObject > selectSObjectsById (Set <Id > idSet )
147
40
{
148
- if (mocks .Verifying )
149
- {
150
- mocks .verifyMethodCall (this , ' selectSObjectsById' , new List <Object > {idSet });
151
- }
152
- else if (mocks .Stubbing )
153
- {
154
- mocks .prepareMethodReturnValue (this , ' selectSObjectsById' , new List <Object > {idSet });
155
- return null ;
156
- }
157
- else
158
- {
159
- mocks .recordMethod (this , ' selectSObjectsById' , new List <Object > {idSet });
160
-
161
- fflib_MethodReturnValue methodReturnValue = mocks .getMethodReturnValue (this , ' selectSObjectsById' , new List <Object > {idSet });
162
-
163
- if (methodReturnValue != null )
164
- {
165
- if (methodReturnValue .ReturnValue instanceof Exception )
166
- {
167
- throw ((Exception ) methodReturnValue .ReturnValue );
168
- }
169
-
170
- return (List <SObject >) methodReturnValue .ReturnValue ;
171
- }
172
- }
173
-
174
- return null ;
41
+ return (List <SObject >) mocks .mockNonVoidMethod (this , ' selectSObjectsById' , new List <Type > {Set <Id >.class }, new List <Object > {idSet });
175
42
}
176
43
}
177
44
@@ -186,57 +53,58 @@ public class fflib_SObjectMocks
186
53
187
54
public void registerNew (SObject record )
188
55
{
189
- mocks .mockVoidMethod (this , ' registerNew' , new List <Object > {record });
56
+ mocks .mockVoidMethod (this , ' registerNew' , new List <Type > { SObject . class }, new List < Object > {record });
190
57
}
191
-
58
+
192
59
public void registerNew (List <SObject > records )
193
60
{
194
- mocks .mockVoidMethod (this , ' registerNew' , new List <Object > {records });
61
+ mocks .mockVoidMethod (this , ' registerNew' , new List <Type > { List < SObject >. class }, new List < Object > {records });
195
62
}
196
63
197
64
public void registerNew (SObject record , Schema.sObjectField relatedToParentField , SObject relatedToParentRecord )
198
65
{
199
- mocks .mockVoidMethod (this , ' registerNew' , new List <Object > {record , relatedToParentField , relatedToParentRecord });
66
+ mocks .mockVoidMethod (this , ' registerNew' , new List <Type > { SObject . class , Schema . sObjectField . class , SObject . class }, new List < Object > {record , relatedToParentField , relatedToParentRecord });
200
67
}
201
68
202
69
public void registerRelationship (SObject record , Schema.sObjectField relatedToField , SObject relatedTo )
203
70
{
204
- mocks .mockVoidMethod (this , ' registerRelationship' , new List <Object > {record , relatedToField , relatedTo });
71
+ mocks .mockVoidMethod (this , ' registerRelationship' , new List <Type > { SObject . class , Schema . sObjectField . class , SObject . class }, new List < Object > {record , relatedToField , relatedTo });
205
72
}
206
73
207
74
public void registerDirty (SObject record )
208
75
{
209
- mocks .mockVoidMethod (this , ' registerDirty' , new List <Object > {record });
76
+ mocks .mockVoidMethod (this , ' registerDirty' , new List <Type > { SObject . class }, new List < Object > {record });
210
77
}
211
-
78
+
212
79
public void registerDirty (List <SObject > records )
213
80
{
214
- mocks .mockVoidMethod (this , ' registerDirty' , new List <Object > {records });
81
+ mocks .mockVoidMethod (this , ' registerDirty' , new List <Type > { List < SObject >. class }, new List < Object > {records });
215
82
}
216
83
217
84
public void registerDeleted (SObject record )
218
85
{
219
- mocks .mockVoidMethod (this , ' registerDeleted' , new List <Object > {record });
86
+ mocks .mockVoidMethod (this , ' registerDeleted' , new List <Type > { SObject . class }, new List < Object > {record });
220
87
}
221
-
88
+
222
89
public void registerDeleted (List <SObject > records )
223
90
{
224
- mocks .mockVoidMethod (this , ' registerDeleted' , new List <Object > {records });
91
+ mocks .mockVoidMethod (this , ' registerDeleted' , new List <Type > { List < SObject >. class }, new List < Object > {records });
225
92
}
226
93
227
94
public void commitWork ()
228
95
{
229
- mocks .mockVoidMethod (this , ' commitWork' , new List <Object > {});
96
+ mocks .mockVoidMethod (this , ' commitWork' , new List <Type > {}, new List < Object > {});
230
97
}
231
98
232
99
public void registerWork (fflib_SObjectUnitOfWork.IDoWork work )
233
100
{
234
- mocks .mockVoidMethod (this , ' registerWork' , new List <Object > {work });
101
+ mocks .mockVoidMethod (this , ' registerWork' , new List <Type > { fflib_SObjectUnitOfWork . IDoWork . class }, new List < Object > {work });
235
102
}
236
103
237
104
public void registerEmail (Messaging.Email email )
238
105
{
239
- mocks .mockVoidMethod (this , ' registerEmail' , new List <Object > {email });
106
+ mocks .mockVoidMethod (this , ' registerEmail' , new List <Type > { Messaging . Email . class }, new List < Object > {email });
240
107
}
241
108
}
109
+
242
110
}
0 commit comments