Skip to content

Commit

Permalink
Migrated to new System.Assert class, added System namespace to severa…
Browse files Browse the repository at this point in the history
…l references (#409)

* Migrated all asserts to use the new class System.Assert

* Added the System namespace to all of the following references 
  - Classes: Exception, AuraHandledException, CalloutException, and IllegalArgumentException, Http, HttpRequest, and HttpResponse, SObjectAccessDecision, and UserInfo
  - Enums: AccessType and LoggingLevel
  • Loading branch information
jongpie authored Nov 23, 2022
1 parent 125b08c commit e6448bd
Show file tree
Hide file tree
Showing 127 changed files with 7,294 additions and 6,950 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.

## Unlocked Package - v4.9.3
## Unlocked Package - v4.9.4

[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023R7sQAE)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023R7sQAE)
[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023R8WQAU)
[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000023R8WQAU)
[![View Documentation](./images/btn-view-documentation.png)](https://jongpie.github.io/NebulaLogger/)

## Managed Package - v4.9.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public with sharing class ChangePasswordControllerTest {
controller.newPassword = 'qwerty1';
controller.verifyNewPassword = 'qwerty1';

System.assertEquals(controller.changePassword(), null);
System.Assert.areEqual(controller.changePassword(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public with sharing class ForgotPasswordControllerTest {
ForgotPasswordController controller = new ForgotPasswordController();
controller.username = 'test@salesforce.com';

System.assertEquals(controller.forgotPassword(), null);
System.Assert.areEqual(controller.forgotPassword(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public with sharing class MicrobatchSelfRegControllerTest {
controller.communityNickname = 'test';

// registerUser will always return null when the page isn't accessed as a guest user
System.assert(controller.registerUser() == null);
System.Assert.isTrue(controller.registerUser() == null);
}
}
6 changes: 3 additions & 3 deletions config/experience-cloud/classes/MyProfilePageController.cls
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public with sharing class MyProfilePageController {
fax,
contact.email
FROM User
WHERE id = :UserInfo.getUserId()
WHERE id = :System.UserInfo.getUserId()
];
// guest users should never be able to access this page
if (user.usertype == 'GUEST') {
Expand All @@ -55,7 +55,7 @@ public with sharing class MyProfilePageController {
try {
update user;
isEdit = false;
} catch (DmlException e) {
} catch (System.DmlException e) {
ApexPages.addMessages(e);
}
}
Expand Down Expand Up @@ -89,7 +89,7 @@ public with sharing class MyProfilePageController {
fax,
contact.email
FROM User
WHERE id = :UserInfo.getUserId()
WHERE id = :System.UserInfo.getUserId()
];
}
}
28 changes: 14 additions & 14 deletions config/experience-cloud/classes/MyProfilePageControllerTest.cls
Original file line number Diff line number Diff line change
Expand Up @@ -13,47 +13,47 @@ public with sharing class MyProfilePageControllerTest {
User currentUser = [
SELECT id, title, firstname, lastname, email, phone, mobilephone, fax, street, city, state, postalcode, country
FROM User
WHERE id = :UserInfo.getUserId()
WHERE id = :System.UserInfo.getUserId()
];
MyProfilePageController controller = new MyProfilePageController();
System.assertEquals(currentUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
System.assert(controller.getIsEdit() == false, 'isEdit should default to false');
System.Assert.areEqual(currentUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
System.Assert.isTrue(controller.getIsEdit() == false, 'isEdit should default to false');
controller.edit();
System.assert(controller.getIsEdit() == true);
System.Assert.isTrue(controller.getIsEdit() == true);
controller.cancel();
System.assert(controller.getIsEdit() == false);
System.Assert.isTrue(controller.getIsEdit() == false);

System.assert(Page.ChangePassword.getUrl().equals(controller.changePassword().getUrl()));
System.Assert.isTrue(Page.ChangePassword.getUrl().equals(controller.changePassword().getUrl()));

String randFax = Math.rint(Math.random() * 1000) + '5551234';
controller.getUser().Fax = randFax;
controller.save();
System.assert(controller.getIsEdit() == false);
System.Assert.isTrue(controller.getIsEdit() == false);

currentUser = [SELECT id, fax FROM User WHERE id = :currentUser.Id];
System.assert(currentUser.fax == randFax);
System.Assert.isTrue(currentUser.fax == randFax);
} else {
User existingPortalUser = existingPortalUsers[0];
String randFax = Math.rint(Math.random() * 1000) + '5551234';

System.runAs(existingPortalUser) {
MyProfilePageController controller = new MyProfilePageController();
System.assertEquals(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
System.assert(controller.getIsEdit() == false, 'isEdit should default to false');
System.Assert.areEqual(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
System.Assert.isTrue(controller.getIsEdit() == false, 'isEdit should default to false');
controller.edit();
System.assert(controller.getIsEdit() == true);
System.Assert.isTrue(controller.getIsEdit() == true);

controller.cancel();
System.assert(controller.getIsEdit() == false);
System.Assert.isTrue(controller.getIsEdit() == false);

controller.getUser().Fax = randFax;
controller.save();
System.assert(controller.getIsEdit() == false);
System.Assert.isTrue(controller.getIsEdit() == false);
}

// verify that the user was updated
existingPortalUser = [SELECT id, fax FROM User WHERE id = :existingPortalUser.Id];
System.assert(existingPortalUser.fax == randFax);
System.Assert.isTrue(existingPortalUser.fax == randFax);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ global with sharing class SiteLoginControllerTest {
controller.username = 'test@salesforce.com';
controller.password = '123456';

System.assertEquals(controller.login(), null);
System.Assert.areEqual(controller.login(), null);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ public with sharing class SiteRegisterControllerTest {
controller.email = 'test@force.com';
controller.communityNickname = 'test';
// registerUser will always return null when the page isn't accessed as a guest user
System.assert(controller.registerUser() == null);
System.Assert.isTrue(controller.registerUser() == null);

controller.password = 'abcd1234';
controller.confirmPassword = 'abcd123';
System.assert(controller.registerUser() == null);
System.Assert.isTrue(controller.registerUser() == null);
}
}
27 changes: 27 additions & 0 deletions docs/apex/Log-Management/LogEntryEventStreamController.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
layout: default
---

## LogEntryEventStreamController class

Controller class for lwc `logEntryEventStream`, used to stream Log Entries in console and Tabular view.

---

### Methods

#### `getDatatableDisplayFields()``List<String>`

Returns the list of columns to be displayed in LogEntryEventStream Datatable. The fields are configured in the Custom Meta Data (LoggerParameter.LogEntryEventStreisplayFields).

##### Return

**Type**

List&lt;String&gt;

**Description**

The instance of `List&lt;String&gt;`, containing the list of columns to be displayed in

---
2 changes: 1 addition & 1 deletion docs/apex/Log-Management/LoggerEmailSender.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Sends an error email notification to the org&apos;s list of Apex Exception Email

#### `sendErrorEmail(Schema.SObjectType sobjectType, List<Database.UpsertResult> upsertResults)``void`

Sends an error email notification to the org&apos;s list of Apex Exception Email recipients, configured under Setup --&gt; Email --&gt; Apex Exception Email
Sends an error email notification to the org&apos;s list of Apex System.Exception Email recipients, configured under Setup --&gt; Email --&gt; Apex System.Exception Email

##### Parameters

Expand Down
14 changes: 7 additions & 7 deletions docs/apex/Logger-Engine/LogEntryEventBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Builder class that generates each `LogEntryEvent__e` record

### Constructors

#### `LogEntryEventBuilder(LoggerSettings__c userSettings, LoggingLevel entryLoggingLevel, Boolean shouldSave, Set<String> ignoredOrigins)`
#### `LogEntryEventBuilder(LoggerSettings__c userSettings, System.LoggingLevel entryLoggingLevel, Boolean shouldSave, Set<String> ignoredOrigins)`

Used by `Logger` to instantiate a new instance of `LogEntryEventBuilder`

Expand Down Expand Up @@ -305,15 +305,15 @@ LogEntryEventBuilder

The same instance of `LogEntryEventBuilder`, useful for chaining methods

#### `setExceptionDetails(Exception apexException)``LogEntryEventBuilder`
#### `setExceptionDetails(System.Exception apexException)``LogEntryEventBuilder`

Sets the log entry event&apos;s exception fields

##### Parameters

| Param | Description |
| --------------- | -------------------------------------- |
| `apexException` | The instance of an `Exception` to use. |
| Param | Description |
| --------------- | --------------------------------------------- |
| `apexException` | The instance of an `System.Exception` to use. |

##### Return

Expand All @@ -325,7 +325,7 @@ LogEntryEventBuilder

The same instance of `LogEntryEventBuilder`, useful for chaining methods

#### `setHttpRequestDetails(HttpRequest request)``LogEntryEventBuilder`
#### `setHttpRequestDetails(System.HttpRequest request)``LogEntryEventBuilder`

Sets the log entry event&apos;s HTTP Request fields

Expand All @@ -345,7 +345,7 @@ LogEntryEventBuilder

The same instance of `LogEntryEventBuilder`, useful for chaining methods

#### `setHttpResponseDetails(HttpResponse response)``LogEntryEventBuilder`
#### `setHttpResponseDetails(System.HttpResponse response)``LogEntryEventBuilder`

Sets the log entry event&apos;s HTTP Response fields

Expand Down
Loading

0 comments on commit e6448bd

Please sign in to comment.