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
// Creates an instance of the class MyUser | |
MyUser adminUser = new MyUser(); | |
adminUser.username = 'admin'; | |
adminUser.password = 'admin'; | |
// non-static method, it needs to be called from each instance | |
adminUser.validateCredentials(); | |
// Creates another instance of the class MyUser | |
MyUser regularUser = new MyUser(); |
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
SFDX_API_VERSION=46.0 sfdx force:org:create -f config/project-scratch-def.json -a PreviewOrg -v DevHub release=Preview |
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
sfdx force:config:set apiVersion=46.0 --global |
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
sfdx force:org:create -f config/project-scratch-def.json -a PreviewOrg -v DevHub release=Preview |
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
{ | |
"orgName": "Dreamhouse", | |
"edition": "Developer", | |
"release": "Preview", | |
"settings": { | |
"orgPreferenceSettings": { | |
"s1DesktopEnabled": true, | |
"selfSetPasswordInApi": true, | |
"s1EncryptedStoragePref2": false | |
} |
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
<apex:page controller="CodeCoverageController" showHeader="true" sidebar="false" docType="html-5.0"> | |
<apex:slds /> | |
<apex:form id="codeCoverageForm"> | |
<apex:outputPanel id="codeCoverageRepeat" style="justify-content: left;"> | |
<br/> | |
<div class="centered"> | |
<div class="slds-text-heading_large"> | |
<span> | |
<h2 style="justify-content: center;">Code Coverage information: </h2> | |
</span> |
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
public class CodeCoverageController { | |
public String messageUnder10 { | |
get { return CodeCoverageHelper.MESSAGE_UNDER_10; } | |
private set; | |
} | |
public String messageUnder75 { | |
get { return CodeCoverageHelper.MESSAGE_UNDER_75; } | |
private set; |
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
public class CodeCoverageHelper { | |
//This method will return a Map of Classes Names and the respective Code Coverage | |
public static Map<String, Decimal> getCodeCoverage() { | |
Map<String, Decimal> resultMap = new Map<String, Decimal>(); | |
string queryStr = 'SELECT+NumLinesCovered,ApexClassOrTriggerId,ApexClassOrTrigger.Name,NumLinesUncovered,Coverage+FROM+ApexCodeCoverageAggregate+ORDER+BY+ApexClassOrTrigger.Name'; | |
String ENDPOINT = 'https://' + System.URL.getSalesforceBaseUrl().getHost() + '/services/data/v40.0/tooling/'; | |
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
public class CodeCoverageWrapper { | |
public class ApexClassOrTrigger { | |
public Attributes attributes {get;set;} | |
public String Name {get;set;} | |
public ApexClassOrTrigger(JSONParser parser) { | |
while (parser.nextToken() != System.JSONToken.END_OBJECT) { | |
if (parser.getCurrentToken() == System.JSONToken.FIELD_NAME) { | |
String text = parser.getText(); |
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
String baseURL = 'https://' + System.URL.getSalesforceBaseUrl().getHost(); | |
string queryStr = 'SELECT+NumLinesCovered,ApexClassOrTriggerId,ApexClassOrTrigger.Name,NumLinesUncovered,Coverage+FROM+ApexCodeCoverageAggregate'; | |
String ENDPOINT = baseURL + '/services/data/v40.0/tooling/'; | |
HttpRequest req = new HttpRequest(); | |
req.setEndpoint(ENDPOINT + 'query/?q=' + queryStr); | |
req.setHeader('Authorization', 'Bearer ' + UserInfo.getSessionID()); |