-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f66af2a
commit 544f2e7
Showing
29 changed files
with
282 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
{ | ||
"orgName": "salesforce-plantuml_DEV", | ||
"edition": "Developer", | ||
"features": [], | ||
"settings": { | ||
"lightningExperienceSettings": { | ||
"enableS1DesktopEnabled": true | ||
}, | ||
"mobileSettings": { | ||
"enableS1EncryptedStoragePref2": false | ||
} | ||
} | ||
"features": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>27.0</apiVersion> | ||
<apiVersion>53.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
force-app/main/default/classes/ClassDiagramCreatorCtrl.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>25.0</apiVersion> | ||
<apiVersion>53.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
68 changes: 68 additions & 0 deletions
68
force-app/main/default/classes/ClassDiagramCreatorCtrl_Test.cls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
@IsTest | ||
private class ClassDiagramCreatorCtrl_Test { | ||
|
||
@IsTest | ||
private static void testUIIsPopulatedOnConstructor() { | ||
|
||
// Setup | ||
Boolean noExceptionWasThrown = true; | ||
|
||
|
||
// Execute | ||
Test.setCurrentPageReference(Page.classDiagramCreator); | ||
try { | ||
new ClassDiagramCreatorCtrl(); | ||
} | ||
catch(Exception ignored) { | ||
noExceptionWasThrown = false; | ||
} | ||
|
||
|
||
// Verify | ||
System.assert(noExceptionWasThrown); | ||
} | ||
|
||
|
||
@IsTest | ||
private static void errorShownOnCreateWithNoSelectedClass() { | ||
|
||
// Setup | ||
Test.setCurrentPageReference(Page.classDiagramCreator); | ||
ClassDiagramCreatorCtrl pageCtrl = new ClassDiagramCreatorCtrl(); | ||
|
||
|
||
// Execute | ||
pageCtrl.doCreateDiagram(); | ||
|
||
|
||
// Verify | ||
System.assert(ApexPages.hasMessages()); | ||
} | ||
|
||
|
||
@IsTest | ||
private static void noErrorOnCreateWithSelectedClass() { | ||
|
||
// Setup | ||
Test.setCurrentPageReference(Page.classDiagramCreator); | ||
ClassDiagramCreatorCtrl pageCtrl = new ClassDiagramCreatorCtrl(); | ||
|
||
|
||
// Execute | ||
Boolean hasClasses = pageCtrl.accessibleClasses.size() > 0; | ||
if(hasClasses) { | ||
SelectOption anObject = pageCtrl.accessibleClasses.get(0); | ||
pageCtrl.selectedClasses.add(anObject); | ||
pageCtrl.classDiagram.showPublicMethods = true; | ||
pageCtrl.classDiagram.showPublicVariables = true; | ||
pageCtrl.classDiagram.showMetrics = true; | ||
} | ||
|
||
pageCtrl.doCreateDiagram(); | ||
|
||
|
||
// Verify | ||
System.assert(!hasClasses || !ApexPages.hasMessages()); | ||
System.assert(!hasClasses || pageCtrl.classDiagram.plantUMLText != ''); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
force-app/main/default/classes/ClassDiagramCreatorCtrl_Test.cls-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>53.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@IsTest | ||
private class CodeMetric_Test { | ||
|
||
@IsTest | ||
private static void calculateMethodCCCorrectly() { | ||
|
||
// Setup | ||
ApexClass original = [SELECT Name, Body FROM ApexClass WHERE Name = 'ApexClassForTests']; | ||
|
||
|
||
// Execute && Verify | ||
ApexParser parser = new ApexParser(); | ||
for(ApexParser.ClassMember method : parser.parse(original).members) { | ||
if(method.Name == 'complexityOf7') { | ||
System.assertEquals(7, CodeMetrics.CC(method)); | ||
} | ||
} | ||
} | ||
|
||
|
||
@IsTest | ||
private static void calculateMethodCCIgnoresCommentsAndLiterals() { | ||
|
||
// Setup | ||
ApexClass original = [SELECT Name, Body FROM ApexClass WHERE Name = 'ApexClassForTests']; | ||
|
||
|
||
// Execute + Verify | ||
ApexParser parser = new ApexParser(); | ||
for(ApexParser.ClassMember method : parser.parse(original).members) { | ||
if(method.Name == 'ccCalculationIgnoresCommentsAndLiterals') { | ||
System.assertEquals(1, CodeMetrics.CC(method)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>52.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>27.0</apiVersion> | ||
<apiVersion>53.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>25.0</apiVersion> | ||
<apiVersion>53.0</apiVersion> | ||
<status>Active</status> | ||
</ApexClass> |
Oops, something went wrong.