Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5ceafa7

Browse files
committed
Merge pull request apex-enterprise-patterns#101 from financialforcedev/feature/use-mocks-generator-4.0.0
Regenerated fflib_SObjectMocks with mocks generator 4.0.0
2 parents 3287d43 + 1fa5703 commit 5ceafa7

File tree

1 file changed

+24
-156
lines changed

1 file changed

+24
-156
lines changed
+24-156
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,6 @@
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
334
{
345
public virtual class SObjectDomain implements fflib_ISObjectDomain
356
{
@@ -40,67 +11,15 @@ public class fflib_SObjectMocks
4011
this.mocks = mocks;
4112
}
4213

43-
public SObjectType sObjectType()
14+
public Schema.SObjectType sObjectType()
4415
{
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> {});
7217
}
7318

7419
public List<SObject> getRecords()
7520
{
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+
}
10423
}
10524

10625
public virtual class SObjectSelector implements fflib_ISObjectSelector
@@ -114,64 +33,12 @@ public class fflib_SObjectMocks
11433

11534
public Schema.SObjectType sObjectType()
11635
{
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> {});
14437
}
14538

14639
public List<SObject> selectSObjectsById(Set<Id> idSet)
14740
{
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});
17542
}
17643
}
17744

@@ -186,57 +53,58 @@ public class fflib_SObjectMocks
18653

18754
public void registerNew(SObject record)
18855
{
189-
mocks.mockVoidMethod(this, 'registerNew', new List<Object> {record});
56+
mocks.mockVoidMethod(this, 'registerNew', new List<Type> {SObject.class}, new List<Object> {record});
19057
}
191-
58+
19259
public void registerNew(List<SObject> records)
19360
{
194-
mocks.mockVoidMethod(this, 'registerNew', new List<Object> {records});
61+
mocks.mockVoidMethod(this, 'registerNew', new List<Type> {List<SObject>.class}, new List<Object> {records});
19562
}
19663

19764
public void registerNew(SObject record, Schema.sObjectField relatedToParentField, SObject relatedToParentRecord)
19865
{
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});
20067
}
20168

20269
public void registerRelationship(SObject record, Schema.sObjectField relatedToField, SObject relatedTo)
20370
{
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});
20572
}
20673

20774
public void registerDirty(SObject record)
20875
{
209-
mocks.mockVoidMethod(this, 'registerDirty', new List<Object> {record});
76+
mocks.mockVoidMethod(this, 'registerDirty', new List<Type> {SObject.class}, new List<Object> {record});
21077
}
211-
78+
21279
public void registerDirty(List<SObject> records)
21380
{
214-
mocks.mockVoidMethod(this, 'registerDirty', new List<Object> {records});
81+
mocks.mockVoidMethod(this, 'registerDirty', new List<Type> {List<SObject>.class}, new List<Object> {records});
21582
}
21683

21784
public void registerDeleted(SObject record)
21885
{
219-
mocks.mockVoidMethod(this, 'registerDeleted', new List<Object> {record});
86+
mocks.mockVoidMethod(this, 'registerDeleted', new List<Type> {SObject.class}, new List<Object> {record});
22087
}
221-
88+
22289
public void registerDeleted(List<SObject> records)
22390
{
224-
mocks.mockVoidMethod(this, 'registerDeleted', new List<Object> {records});
91+
mocks.mockVoidMethod(this, 'registerDeleted', new List<Type> {List<SObject>.class}, new List<Object> {records});
22592
}
22693

22794
public void commitWork()
22895
{
229-
mocks.mockVoidMethod(this, 'commitWork', new List<Object> {});
96+
mocks.mockVoidMethod(this, 'commitWork', new List<Type> {}, new List<Object> {});
23097
}
23198

23299
public void registerWork(fflib_SObjectUnitOfWork.IDoWork work)
233100
{
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});
235102
}
236103

237104
public void registerEmail(Messaging.Email email)
238105
{
239-
mocks.mockVoidMethod(this, 'registerEmail', new List<Object> {email});
106+
mocks.mockVoidMethod(this, 'registerEmail', new List<Type> {Messaging.Email.class}, new List<Object> {email});
240107
}
241108
}
109+
242110
}

0 commit comments

Comments
 (0)