Skip to content

Commit 19717f9

Browse files
committed
checkpoint - solved most issues
1 parent 46493f8 commit 19717f9

File tree

7 files changed

+13
-17
lines changed

7 files changed

+13
-17
lines changed

force-app/main/default/classes/DatabaseLayer.cls

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@ public class DatabaseLayer {
55
* Use the `Dml` and `Soql` static properties to get the correct instance of each.
66
* Automatically inject mock versions of these classes via the `useMocks()` method.
77
**/
8-
// **** CONSTANTS **** //
98
public static final DatabaseLayerUtils UTILS;
109
private static final DatabaseLayer INSTANCE;
1110

11+
private Dml currentDml;
12+
private SoqlProvider currentSoql;
13+
1214
static {
1315
INSTANCE = new DatabaseLayer();
1416
UTILS = new DatabaseLayerUtils(INSTANCE);
1517
}
1618

17-
// **** MEMBER **** //
18-
private Dml currentDml;
19-
private SoqlProvider currentSoql;
20-
2119
private DatabaseLayer() {
2220
this.currentDml = new Dml(this);
2321
this.currentSoql = new SoqlProvider(this);

force-app/main/default/classes/DatabaseLayerTestUtils.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressWarnings('PMD.ApexDoc')
1+
@SuppressWarnings('PMD.ApexDoc,PMD.FieldNamingConventions,PMD.UnusedLocalVariable')
22
@IsTest
33
public class DatabaseLayerTestUtils {
44
public static final PreAndPostProcessorSpy DmlPluginSpy = new PreAndPostProcessorSpy();

force-app/main/default/classes/Dml.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@SuppressWarnings(
2-
'PMD.ApexDoc,PMD.CognitiveComplexity,PMD.CyclomaticComplexity,PMD.EmptyStatementBlock,PMD.ExcessiveParameterList,PMD.ExcessivePublicCount'
2+
'PMD.ApexDoc,PMD.CognitiveComplexity,PMD.CyclomaticComplexity,PMD.EmptyStatementBlock,PMD.ExcessiveParameterList,PMD.ExcessivePublicCount,PMD.FieldNamingConventions'
33
)
44
public inherited sharing virtual class Dml {
55
/**

force-app/main/default/classes/MockDml.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ public class MockDml extends Dml {
620620
public String name { get; private set; }
621621
public Boolean wasReleased { get; private set; }
622622
public Boolean wasRolledBack { get; private set; }
623-
private transient MockDml.Database savepointState;
623+
private transient MockDml.Database savepointState { get; private set; }
624624

625625
private Savepoint(System.Savepoint savepoint, Integer index) {
626626
this.index = index;

force-app/main/default/classes/MockRecord.cls

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class MockRecord {
1717
private transient SObjectType objectType;
1818
private transient Map<String, Object> recordValues;
1919

20+
@SuppressWarnings('PMD.PropertyNamingConventions')
2021
public Id Id {
2122
get {
2223
// Mirrors standard SObject functionality; all SObject records have an Id property - even untyped!
@@ -221,8 +222,9 @@ public class MockRecord {
221222
private class RelatedList {
222223
// Represents a child object relationship retrieved by SOQL.
223224
// This structure is required when mocking related lists on an SObject
224-
// ** Members
225225
private Boolean done;
226+
private transient List<MockRecord> mockRecords;
227+
private transient List<SObject> realRecords;
226228
private List<SObject> records {
227229
get {
228230
return this.getRecords();
@@ -233,9 +235,6 @@ public class MockRecord {
233235
return this.getSize();
234236
}
235237
}
236-
// ** Transient
237-
private transient List<MockRecord> mockRecords;
238-
private transient List<SObject> realRecords;
239238

240239
private RelatedList() {
241240
this.done = true;

force-app/main/default/classes/MockSoqlTest.cls

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressWarnings('PMD.ApexDoc,PMD.ApexUnitTestClassShouldHaveRunAs')
1+
@SuppressWarnings('PMD.ApexDoc,PMD.ApexUnitTestClassShouldHaveRunAs,PMD.CyclomaticComplexity')
22
@IsTest
33
private class MockSoqlTest {
44
// **** CONSTANTS **** //

force-app/main/default/classes/Soql.cls

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ public inherited sharing virtual class Soql extends Soql.Builder {
902902
}
903903
}
904904

905-
@SuppressWarnings('PMD.ExcessiveParameterCount')
905+
@SuppressWarnings('PMD.ExcessiveParameterList')
906906
public class ParentField implements Soql.Selectable {
907907
// Represents a reference to a SObjectField on a parent (or multi-grandparent) object, ex., "Account.Owner.Profile.Name"
908908
// SOQL supports querying fields objects up to 5 relationships away from the FROM object
@@ -1011,9 +1011,8 @@ public inherited sharing virtual class Soql extends Soql.Builder {
10111011
public Boolean isMockSoql { get; protected set; }
10121012
public Soql.Operation operation { get; private set; }
10131013
public Soql query { get; private set; }
1014-
protected transient System.AccessLevel accessLevel;
1015-
protected transient Map<String, Object> binds;
1016-
// ** Getters:
1014+
protected transient System.AccessLevel accessLevel { get; private set; }
1015+
protected transient Map<String, Object> binds { get; private set; }
10171016
public String queryString {
10181017
get {
10191018
return this.query?.toString();

0 commit comments

Comments
 (0)