From b5ac18e0b30421e94b155f55c4879c8cd4ac8020 Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 19 Dec 2024 02:14:08 +0100 Subject: [PATCH] Add support for logging instances of Database.EmptyRecycleBinResult and List (#806) * Add new instance method overloads in LogEntryEventBuilder for setDatabaseResult() to support logging Database.EmptyRecycleBinResult and List * Added new static method overloads in Logger to make it easier to log instances of Database.EmptyRecycleBinResult and List * Simplified + improved readability of some older Apex code throughout the codebase by using the safe navigator operator ?. and null coalescing operator ?? in several places * Fixed some existing code that caused PMD scan violations in newer versions of PMD/sf code analyzer --------- Co-authored-by: Marek Madejski Co-authored-by: Jonathan Gillespie --- README.md | 8 +- .../classes/MicrobatchSelfRegController.cls | 2 +- .../classes/SiteRegisterController.cls | 6 +- .../Logger-Engine/LogEntryEventBuilder.md | 64 +- docs/apex/Logger-Engine/Logger.md | 1200 +++- .../Test-Utilities/LoggerMockDataCreator.md | 41 + .../configuration/classes/LoggerParameter.cls | 40 +- .../log-management/classes/LogBatchPurger.cls | 1 + .../log-management/classes/LogHandler.cls | 4 +- .../DatabaseResultType__c.field-meta.xml | 5 + .../classes/LogEntryEventBuilder.cls | 46 +- .../main/logger-engine/classes/Logger.cls | 806 ++- .../classes/LoggerEngineDataSelector.cls | 1 + .../logger-engine/lwc/logger/loggerService.js | 2 +- .../utilities/LoggerMockDataCreator.cls | 75 +- .../classes/LogEntryEventHandler_Tests.cls | 2 +- .../classes/LogEntryEventBuilder_Tests.cls | 86 +- .../logger-engine/classes/Logger_Tests.cls | 5493 +++++++++++++---- .../classes/NebulaLogger_E2E_Tests.cls | 2 +- .../LogBatchApexErrorEventHandler_Tests.cls | 2 +- ...ogFlowExecutionErrorEventHandler_Tests.cls | 2 +- .../Account_Trigger_Logger_Example.trigger | 2 +- package.json | 5 +- sfdx-project.json | 7 +- 24 files changed, 6223 insertions(+), 1679 deletions(-) diff --git a/README.md b/README.md index 95febe2da..68ada9a70 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ The most robust observability solution for Salesforce experts. Built 100% natively on the platform, and designed to work seamlessly with Apex, Lightning Components, Flow, OmniStudio, and integrations. -## Unlocked Package - v4.15.1 +## Unlocked Package - v4.15.2 -[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015ohhQAA) -[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015ohhQAA) +[![Install Unlocked Package in a Sandbox](./images/btn-install-unlocked-package-sandbox.png)](https://test.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oifQAA) +[![Install Unlocked Package in Production](./images/btn-install-unlocked-package-production.png)](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5Y0000015oifQAA) [![View Documentation](./images/btn-view-documentation.png)](https://github.com/jongpie/NebulaLogger/wiki) -`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015ohhQAA` +`sf package install --wait 20 --security-type AdminsOnly --package 04t5Y0000015oifQAA` --- diff --git a/config/scratch-orgs/experience-cloud/classes/MicrobatchSelfRegController.cls b/config/scratch-orgs/experience-cloud/classes/MicrobatchSelfRegController.cls index becee5947..768829b06 100644 --- a/config/scratch-orgs/experience-cloud/classes/MicrobatchSelfRegController.cls +++ b/config/scratch-orgs/experience-cloud/classes/MicrobatchSelfRegController.cls @@ -5,7 +5,7 @@ public class MicrobatchSelfRegController { public String communityNickname { get; set { - communityNickname = value == null ? value : value.trim(); + communityNickname = value?.trim(); } } diff --git a/config/scratch-orgs/experience-cloud/classes/SiteRegisterController.cls b/config/scratch-orgs/experience-cloud/classes/SiteRegisterController.cls index c93320910..f39e5b8f0 100644 --- a/config/scratch-orgs/experience-cloud/classes/SiteRegisterController.cls +++ b/config/scratch-orgs/experience-cloud/classes/SiteRegisterController.cls @@ -14,19 +14,19 @@ public with sharing class SiteRegisterController { public String password { get; set { - password = value == null ? value : value.trim(); + password = value?.trim(); } } public String confirmPassword { get; set { - confirmPassword = value == null ? value : value.trim(); + confirmPassword = value?.trim(); } } public String communityNickname { get; set { - communityNickname = value == null ? value : value.trim(); + communityNickname = value?.trim(); } } diff --git a/docs/apex/Logger-Engine/LogEntryEventBuilder.md b/docs/apex/Logger-Engine/LogEntryEventBuilder.md index 83e374938..4cdd1ad15 100644 --- a/docs/apex/Logger-Engine/LogEntryEventBuilder.md +++ b/docs/apex/Logger-Engine/LogEntryEventBuilder.md @@ -140,15 +140,15 @@ LogEntryEventBuilder The same instance of `LogEntryEventBuilder`, useful for chaining methods -#### `setDatabaseResult(Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `setDatabaseResult(Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Sets the log entry event's database operation result fields ##### Parameters -| Param | Description | -| ------------------- | --------------------------------------------------- | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ---------------------------------------------- | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -160,15 +160,15 @@ LogEntryEventBuilder The same instance of `LogEntryEventBuilder`, useful for chaining methods -#### `setDatabaseResult(List leadConvertResults)` → `LogEntryEventBuilder` +#### `setDatabaseResult(Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Sets the log entry event's database operation result fields ##### Parameters -| Param | Description | -| -------------------- | ------------------------------------------------ | -| `leadConvertResults` | The list of `Database.LeadConvertResult`s to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | ##### Return @@ -180,15 +180,15 @@ LogEntryEventBuilder The same instance of `LogEntryEventBuilder`, useful for chaining methods -#### `setDatabaseResult(Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `setDatabaseResult(Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` Sets the log entry event's database operation result fields ##### Parameters -| Param | Description | -| -------------- | ---------------------------------------------- | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +| ------------------- | --------------------------------------------------- | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -300,6 +300,46 @@ LogEntryEventBuilder The same instance of `LogEntryEventBuilder`, useful for chaining methods +#### `setDatabaseResult(List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Sets the log entry event's database operation result fields + +##### Parameters + +| Param | Description | +|--------------------------|------------------------------------------------------| +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult`s to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The same instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `setDatabaseResult(List leadConvertResults)` → `LogEntryEventBuilder` + +Sets the log entry event's database operation result fields + +##### Parameters + +| Param | Description | +| -------------------- | ------------------------------------------------ | +| `leadConvertResults` | The list of `Database.LeadConvertResult`s to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The same instance of `LogEntryEventBuilder`, useful for chaining methods + #### `setDatabaseResult(List mergeResults)` → `LogEntryEventBuilder` Sets the log entry event's database operation result fields diff --git a/docs/apex/Logger-Engine/Logger.md b/docs/apex/Logger-Engine/Logger.md index bc6e0b56f..c242bf038 100644 --- a/docs/apex/Logger-Engine/Logger.md +++ b/docs/apex/Logger-Engine/Logger.md @@ -96,16 +96,16 @@ LoggerSettings\_\_c A new `LoggerSettings__c` record, with all fields populated with default field values -#### `debug(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `debug(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -117,16 +117,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `debug(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `debug(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `debug(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -243,6 +264,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `debug(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `debug(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `debug(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` @@ -410,16 +473,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `debug(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `debug(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -431,16 +494,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `debug(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `debug(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `debug(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -542,10 +626,52 @@ Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` ##### Parameters -| Param | Description | -| --------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResults` | The list of `Database.DeleteResult` instances to log | +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `debug(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `debug(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | ##### Return @@ -734,16 +860,16 @@ End the specified scenario, if it's the currently active scenario, and roll | ---------- | ------------------------------- | | `scenario` | The name of the scenario to end | -#### `error(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `error(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -755,16 +881,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `error(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `error(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `error(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -881,6 +1028,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `error(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `error(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `error(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` @@ -1135,16 +1324,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `error(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `error(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -1156,16 +1345,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `error(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `error(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `error(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -1282,6 +1492,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `error(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `error(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `error(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.ERROR` @@ -1640,16 +1892,16 @@ Asynchronoulsy publishes the list of `LogEntryEvent__e` records | ------------------ | ---------------------------------------------------------- | | `queueableContext` | The context of the current queue, provided by the platform | -#### `fine(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `fine(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -1661,16 +1913,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `fine(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `fine(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `fine(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -1787,6 +2060,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `fine(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `fine(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `fine(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` @@ -1954,16 +2269,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `fine(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `fine(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -1975,16 +2290,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `fine(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `fine(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `fine(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -2101,6 +2437,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `fine(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `fine(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINE` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `fine(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINE` @@ -2268,16 +2646,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `finer(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -2289,16 +2667,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `finer(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finer(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -2352,16 +2751,58 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(LogMessage logMessage, Database.UndeleteResult undeleteResult)` → `LogEntryEventBuilder` +#### `finer(LogMessage logMessage, Database.UndeleteResult undeleteResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +| ---------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `undeleteResult` | The instance of `Database.UndeleteResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finer(LogMessage logMessage, Database.UpsertResult upsertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `upsertResult` | The instance of `Database.UpsertResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finer(LogMessage logMessage, List deleteResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| ---------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `undeleteResult` | The instance of `Database.UndeleteResult` to log | +| Param | Description | +| --------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResults` | The instance of `List<Database.DeleteResult>` to log | ##### Return @@ -2373,16 +2814,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(LogMessage logMessage, Database.UpsertResult upsertResult)` → `LogEntryEventBuilder` +#### `finer(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `upsertResult` | The instance of `Database.UpsertResult` to log | +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | ##### Return @@ -2394,16 +2835,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(LogMessage logMessage, List deleteResults)` → `LogEntryEventBuilder` +#### `finer(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| --------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResults` | The instance of `List<Database.DeleteResult>` to log | +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | ##### Return @@ -2582,16 +3023,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `finer(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -2603,16 +3044,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finer(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `finer(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finer(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -2729,6 +3191,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `finer(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finer(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINER` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `finer(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINER` @@ -2896,16 +3400,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finest(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `finest(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -2917,16 +3421,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finest(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `finest(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finest(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -3043,6 +3568,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `finest(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finest(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `finest(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` @@ -3210,16 +3777,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finest(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `finest(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -3231,16 +3798,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `finest(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `finest(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finest(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -3357,6 +3945,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `finest(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `finest(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `finest(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.FINEST` @@ -3746,16 +4376,37 @@ Adds the specified Apex type to the list of ignored origin locations for the cur | ---------- | ------------------------------------ | | `apexType` | The Apex type of the class to ignore | -#### `info(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `info(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `info(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | ##### Return @@ -3767,16 +4418,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `info(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `info(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -3893,6 +4544,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `info(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `info(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `info(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` @@ -4060,16 +4753,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `info(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `info(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -4081,16 +4774,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `info(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `info(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `info(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -4207,6 +4921,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `info(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `info(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.INFO` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `info(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.INFO` @@ -5023,16 +5779,16 @@ Sets the current scenario, which can be used to identify modules or groupings of Pauses saving for the current transaction. Any calls to saveLog() are ignored until saving is resumed. -#### `warn(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `warn(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -5044,16 +5800,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `warn(LogMessage logMessage, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `warn(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------------------------- | -| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `warn(LogMessage logMessage, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------------------------- | +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -5170,6 +5947,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `warn(LogMessage logMessage, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `warn(LogMessage logMessage, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +|----------------------|---------------------------------------------------------------------------| +| `logMessage` | The instance of `LogMessage` to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `warn(LogMessage logMessage, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` @@ -5424,16 +6243,16 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `warn(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` +#### `warn(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` ##### Parameters -| Param | Description | -| ------------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | +| Param | Description | +| -------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `deleteResult` | The instance of `Database.DeleteResult` to log | ##### Return @@ -5445,16 +6264,37 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods -#### `warn(String message, Database.DeleteResult deleteResult)` → `LogEntryEventBuilder` +#### `warn(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` ##### Parameters -| Param | Description | -| -------------- | ------------------------------------------------------- | -| `message` | The string to use to set the entry's message field | -| `deleteResult` | The instance of `Database.DeleteResult` to log | +| Param | Description | +|-------------------------|---------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResult` | The instance of `Database.EmptyRecycleBinResult` to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `warn(String message, Database.LeadConvertResult leadConvertResult)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +| ------------------- | ------------------------------------------------------- | +| `message` | The string to use to set the entry's message field | +| `leadConvertResult` | The instance of `Database.LeadConvertResult` to log | ##### Return @@ -5571,6 +6411,48 @@ LogEntryEventBuilder The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods +#### `warn(String message, List emptyRecycleBinResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +|--------------------------|---------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `emptyRecycleBinResults` | The list of `Database.EmptyRecycleBinResult` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + +#### `warn(String message, List leadConvertResults)` → `LogEntryEventBuilder` + +Creates a new log entry with logging level == `System.LoggingLevel.WARN` + +##### Parameters + +| Param | Description | +|----------------------|------------------------------------------------------------| +| `message` | The string to use to set the entry's message field | +| `leadConvertResults` | The list of `Database.LeadConvertResults` instances to log | + +##### Return + +**Type** + +LogEntryEventBuilder + +**Description** + +The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + #### `warn(String message, List mergeResults)` → `LogEntryEventBuilder` Creates a new log entry with logging level == `System.LoggingLevel.WARN` diff --git a/docs/apex/Test-Utilities/LoggerMockDataCreator.md b/docs/apex/Test-Utilities/LoggerMockDataCreator.md index 5cc250661..6d81b3c8e 100644 --- a/docs/apex/Test-Utilities/LoggerMockDataCreator.md +++ b/docs/apex/Test-Utilities/LoggerMockDataCreator.md @@ -111,6 +111,47 @@ Database.DeleteResult The mock instance of `Database.DeleteResult` +#### `createDatabaseEmptyRecycleBinResult(Boolean isSuccess)` → `Database.EmptyRecycleBinResult` + +Creates a mock instance of `Database.EmptyRecycleBinResult` - a mock is used instead of an actual instance to help speed up tests, and to support writing unit tests (instead of integration tests). A fake record ID is automatically included. + +##### Parameters + +| Param | Description | +| ----------- | ------------------------------------------------------- | +| `isSuccess` | Indicates if the generated mock should have `isSuccess` | + +##### Return + +**Type** + +Database.EmptyRecycleBinResult + +**Description** + +The mock instance of `Database.EmptyRecycleBinResult` + +#### `createDatabaseEmptyRecycleBinResult(Boolean isSuccess, Id recordId)` → `Database.EmptyRecycleBinResult` + +Creates a mock instance of `Database.EmptyRecycleBinResult` - a mock is used instead of an actual instance to help speed up tests, and to support writing unit tests (instead of integration tests) + +##### Parameters + +| Param | Description | +| ----------- | ------------------------------------------------------- | +| `isSuccess` | Indicates if the generated mock should have `isSuccess` | +| `recordId` | The record ID to use within the mock result | + +##### Return + +**Type** + +Database.EmptyRecycleBinResult + +**Description** + +The mock instance of `Database.EmptyRecycleBinResult` + #### `createDatabaseLeadConvertResult(Boolean isSuccess)` → `Database.LeadConvertResult` Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead of an actual instance to help speed up tests, and to support writing unit tests (instead of integration tests). A fake record ID is automatically included. diff --git a/nebula-logger/core/main/configuration/classes/LoggerParameter.cls b/nebula-logger/core/main/configuration/classes/LoggerParameter.cls index 9eb9c5c49..2415968a3 100644 --- a/nebula-logger/core/main/configuration/classes/LoggerParameter.cls +++ b/nebula-logger/core/main/configuration/classes/LoggerParameter.cls @@ -567,7 +567,7 @@ public class LoggerParameter { */ public static Boolean getBoolean(String parameterDeveloperName, Boolean defaultValue) { Boolean parameterValue = (Boolean) castParameterValue(parameterDeveloperName, Boolean.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -579,7 +579,7 @@ public class LoggerParameter { */ public static List getBooleanList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -591,7 +591,7 @@ public class LoggerParameter { */ public static Date getDate(String parameterDeveloperName, Date defaultValue) { Date parameterValue = (Date) castParameterValue(parameterDeveloperName, Date.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -603,7 +603,7 @@ public class LoggerParameter { */ public static List getDateList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -615,7 +615,7 @@ public class LoggerParameter { */ public static Datetime getDatetime(String parameterDeveloperName, Datetime defaultValue) { Datetime parameterValue = (Datetime) castParameterValue(parameterDeveloperName, Datetime.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -627,7 +627,7 @@ public class LoggerParameter { */ public static List getDatetimeList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -639,7 +639,7 @@ public class LoggerParameter { */ public static Decimal getDecimal(String parameterDeveloperName, Decimal defaultValue) { Decimal parameterValue = (Decimal) castParameterValue(parameterDeveloperName, Decimal.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -651,7 +651,7 @@ public class LoggerParameter { */ public static List getDecimalList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -663,7 +663,7 @@ public class LoggerParameter { */ public static Double getDouble(String parameterDeveloperName, Double defaultValue) { Double parameterValue = (Double) castParameterValue(parameterDeveloperName, Double.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -675,7 +675,7 @@ public class LoggerParameter { */ public static List getDoubleList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -687,7 +687,7 @@ public class LoggerParameter { */ public static Id getId(String parameterDeveloperName, Id defaultValue) { Id parameterValue = (Id) castParameterValue(parameterDeveloperName, Id.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -699,7 +699,7 @@ public class LoggerParameter { */ public static List getIdList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -711,7 +711,7 @@ public class LoggerParameter { */ public static Integer getInteger(String parameterDeveloperName, Integer defaultValue) { Integer parameterValue = (Integer) castParameterValue(parameterDeveloperName, Integer.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -723,7 +723,7 @@ public class LoggerParameter { */ public static List getIntegerList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -735,7 +735,7 @@ public class LoggerParameter { */ public static Long getLong(String parameterDeveloperName, Long defaultValue) { Long parameterValue = (Long) castParameterValue(parameterDeveloperName, Long.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -747,7 +747,7 @@ public class LoggerParameter { */ public static List getLongList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -759,7 +759,7 @@ public class LoggerParameter { */ public static SObject getSObject(String parameterDeveloperName, SObject defaultValue) { SObject parameterValue = (SObject) castParameterValue(parameterDeveloperName, SObject.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -771,7 +771,7 @@ public class LoggerParameter { */ public static List getSObjectList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -783,7 +783,7 @@ public class LoggerParameter { public static String getString(String parameterDeveloperName, String defaultValue) { // Since the Value__c field is already a String, this method skips using the method castParameterValue String parameterValue = loadParameterValue(parameterDeveloperName); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** @@ -794,7 +794,7 @@ public class LoggerParameter { */ public static List getStringList(String parameterDeveloperName, List defaultValue) { List parameterValue = (List) castParameterValue(parameterDeveloperName, List.class); - return parameterValue != null ? parameterValue : defaultValue; + return parameterValue ?? defaultValue; } /** diff --git a/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls b/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls index 0153a8fb4..913320986 100644 --- a/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls +++ b/nebula-logger/core/main/log-management/classes/LogBatchPurger.cls @@ -206,6 +206,7 @@ global with sharing class LogBatchPurger implements Database.Batchable, * @param sobjectType Takes the sObjectType enum to instanciate a new log related instance. * @return The instance of Database.QueryLocator for the lowest-level Logger object */ + @SuppressWarnings('PMD.UnusedLocalVariable') private Database.QueryLocator getQueryLocator(Schema.SObjectType sobjectType) { Database.QueryLocator queryLocator; diff --git a/nebula-logger/core/main/log-management/classes/LogHandler.cls b/nebula-logger/core/main/log-management/classes/LogHandler.cls index 742996c14..f8d8d7456 100644 --- a/nebula-logger/core/main/log-management/classes/LogHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogHandler.cls @@ -81,8 +81,8 @@ public without sharing class LogHandler extends LoggerSObjectHandler { log.ClosedBy__c = null; log.ClosedDate__c = null; } else { - log.ClosedBy__c = log.ClosedBy__c == null ? System.UserInfo.getUserId() : log.ClosedBy__c; - log.ClosedDate__c = log.ClosedDate__c == null ? System.now() : log.ClosedDate__c; + log.ClosedBy__c = log.ClosedBy__c ?? System.UserInfo.getUserId(); + log.ClosedDate__c = log.ClosedDate__c ?? System.now(); } } } diff --git a/nebula-logger/core/main/log-management/objects/LogEntry__c/fields/DatabaseResultType__c.field-meta.xml b/nebula-logger/core/main/log-management/objects/LogEntry__c/fields/DatabaseResultType__c.field-meta.xml index 6f5cf0b8a..ade1c3795 100644 --- a/nebula-logger/core/main/log-management/objects/LogEntry__c/fields/DatabaseResultType__c.field-meta.xml +++ b/nebula-logger/core/main/log-management/objects/LogEntry__c/fields/DatabaseResultType__c.field-meta.xml @@ -16,6 +16,11 @@ false + + Database.EmptyRecycleBinResult + false + + Database.LeadConvertResult false diff --git a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index b2949fb1e..4bb5d820d 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -197,29 +197,33 @@ global with sharing class LogEntryEventBuilder { /** * @description Sets the log entry event's database operation result fields - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @param deleteResult The instance of `Database.DeleteResult` to log * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods */ - global LogEntryEventBuilder setDatabaseResult(Database.LeadConvertResult leadConvertResult) { - return this.setDatabaseDetails(new List{ leadConvertResult }, Database.LeadConvertResult.class, leadConvertResult?.getLeadId()); + global LogEntryEventBuilder setDatabaseResult(Database.DeleteResult deleteResult) { + return this.setDatabaseDetails(new List{ deleteResult }, Database.DeleteResult.class, deleteResult?.getId()); } /** * @description Sets the log entry event's database operation result fields - * @param leadConvertResults The list of `Database.LeadConvertResult`s to log - * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods + * @param emptyRecycleBinResult The instance of `Database.EmptyRecycleBinResult` to log + * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods */ - global LogEntryEventBuilder setDatabaseResult(List leadConvertResults) { - return this.setDatabaseDetails(leadConvertResults, Database.LeadConvertResult.class, null); + global LogEntryEventBuilder setDatabaseResult(Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return this.setDatabaseDetails( + new List{ emptyRecycleBinResult }, + Database.EmptyRecycleBinResult.class, + emptyRecycleBinResult?.getId() + ); } /** * @description Sets the log entry event's database operation result fields - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods */ - global LogEntryEventBuilder setDatabaseResult(Database.DeleteResult deleteResult) { - return this.setDatabaseDetails(new List{ deleteResult }, Database.DeleteResult.class, deleteResult?.getId()); + global LogEntryEventBuilder setDatabaseResult(Database.LeadConvertResult leadConvertResult) { + return this.setDatabaseDetails(new List{ leadConvertResult }, Database.LeadConvertResult.class, leadConvertResult?.getLeadId()); } /** @@ -272,6 +276,24 @@ global with sharing class LogEntryEventBuilder { return this.setDatabaseDetails(deleteResults, Database.DeleteResult.class, null); } + /** + * @description Sets the log entry event's database operation result fields + * @param emptyRecycleBinResults The list of `Database.EmptyRecycleBinResult` instances to log + * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global LogEntryEventBuilder setDatabaseResult(List emptyRecycleBinResults) { + return this.setDatabaseDetails(emptyRecycleBinResults, Database.EmptyRecycleBinResult.class, null); + } + + /** + * @description Sets the log entry event's database operation result fields + * @param leadConvertResults The list of `Database.LeadConvertResult`s to log + * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global LogEntryEventBuilder setDatabaseResult(List leadConvertResults) { + return this.setDatabaseDetails(leadConvertResults, Database.LeadConvertResult.class, null); + } + /** * @description Sets the log entry event's database operation result fields * @param mergeResults The list of `Database.MergeResult` instances to log @@ -1194,7 +1216,7 @@ global with sharing class LogEntryEventBuilder { // TODO need to revisit Visualforce logic, re-add fields to either Log__c or LogEntry__c, etc. /* private static String getVisualforcePageName() { - String visualforcePageName = ApexPages.currentPage() == null ? null : ApexPages.currentPage().getUrl(); + String visualforcePageName = ApexPages.currentPage()?.getUrl(); if (visualforcePageName != null && visualforcePageName.contains('?')) { visualforcePageName = visualforcePageName.substringBetween('apex/', '?'); } else if (visualforcePageName != null) { diff --git a/nebula-logger/core/main/logger-engine/classes/Logger.cls b/nebula-logger/core/main/logger-engine/classes/Logger.cls index ece863848..a1225ce5b 100644 --- a/nebula-logger/core/main/logger-engine/classes/Logger.cls +++ b/nebula-logger/core/main/logger-engine/classes/Logger.cls @@ -15,7 +15,7 @@ global with sharing class Logger { // There's no reliable way to get the version number dynamically in Apex @TestVisible - private static final String CURRENT_VERSION_NUMBER = 'v4.15.1'; + private static final String CURRENT_VERSION_NUMBER = 'v4.15.2'; private static final System.LoggingLevel FALLBACK_LOGGING_LEVEL = System.LoggingLevel.DEBUG; private static final List LOG_ENTRIES_BUFFER = new List(); private static final String MISSING_SCENARIO_ERROR_MESSAGE = 'No logger scenario specified. A scenario is required for logging in this org.'; @@ -98,7 +98,7 @@ global with sharing class Logger { } // If System.UserInfo.getSessionId() returns null, set to an empty string to // avoid calling System.UserInfo.getSessionId() again - USER_SESSION_ID = USER_SESSION_ID == null ? '' : USER_SESSION_ID; + USER_SESSION_ID = USER_SESSION_ID ?? ''; } return USER_SESSION_ID; } @@ -308,7 +308,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isErrorEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.ERROR); + return isEnabled(System.LoggingLevel.ERROR); } /** @@ -316,7 +316,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isWarnEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.WARN); + return isEnabled(System.LoggingLevel.WARN); } /** @@ -324,7 +324,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isInfoEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.INFO); + return isEnabled(System.LoggingLevel.INFO); } /** @@ -332,7 +332,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isDebugEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.DEBUG); + return isEnabled(System.LoggingLevel.DEBUG); } /** @@ -340,7 +340,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isFineEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.FINE); + return isEnabled(System.LoggingLevel.FINE); } /** @@ -348,7 +348,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isFinerEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.FINER); + return isEnabled(System.LoggingLevel.FINER); } /** @@ -356,7 +356,7 @@ global with sharing class Logger { * @return Boolean */ global static Boolean isFinestEnabled() { - return isEnabled() && meetsUserLoggingLevel(System.LoggingLevel.FINEST); + return isEnabled(System.LoggingLevel.FINEST); } /** @@ -598,16 +598,6 @@ global with sharing class Logger { } // ERROR logging level methods - /** - * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods - */ - global static LogEntryEventBuilder error(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return error().setDatabaseResult(leadConvertResult).setMessage(logMessage); - } - /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -618,6 +608,26 @@ global with sharing class Logger { return error().setDatabaseResult(deleteResult).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return error().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return error().setDatabaseResult(leadConvertResult).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -668,6 +678,26 @@ global with sharing class Logger { return error().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(LogMessage logMessage, List emptyRecycleBinResults) { + return error().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(LogMessage logMessage, List leadConvertResults) { + return error().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -792,22 +822,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder error(String message, Database.LeadConvertResult leadConvertResult) { - return error().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder error(String message, Database.DeleteResult deleteResult) { + return error().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder error(String message, Database.DeleteResult deleteResult) { - return error().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder error(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return error().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(String message, Database.LeadConvertResult leadConvertResult) { + return error().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -860,6 +900,26 @@ global with sharing class Logger { return error().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(String message, List emptyRecycleBinResults) { + return error().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder error(String message, List leadConvertResults) { + return error().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.ERROR` * @param message The string to use to set the entry's message field @@ -983,16 +1043,6 @@ global with sharing class Logger { } // WARN logging level methods - /** - * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods - */ - global static LogEntryEventBuilder warn(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return warn().setDatabaseResult(leadConvertResult).setMessage(logMessage); - } - /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1003,6 +1053,26 @@ global with sharing class Logger { return warn().setDatabaseResult(deleteResult).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return warn().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return warn().setDatabaseResult(leadConvertResult).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1053,6 +1123,26 @@ global with sharing class Logger { return warn().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(LogMessage logMessage, List emptyRecycleBinResults) { + return warn().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(LogMessage logMessage, List leadConvertResults) { + return warn().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1177,22 +1267,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder warn(String message, Database.LeadConvertResult leadConvertResult) { - return warn().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder warn(String message, Database.DeleteResult deleteResult) { + return warn().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder warn(String message, Database.DeleteResult deleteResult) { - return warn().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder warn(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return warn().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(String message, Database.LeadConvertResult leadConvertResult) { + return warn().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -1245,6 +1345,26 @@ global with sharing class Logger { return warn().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(String message, List emptyRecycleBinResults) { + return warn().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder warn(String message, List leadConvertResults) { + return warn().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.WARN` * @param message The string to use to set the entry's message field @@ -1367,16 +1487,6 @@ global with sharing class Logger { return warn().setMessage(message); } - /** - * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods - */ - global static LogEntryEventBuilder info(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return info().setDatabaseResult(leadConvertResult).setMessage(logMessage); - } - /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1387,6 +1497,26 @@ global with sharing class Logger { return info().setDatabaseResult(deleteResult).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return info().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return info().setDatabaseResult(leadConvertResult).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1437,6 +1567,26 @@ global with sharing class Logger { return info().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(LogMessage logMessage, List emptyRecycleBinResults) { + return info().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(LogMessage logMessage, List leadConvertResults) { + return info().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1518,22 +1668,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder info(String message, Database.LeadConvertResult leadConvertResult) { - return info().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder info(String message, Database.DeleteResult deleteResult) { + return info().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder info(String message, Database.DeleteResult deleteResult) { - return info().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder info(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return info().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(String message, Database.LeadConvertResult leadConvertResult) { + return info().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -1586,6 +1746,26 @@ global with sharing class Logger { return info().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(String message, List emptyRecycleBinResults) { + return info().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder info(String message, List leadConvertResults) { + return info().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.INFO` * @param message The string to use to set the entry's message field @@ -1669,21 +1849,31 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @param deleteResult The instance of `Database.DeleteResult` to log * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder debug(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return debug().setDatabaseResult(leadConvertResult).setMessage(logMessage); + global static LogEntryEventBuilder debug(LogMessage logMessage, Database.DeleteResult deleteResult) { + return debug().setDatabaseResult(deleteResult).setMessage(logMessage); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder debug(LogMessage logMessage, Database.DeleteResult deleteResult) { - return debug().setDatabaseResult(deleteResult).setMessage(logMessage); + global static LogEntryEventBuilder debug(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return debug().setDatabaseResult(leadConvertResult).setMessage(logMessage); } /** @@ -1736,6 +1926,26 @@ global with sharing class Logger { return debug().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(LogMessage logMessage, List emptyRecycleBinResults) { + return debug().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(LogMessage logMessage, List leadConvertResults) { + return debug().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -1817,22 +2027,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder debug(String message, Database.LeadConvertResult leadConvertResult) { - return debug().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder debug(String message, Database.DeleteResult deleteResult) { + return debug().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder debug(String message, Database.DeleteResult deleteResult) { - return debug().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder debug(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(String message, Database.LeadConvertResult leadConvertResult) { + return debug().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -1885,6 +2105,26 @@ global with sharing class Logger { return debug().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(String message, List emptyRecycleBinResults) { + return debug().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder debug(String message, List leadConvertResults) { + return debug().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.DEBUG` * @param message The string to use to set the entry's message field @@ -1968,21 +2208,31 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @param deleteResult The instance of `Database.DeleteResult` to log * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder fine(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return fine().setDatabaseResult(leadConvertResult).setMessage(logMessage); + global static LogEntryEventBuilder fine(LogMessage logMessage, Database.DeleteResult deleteResult) { + return fine().setDatabaseResult(deleteResult).setMessage(logMessage); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder fine(LogMessage logMessage, Database.DeleteResult deleteResult) { - return fine().setDatabaseResult(deleteResult).setMessage(logMessage); + global static LogEntryEventBuilder fine(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return fine().setDatabaseResult(leadConvertResult).setMessage(logMessage); } /** @@ -2035,6 +2285,26 @@ global with sharing class Logger { return fine().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(LogMessage logMessage, List emptyRecycleBinResults) { + return fine().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(LogMessage logMessage, List leadConvertResults) { + return fine().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -2116,22 +2386,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder fine(String message, Database.LeadConvertResult leadConvertResult) { - return fine().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder fine(String message, Database.DeleteResult deleteResult) { + return fine().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder fine(String message, Database.DeleteResult deleteResult) { - return fine().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder fine(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(String message, Database.LeadConvertResult leadConvertResult) { + return fine().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -2184,6 +2464,26 @@ global with sharing class Logger { return fine().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(String message, List emptyRecycleBinResults) { + return fine().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder fine(String message, List leadConvertResults) { + return fine().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINE` * @param message The string to use to set the entry's message field @@ -2267,21 +2567,31 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @param deleteResult The instance of `Database.DeleteResult` to log * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finer(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return finer().setDatabaseResult(leadConvertResult).setMessage(logMessage); + global static LogEntryEventBuilder finer(LogMessage logMessage, Database.DeleteResult deleteResult) { + return finer().setDatabaseResult(deleteResult).setMessage(logMessage); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finer(LogMessage logMessage, Database.DeleteResult deleteResult) { - return finer().setDatabaseResult(deleteResult).setMessage(logMessage); + global static LogEntryEventBuilder finer(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return finer().setDatabaseResult(leadConvertResult).setMessage(logMessage); } /** @@ -2334,6 +2644,26 @@ global with sharing class Logger { return finer().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(LogMessage logMessage, List emptyRecycleBinResults) { + return finer().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(LogMessage logMessage, List leadConvertResults) { + return finer().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -2415,22 +2745,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finer(String message, Database.LeadConvertResult leadConvertResult) { - return finer().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder finer(String message, Database.DeleteResult deleteResult) { + return finer().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finer(String message, Database.DeleteResult deleteResult) { - return finer().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder finer(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(String message, Database.LeadConvertResult leadConvertResult) { + return finer().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -2483,6 +2823,26 @@ global with sharing class Logger { return finer().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(String message, List emptyRecycleBinResults) { + return finer().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finer(String message, List leadConvertResults) { + return finer().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINER` * @param message The string to use to set the entry's message field @@ -2566,21 +2926,31 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @param deleteResult The instance of `Database.DeleteResult` to log * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finest(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { - return finest().setDatabaseResult(leadConvertResult).setMessage(logMessage); + global static LogEntryEventBuilder finest(LogMessage logMessage, Database.DeleteResult deleteResult) { + return finest().setDatabaseResult(deleteResult).setMessage(logMessage); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finest(LogMessage logMessage, Database.DeleteResult deleteResult) { - return finest().setDatabaseResult(deleteResult).setMessage(logMessage); + global static LogEntryEventBuilder finest(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(LogMessage logMessage, Database.LeadConvertResult leadConvertResult) { + return finest().setDatabaseResult(leadConvertResult).setMessage(logMessage); } /** @@ -2633,6 +3003,26 @@ global with sharing class Logger { return finest().setDatabaseResult(deleteResults).setMessage(logMessage); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(LogMessage logMessage, List emptyRecycleBinResults) { + return finest().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(LogMessage logMessage, List leadConvertResults) { + return finest().setDatabaseResult(leadConvertResults).setMessage(logMessage); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` * @param logMessage The instance of `LogMessage` to use to set the entry's message field @@ -2714,22 +3104,32 @@ global with sharing class Logger { /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` - * @param message The string to use to set the entry's message field - * @param leadConvertResult The instance of `Database.LeadConvertResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param deleteResult The instance of `Database.DeleteResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finest(String message, Database.LeadConvertResult leadConvertResult) { - return finest().setDatabaseResult(leadConvertResult).setMessage(message); + global static LogEntryEventBuilder finest(String message, Database.DeleteResult deleteResult) { + return finest().setDatabaseResult(deleteResult).setMessage(message); } /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` - * @param message The string to use to set the entry's message field - * @param deleteResult The instance of `Database.DeleteResult` to log - * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ - global static LogEntryEventBuilder finest(String message, Database.DeleteResult deleteResult) { - return finest().setDatabaseResult(deleteResult).setMessage(message); + global static LogEntryEventBuilder finest(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { + return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param message The string to use to set the entry's message field + * @param leadConvertResult The instance of `Database.LeadConvertResult` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(String message, Database.LeadConvertResult leadConvertResult) { + return finest().setDatabaseResult(leadConvertResult).setMessage(message); } /** @@ -2782,6 +3182,26 @@ global with sharing class Logger { return finest().setDatabaseResult(deleteResults).setMessage(message); } + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(String message, List emptyRecycleBinResults) { + return finest().setDatabaseResult(emptyRecycleBinResults).setMessage(message); + } + + /** + * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` + * @param message The string to use to set the entry's message field + * @param leadConvertResults The instance of `List` to log + * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods + */ + global static LogEntryEventBuilder finest(String message, List leadConvertResults) { + return finest().setDatabaseResult(leadConvertResults).setMessage(message); + } + /** * @description Creates a new log entry with logging level == `System.LoggingLevel.FINEST` * @param message The string to use to set the entry's message field @@ -2861,6 +3281,74 @@ global with sharing class Logger { return finest().setMessage(message); } + /** + * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` + * @param loggingLevel The logging level to use for the log entry + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param deleteResults The instance of `List` to log + * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors + */ + global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, LogMessage logMessage, List deleteResults) { + return logDatabaseErrors(loggingLevel, logMessage.getMessage(), deleteResults); + } + + /** + * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` + * @param loggingLevel The logging level to use for the log entry + * @param message The string to use to set the entry's message field + * @param deleteResults The instance of `List` to log + * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors + */ + global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, String message, List deleteResults) { + List resultsToLog = new List(); + for (Database.DeleteResult deleteResult : deleteResults) { + if (deleteResult.isSuccess() == false) { + resultsToLog.add(deleteResult); + } + } + + Boolean shouldSave = resultsToLog.isEmpty() == false && isEnabled(loggingLevel); + return newEntry(loggingLevel, message, shouldSave).setDatabaseResult(resultsToLog); + } + + /** + * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` + * @param loggingLevel The logging level to use for the log entry + * @param logMessage The instance of `LogMessage` to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors + */ + global static LogEntryEventBuilder logDatabaseErrors( + System.LoggingLevel loggingLevel, + LogMessage logMessage, + List emptyRecycleBinResults + ) { + return logDatabaseErrors(loggingLevel, logMessage.getMessage(), emptyRecycleBinResults); + } + + /** + * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` + * @param loggingLevel The logging level to use for the log entry + * @param message The string to use to set the entry's message field + * @param emptyRecycleBinResults The instance of `List` to log + * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors + */ + global static LogEntryEventBuilder logDatabaseErrors( + System.LoggingLevel loggingLevel, + String message, + List emptyRecycleBinResults + ) { + List resultsToLog = new List(); + for (Database.EmptyRecycleBinResult emptyRecycleBinResult : emptyRecycleBinResults) { + if (emptyRecycleBinResult.isSuccess() == false) { + resultsToLog.add(emptyRecycleBinResult); + } + } + + Boolean shouldSave = resultsToLog.isEmpty() == false && isEnabled(loggingLevel); + return newEntry(loggingLevel, message, shouldSave).setDatabaseResult(resultsToLog); + } + /** * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` * @param loggingLevel The logging level to use for the log entry @@ -2878,10 +3366,10 @@ global with sharing class Logger { /** * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` - * @param loggingLevel The logging level to use for the log entry - * @param message The string to use to set the entry's message field + * @param loggingLevel The logging level to use for the log entry + * @param message The string to use to set the entry's message field * @param leadConvertResults The instance of `List` to log - * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors + * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors */ global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, String message, List leadConvertResults) { List resultsToLog = new List(); @@ -2895,36 +3383,6 @@ global with sharing class Logger { return newEntry(loggingLevel, message, shouldSave).setDatabaseResult(resultsToLog); } - /** - * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` - * @param loggingLevel The logging level to use for the log entry - * @param logMessage The instance of `LogMessage` to use to set the entry's message field - * @param deleteResults The instance of `List` to log - * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors - */ - global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, LogMessage logMessage, List deleteResults) { - return logDatabaseErrors(loggingLevel, logMessage.getMessage(), deleteResults); - } - - /** - * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` - * @param loggingLevel The logging level to use for the log entry - * @param message The string to use to set the entry's message field - * @param deleteResults The instance of `List` to log - * @return The instance of `LogEntryBuilder` was generated to log any errors, or `null` if there are no errors - */ - global static LogEntryEventBuilder logDatabaseErrors(System.LoggingLevel loggingLevel, String message, List deleteResults) { - List resultsToLog = new List(); - for (Database.DeleteResult deleteResult : deleteResults) { - if (deleteResult.isSuccess() == false) { - resultsToLog.add(deleteResult); - } - } - - Boolean shouldSave = resultsToLog.isEmpty() == false && isEnabled(loggingLevel); - return newEntry(loggingLevel, message, shouldSave).setDatabaseResult(resultsToLog); - } - /** * @description Creates a log entry for any results within the provided `List` where `isSuccess() != true` * @param loggingLevel The logging level to use for the log entry diff --git a/nebula-logger/core/main/logger-engine/classes/LoggerEngineDataSelector.cls b/nebula-logger/core/main/logger-engine/classes/LoggerEngineDataSelector.cls index 8149d11df..994547aea 100644 --- a/nebula-logger/core/main/logger-engine/classes/LoggerEngineDataSelector.cls +++ b/nebula-logger/core/main/logger-engine/classes/LoggerEngineDataSelector.cls @@ -155,6 +155,7 @@ public without sharing virtual class LoggerEngineDataSelector { OrganizationType, TrialExpirationDate FROM Organization + LIMIT 1 ]; LoggerCache.getOrganizationCache().put(cacheKey, organization); } diff --git a/nebula-logger/core/main/logger-engine/lwc/logger/loggerService.js b/nebula-logger/core/main/logger-engine/lwc/logger/loggerService.js index 6818ef0db..06e5f300a 100644 --- a/nebula-logger/core/main/logger-engine/lwc/logger/loggerService.js +++ b/nebula-logger/core/main/logger-engine/lwc/logger/loggerService.js @@ -10,7 +10,7 @@ import LoggerServiceTaskQueue from './loggerServiceTaskQueue'; import getSettings from '@salesforce/apex/ComponentLogger.getSettings'; import saveComponentLogEntries from '@salesforce/apex/ComponentLogger.saveComponentLogEntries'; -const CURRENT_VERSION_NUMBER = 'v4.15.1'; +const CURRENT_VERSION_NUMBER = 'v4.15.2'; const CONSOLE_OUTPUT_CONFIG = { messagePrefix: `%c Nebula Logger ${CURRENT_VERSION_NUMBER} `, diff --git a/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls b/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls index e9cfa7865..15d358839 100644 --- a/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls +++ b/nebula-logger/core/tests/configuration/utilities/LoggerMockDataCreator.cls @@ -32,59 +32,90 @@ public class LoggerMockDataCreator { } /** - * @description Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead of an actual instance + * @description Creates a mock instance of `Database.DeleteResult` - a mock is used instead of an actual instance * to help speed up tests, and to support writing unit tests (instead of integration tests). A fake * record ID is automatically included. * @param isSuccess Indicates if the generated mock should have `isSuccess` - * @return The mock instance of `Database.LeadConvertResult` + * @return The mock instance of `Database.DeleteResult` */ - public static Database.LeadConvertResult createDatabaseLeadConvertResult(Boolean isSuccess) { - return createDatabaseLeadConvertResult(isSuccess, createId(Schema.Lead.SObjectType)); + public static Database.DeleteResult createDatabaseDeleteResult(Boolean isSuccess) { + return createDatabaseDeleteResult(isSuccess, createId(Schema.Account.SObjectType)); } /** - * @description Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead of an actual instance + * @description Creates a mock instance of `Database.DeleteResult` - a mock is used instead of an actual instance * to help speed up tests, and to support writing unit tests (instead of integration tests) * @param isSuccess Indicates if the generated mock should have `isSuccess` * @param recordId The record ID to use within the mock result - * @return The mock instance of `Database.LeadConvertResult` + * @return The mock instance of `Database.DeleteResult` */ - public static Database.LeadConvertResult createDatabaseLeadConvertResult(Boolean isSuccess, Id recordId) { + public static Database.DeleteResult createDatabaseDeleteResult(Boolean isSuccess, Id recordId) { if (isSuccess) { - return (Database.LeadConvertResult) System.JSON.deserialize('{"success": true, "leadid": "' + recordId + '"}', Database.LeadConvertResult.class); + return (Database.DeleteResult) System.JSON.deserialize('{"success": true, "id": "' + recordId + '"}', Database.DeleteResult.class); } else { - return (Database.LeadConvertResult) System.JSON.deserialize( - '{"success":false, "leadid": "' + recordId + '", "errors":[{"message": "convertedStatus is required...", "statusCode": "REQUIRED_FIELD_MISSING"}]}', - Database.LeadConvertResult.class + return (Database.DeleteResult) System.JSON.deserialize( + '{"success":false, "id": "' + recordId + '", "errors":[{"message": "Could not delete...", "statusCode": "DELETE_FAILED"}]}', + Database.DeleteResult.class ); } } /** - * @description Creates a mock instance of `Database.DeleteResult` - a mock is used instead of an actual instance + * @description Creates a mock instance of `Database.EmptyRecycleBinResult` - a mock is used instead of an actual instance * to help speed up tests, and to support writing unit tests (instead of integration tests). A fake * record ID is automatically included. * @param isSuccess Indicates if the generated mock should have `isSuccess` - * @return The mock instance of `Database.DeleteResult` + * @return The mock instance of `Database.EmptyRecycleBinResult` */ - public static Database.DeleteResult createDatabaseDeleteResult(Boolean isSuccess) { - return createDatabaseDeleteResult(isSuccess, createId(Schema.Account.SObjectType)); + public static Database.EmptyRecycleBinResult createDatabaseEmptyRecycleBinResult(Boolean isSuccess) { + return createDatabaseEmptyRecycleBinResult(isSuccess, createId(Schema.Account.SObjectType)); } /** - * @description Creates a mock instance of `Database.DeleteResult` - a mock is used instead of an actual instance + * @description Creates a mock instance of `Database.EmptyRecycleBinResult` - a mock is used instead of an actual instance * to help speed up tests, and to support writing unit tests (instead of integration tests) * @param isSuccess Indicates if the generated mock should have `isSuccess` * @param recordId The record ID to use within the mock result - * @return The mock instance of `Database.DeleteResult` + * @return The mock instance of `Database.EmptyRecycleBinResult` */ - public static Database.DeleteResult createDatabaseDeleteResult(Boolean isSuccess, Id recordId) { + public static Database.EmptyRecycleBinResult createDatabaseEmptyRecycleBinResult(Boolean isSuccess, Id recordId) { if (isSuccess) { - return (Database.DeleteResult) System.JSON.deserialize('{"success": true, "id": "' + recordId + '"}', Database.DeleteResult.class); + return (Database.EmptyRecycleBinResult) System.JSON.deserialize('{"success": true, "id": "' + recordId + '"}', Database.EmptyRecycleBinResult.class); } else { - return (Database.DeleteResult) System.JSON.deserialize( - '{"success":false, "id": "' + recordId + '", "errors":[{"message": "Could not delete...", "statusCode": "DELETE_FAILED"}]}', - Database.DeleteResult.class + return (Database.EmptyRecycleBinResult) System.JSON.deserialize( + '{"success":false, "id": "' + + recordId + + '", "errors":[{"message": "invalid record id; no recycle bin entry found", "statusCode": "INVALID_ID_FIELD"}]}', + Database.EmptyRecycleBinResult.class + ); + } + } + + /** + * @description Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead of an actual instance + * to help speed up tests, and to support writing unit tests (instead of integration tests). A fake + * record ID is automatically included. + * @param isSuccess Indicates if the generated mock should have `isSuccess` + * @return The mock instance of `Database.LeadConvertResult` + */ + public static Database.LeadConvertResult createDatabaseLeadConvertResult(Boolean isSuccess) { + return createDatabaseLeadConvertResult(isSuccess, createId(Schema.Lead.SObjectType)); + } + + /** + * @description Creates a mock instance of `Database.LeadConvertResult` - a mock is used instead of an actual instance + * to help speed up tests, and to support writing unit tests (instead of integration tests) + * @param isSuccess Indicates if the generated mock should have `isSuccess` + * @param recordId The record ID to use within the mock result + * @return The mock instance of `Database.LeadConvertResult` + */ + public static Database.LeadConvertResult createDatabaseLeadConvertResult(Boolean isSuccess, Id recordId) { + if (isSuccess) { + return (Database.LeadConvertResult) System.JSON.deserialize('{"success": true, "leadid": "' + recordId + '"}', Database.LeadConvertResult.class); + } else { + return (Database.LeadConvertResult) System.JSON.deserialize( + '{"success":false, "leadid": "' + recordId + '", "errors":[{"message": "convertedStatus is required...", "statusCode": "REQUIRED_FIELD_MISSING"}]}', + Database.LeadConvertResult.class ); } } diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls index 5647ea9d3..00e2ce7af 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls @@ -1479,7 +1479,7 @@ private class LogEntryEventHandler_Tests { } private static void validateLogFields(LogEntryEvent__e logEntryEvent, Log__c log) { - Schema.Organization org = [SELECT Id, Name, InstanceName, IsSandbox, NamespacePrefix, OrganizationType, TrialExpirationDate FROM Organization]; + Schema.Organization org = [SELECT Id, Name, InstanceName, IsSandbox, NamespacePrefix, OrganizationType, TrialExpirationDate FROM Organization LIMIT 1]; String orgEnvironmentType; if (org.IsSandbox && org.TrialExpirationDate != null) { orgEnvironmentType = 'Scratch Org'; diff --git a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls index 120aafe2e..f483dfb51 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls @@ -21,11 +21,15 @@ private class LogEntryEventBuilder_Tests { System.Assert.isNull(builder.setMessage(getMessage()).getLogEntryEvent()); System.Assert.isNull(builder.setExceptionDetails(new System.DmlException()).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult((Database.DeleteResult) null).getLogEntryEvent()); + System.Assert.isNull(builder.setDatabaseResult((Database.EmptyRecycleBinResult) null).getLogEntryEvent()); + System.Assert.isNull(builder.setDatabaseResult((Database.LeadConvertResult) null).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult((Database.MergeResult) null).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult((Database.SaveResult) null).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult((Database.UpsertResult) null).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult((Database.UndeleteResult) null).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); + System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); + System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); System.Assert.isNull(builder.setDatabaseResult(new List()).getLogEntryEvent()); @@ -649,31 +653,45 @@ private class LogEntryEventBuilder_Tests { } @IsTest - static void it_should_set_database_result_fields_for_leadConvertResult() { - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); - System.Assert.isNotNull(leadConvertResult); + static void it_should_set_database_result_fields_for_deleteResult() { + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + System.Assert.isNotNull(deleteResult); LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); - builder.setDatabaseResult(leadConvertResult); + builder.setDatabaseResult(deleteResult); System.Assert.areEqual(1, builder.getLogEntryEvent().DatabaseResultCollectionSize__c); System.Assert.areEqual('Single', builder.getLogEntryEvent().DatabaseResultCollectionType__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), builder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); } @IsTest - static void it_should_set_database_result_fields_for_deleteResult() { - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - System.Assert.isNotNull(deleteResult); + static void it_should_set_database_result_fields_for_emptyRecycleBinResult() { + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + System.Assert.isNotNull(emptyRecycleBinResult); LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); - builder.setDatabaseResult(deleteResult); + builder.setDatabaseResult(emptyRecycleBinResult); System.Assert.areEqual(1, builder.getLogEntryEvent().DatabaseResultCollectionSize__c); System.Assert.areEqual('Single', builder.getLogEntryEvent().DatabaseResultCollectionType__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), builder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + } + + @IsTest + static void it_should_set_database_result_fields_for_leadConvertResult() { + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + System.Assert.isNotNull(leadConvertResult); + + LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); + builder.setDatabaseResult(leadConvertResult); + + System.Assert.areEqual(1, builder.getLogEntryEvent().DatabaseResultCollectionSize__c); + System.Assert.areEqual('Single', builder.getLogEntryEvent().DatabaseResultCollectionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); } @IsTest @@ -749,35 +767,51 @@ private class LogEntryEventBuilder_Tests { } @IsTest - static void it_should_set_database_result_fields_for_list_of_leadConvertResult() { - List leadConvertResults = new List(); + static void it_should_set_database_result_fields_for_list_of_deleteResult() { + List deleteResults = new List(); for (Integer i = 0; i < 5; i++) { - leadConvertResults.add(LoggerMockDataCreator.createDatabaseLeadConvertResult(false)); + deleteResults.add(LoggerMockDataCreator.createDatabaseDeleteResult(false)); } LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); - builder.setDatabaseResult(leadConvertResults); + builder.setDatabaseResult(deleteResults); - System.Assert.areEqual(leadConvertResults.size(), builder.getLogEntryEvent().DatabaseResultCollectionSize__c); + System.Assert.areEqual(deleteResults.size(), builder.getLogEntryEvent().DatabaseResultCollectionSize__c); System.Assert.areEqual('List', builder.getLogEntryEvent().DatabaseResultCollectionType__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), builder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); } @IsTest - static void it_should_set_database_result_fields_for_list_of_deleteResult() { - List deleteResults = new List(); + static void it_should_set_database_result_fields_for_list_of_emptyRecycleBinResult() { + List emptyRecycleBinResults = new List(); for (Integer i = 0; i < 5; i++) { - deleteResults.add(LoggerMockDataCreator.createDatabaseDeleteResult(false)); + emptyRecycleBinResults.add(LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false)); } LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); - builder.setDatabaseResult(deleteResults); + builder.setDatabaseResult(emptyRecycleBinResults); - System.Assert.areEqual(deleteResults.size(), builder.getLogEntryEvent().DatabaseResultCollectionSize__c); + System.Assert.areEqual(emptyRecycleBinResults.size(), builder.getLogEntryEvent().DatabaseResultCollectionSize__c); System.Assert.areEqual('List', builder.getLogEntryEvent().DatabaseResultCollectionType__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), builder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); + } + + @IsTest + static void it_should_set_database_result_fields_for_list_of_leadConvertResult() { + List leadConvertResults = new List(); + for (Integer i = 0; i < 5; i++) { + leadConvertResults.add(LoggerMockDataCreator.createDatabaseLeadConvertResult(false)); + } + + LogEntryEventBuilder builder = new LogEntryEventBuilder(getUserSettings(), System.LoggingLevel.INFO, true); + builder.setDatabaseResult(leadConvertResults); + + System.Assert.areEqual(leadConvertResults.size(), builder.getLogEntryEvent().DatabaseResultCollectionSize__c); + System.Assert.areEqual('List', builder.getLogEntryEvent().DatabaseResultCollectionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), builder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), builder.getLogEntryEvent().DatabaseResultType__c); } @IsTest diff --git a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls index 04fac5a9d..a0c008a55 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -1316,79 +1316,58 @@ private class Logger_Tests { @IsTest static void it_should_return_true_when_error_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - Boolean returnedValue = Logger.isErrorEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isErrorEnabled()); } @IsTest static void it_should_return_true_when_warn_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.WARN.name(); - Boolean returnedValue = Logger.isWarnEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isWarnEnabled()); } @IsTest static void it_should_return_true_when_info_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.INFO.name(); - Boolean returnedValue = Logger.isInfoEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isInfoEnabled()); } @IsTest static void it_should_return_true_when_debug_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.DEBUG.name(); - Boolean returnedValue = Logger.isDebugEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isDebugEnabled()); } @IsTest static void it_should_return_true_when_fine_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.FINE.name(); - Boolean returnedValue = Logger.isFineEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isFineEnabled()); } @IsTest static void it_should_return_true_when_finer_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.FINER.name(); - Boolean returnedValue = Logger.isFinerEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isFinerEnabled()); } @IsTest static void it_should_return_true_when_finest_logging_level_is_enabled() { - Boolean expectedValue = true; - Logger.getUserSettings().IsEnabled__c = expectedValue; + Logger.getUserSettings().IsEnabled__c = true; Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.FINEST.name(); - Boolean returnedValue = Logger.isFinestEnabled(); - - System.Assert.areEqual(expectedValue, returnedValue); + System.Assert.isTrue(Logger.isFinestEnabled()); } @IsTest @@ -1444,6 +1423,11 @@ private class Logger_Tests { @IsTest static void it_should_save_accurate_timestamp_when_logging_user_has_different_time_zone() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO Move this test to LogEntryEventBuilder_Tests String automatedProcessUsername = 'autoproc@' + System.UserInfo.getOrganizationId(); Schema.User automatedProcessUser = [SELECT Id, TimeZoneSidKey FROM User WHERE Username = :automatedProcessUsername AND Profile.Name = NULL]; @@ -1514,6 +1498,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_defaulted() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -1545,6 +1534,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_specified_via_settings() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -1572,6 +1566,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_event_bus_when_specified_via_setSaveMethod() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -1602,6 +1601,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_defaulted() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -1635,6 +1639,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_specified_via_settings() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -1664,6 +1673,11 @@ private class Logger_Tests { @IsTest static void it_should_save_via_queueable_when_specified_via_setSaveMethod() { + // Temp workaround: the Logger_Tests class is now very large, resulting in some test failures caused by LogEntryHandler trying + // to split & parse an Apex source snippet of Logger_Tests. Until some tests are cleaned up / moved elsewhere, just simply + // ignoring Logger_Tests as an origin (using Logger.ignoreOrigin()) avoids the source snippet code from running in LogEntryHandler + Logger.ignoreOrigin(Logger_Tests.class); + // TODO eliminate references to Log__c, find alternative way to assert on expected data Integer countOfLogEntries = [SELECT COUNT() FROM LogEntry__c]; System.Assert.areEqual(0, countOfLogEntries); @@ -2201,156 +2215,156 @@ private class Logger_Tests { // Start ERROR methods for LogMessage @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_successful_leadConvertResult() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult convertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), convertResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(convertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(convertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_failed_leadConvertResult() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult convertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), convertResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(convertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(convertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_successful_deleteResult() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_failed_deleteResult() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_deleteResultList() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.LeadConvertResult convertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), convertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(convertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(convertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_successful_saveResult() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.LeadConvertResult convertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), convertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(convertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(convertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_failed_saveResult() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); System.Test.startTest(); @@ -2369,25 +2383,25 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_saveResultList() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @@ -2441,36 +2455,36 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_undeleteResultList() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_successful_upsertResult_when_insert() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); System.Test.startTest(); @@ -2489,12 +2503,12 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_failed_upsertResult_when_insert() { + static void it_should_add_an_error_entry_for_logMessage_with_successful_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); System.Test.startTest(); @@ -2508,17 +2522,17 @@ private class Logger_Tests { System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_successful_upsertResult_when_update() { + static void it_should_add_an_error_entry_for_logMessage_with_failed_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); System.Test.startTest(); @@ -2537,26 +2551,122 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_error_entry_for_logMessage_with_failed_upsertResult_when_update() { + static void it_should_add_an_error_entry_for_logMessage_with_deleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + List deleteResults = getDeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), deleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_logMessage_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List saveResults = getSaveResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), saveResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_logMessage_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List undeleteResults = getUndeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getLogMessage(), undeleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @@ -2765,98 +2875,146 @@ private class Logger_Tests { // Start ERROR methods for String @IsTest - static void it_should_add_an_error_entry_for_string_message_with_successful_leadConvertResult() { + static void it_should_add_an_error_entry_for_string_message_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_string_message_with_failed_leadConvertResult() { + static void it_should_add_an_error_entry_for_string_message_with_failed_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_string_message_with_successful_deleteResult() { + static void it_should_add_an_error_entry_for_string_message_with_successful_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_error_entry_for_string_message_with_failed_deleteResult() { + static void it_should_add_an_error_entry_for_string_message_with_failed_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @@ -3076,6 +3234,54 @@ private class Logger_Tests { System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + @IsTest + static void it_should_add_an_error_entry_for_string_message_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_error_entry_for_string_message_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + @IsTest static void it_should_add_an_error_entry_for_string_message_with_saveResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; @@ -3328,98 +3534,146 @@ private class Logger_Tests { // Start WARN methods for LogMessage @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_successful_leadConvertResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_failed_leadConvertResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_failed_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_successful_deleteResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_successful_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_failed_deleteResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_failed_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @@ -3616,14 +3870,16 @@ private class Logger_Tests { } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_exception() { + static void it_should_add_a_warn_entry_for_logMessage_with_deleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List deleteResults = getDeleteResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), deleteResults); System.Test.stopTest(); @@ -3632,109 +3888,118 @@ private class Logger_Tests { System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_recordId_and_exception() { + static void it_should_add_a_warn_entry_for_logMessage_with_emptyRecycleBinResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id, getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_recordId() { + static void it_should_add_a_warn_entry_for_logMessage_with_leadConvertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List leadConvertResults = getLeadConvertResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), leadConvertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_record_and_exception() { + static void it_should_add_a_warn_entry_for_logMessage_with_saveResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List saveResults = getSaveResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord(), getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), saveResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_record() { + static void it_should_add_a_warn_entry_for_logMessage_with_undeleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List undeleteResults = getUndeleteResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), undeleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_recordList_and_exception() { + static void it_should_add_a_warn_entry_for_logMessage_with_upsertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List upsertResults = getUpsertResultList(); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users, getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), upsertResults); System.Test.stopTest(); @@ -3742,22 +4007,21 @@ private class Logger_Tests { System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage_with_recordList() { + static void it_should_add_a_warn_entry_for_logMessage_with_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getException()); System.Test.stopTest(); @@ -3765,84 +4029,170 @@ private class Logger_Tests { System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_logMessage() { + static void it_should_add_a_warn_entry_for_logMessage_with_recordId_and_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage()); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id, getException()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord().Id); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End WARN methods for LogMessage - // Start WARN methods for String @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_successful_leadConvertResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_record_and_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord(), getException()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), getRecord()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_failed_leadConvertResult() { + static void it_should_add_a_warn_entry_for_logMessage_with_recordList_and_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + System.Test.startTest(); + + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users, getException()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), leadConvertResult); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage(), users); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_logMessage() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getLogMessage()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + // End WARN methods for LogMessage + // Start WARN methods for String @IsTest static void it_should_add_a_warn_entry_for_string_message_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; @@ -3891,6 +4241,102 @@ private class Logger_Tests { System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + @IsTest + static void it_should_add_a_warn_entry_for_string_message_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_string_message_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_a_warn_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + @IsTest static void it_should_add_a_warn_entry_for_string_message_with_successful_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; @@ -4084,14 +4530,16 @@ private class Logger_Tests { } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_exception() { + static void it_should_add_a_warn_entry_for_string_message_with_deleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List deleteResults = getDeleteResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), deleteResults); System.Test.stopTest(); @@ -4100,109 +4548,118 @@ private class Logger_Tests { System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_recordId_and_exception() { + static void it_should_add_a_warn_entry_for_string_message_with_emptyRecycleBinResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id, getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_recordId() { + static void it_should_add_a_warn_entry_for_string_message_with_leadConvertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List leadConvertResults = getLeadConvertResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), leadConvertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_record_and_exception() { + static void it_should_add_a_warn_entry_for_string_message_with_saveResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List saveResults = getSaveResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord(), getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), saveResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_record() { + static void it_should_add_a_warn_entry_for_string_message_with_undeleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List undeleteResults = getUndeleteResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), undeleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); - } - + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_recordList_and_exception() { + static void it_should_add_a_warn_entry_for_string_message_with_upsertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List upsertResults = getUpsertResultList(); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users, getException()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), upsertResults); System.Test.stopTest(); @@ -4210,22 +4667,21 @@ private class Logger_Tests { System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message_with_recordList() { + static void it_should_add_a_warn_entry_for_string_message_with_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getException()); System.Test.stopTest(); @@ -4233,504 +4689,499 @@ private class Logger_Tests { System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_a_warn_entry_for_string_message() { + static void it_should_add_a_warn_entry_for_string_message_with_recordId_and_exception() { System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.warn(getMessage()); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id, getException()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End WARN methods for String - // Start INFO methods for LogMessage @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord().Id); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message_with_record_and_exception() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord(), getException()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), getRecord()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message_with_recordList_and_exception() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResult); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users, getException()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(getException().getMessage(), entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.areEqual(getException().getTypeName(), entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage(), users); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + static void it_should_add_a_warn_entry_for_string_message() { + System.LoggingLevel loggingLevel = System.LoggingLevel.WARN; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.warn(getMessage()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + // End WARN methods for String + // Start INFO methods for LogMessage @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_deleteResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_saveResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_undeleteResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_upsertResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_recordId() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_record() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage_with_recordList() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_logMessage() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage()); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End INFO methods for LogMessage - // Start INFO methods for String @IsTest - static void it_should_add_an_info_entry_for_string_message_with_leadConvertResult() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_undeleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_deleteResult() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_undeleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_saveResult() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_undeleteResult() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_upsertResult_when_insert() { + static void it_should_add_an_info_entry_for_logMessage_with_successful_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_upsertResult_when_update() { + static void it_should_add_an_info_entry_for_logMessage_with_failed_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4739,7 +5190,7 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_deleteResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_deleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -4748,13 +5199,13 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), deleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4763,7 +5214,55 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_saveResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_info_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_info_entry_for_logMessage_with_saveResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -4772,13 +5271,13 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), saveResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4787,7 +5286,7 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_undeleteResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_undeleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -4796,13 +5295,13 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), undeleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4811,7 +5310,7 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_upsertResultList() { + static void it_should_add_an_info_entry_for_logMessage_with_upsertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -4820,13 +5319,13 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), upsertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4835,20 +5334,20 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_recordId() { + static void it_should_add_an_info_entry_for_logMessage_with_recordId() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord().Id); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); @@ -4857,20 +5356,20 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_record() { + static void it_should_add_an_info_entry_for_logMessage_with_record() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), getRecord()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); @@ -4879,7 +5378,7 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message_with_recordList() { + static void it_should_add_an_info_entry_for_logMessage_with_recordList() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -4887,13 +5386,13 @@ private class Logger_Tests { System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage(), users); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); @@ -4902,70 +5401,70 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_info_entry_for_string_message() { + static void it_should_add_an_info_entry_for_logMessage() { System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.info(getMessage()); + LogEntryEventBuilder entryBuilder = Logger.info(getLogMessage()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End INFO methods for String + // End INFO methods for LogMessage - // Start DEBUG methods for LogMessage + // Start INFO methods for String @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -4974,443 +5473,352 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_deleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_saveResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord().Id); - - System.Test.stopTest(); - - System.Assert.areEqual(1, Logger.getBufferSize()); - System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); - } - - @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; - setUserLoggingLevel(loggingLevel); - System.Assert.areEqual(0, Logger.getBufferSize()); - - System.Test.startTest(); - - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord()); - - System.Test.stopTest(); - - System.Assert.areEqual(1, Logger.getBufferSize()); - System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); - } - - @IsTest - static void it_should_add_an_debug_entry_for_logMessage_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; - setUserLoggingLevel(loggingLevel); - System.Assert.areEqual(0, Logger.getBufferSize()); - - System.Test.startTest(); - - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), users); - - System.Test.stopTest(); - - System.Assert.areEqual(1, Logger.getBufferSize()); - System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); - } - - @IsTest - static void it_should_add_an_debug_entry_for_logMessage() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; - setUserLoggingLevel(loggingLevel); - System.Assert.areEqual(0, Logger.getBufferSize()); - - System.Test.startTest(); - - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage()); - - System.Test.stopTest(); - - System.Assert.areEqual(1, Logger.getBufferSize()); - System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); - } - // End DEBUG methods for LogMessage - - // Start DEBUG methods for String - @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; - setUserLoggingLevel(loggingLevel); - System.Assert.areEqual(0, Logger.getBufferSize()); - - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); - - System.Test.startTest(); - - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + List deleteResults = getDeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), deleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_deleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + List leadConvertResults = getLeadConvertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), leadConvertResults); System.Test.stopTest(); @@ -5419,14 +5827,14 @@ private class Logger_Tests { System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_saveResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5434,7 +5842,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), saveResults); System.Test.stopTest(); @@ -5449,8 +5857,8 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5458,7 +5866,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), undeleteResults); System.Test.stopTest(); @@ -5473,8 +5881,8 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5482,7 +5890,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), upsertResults); System.Test.stopTest(); @@ -5497,14 +5905,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord().Id); System.Test.stopTest(); @@ -5519,14 +5927,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), getRecord()); System.Test.stopTest(); @@ -5541,15 +5949,15 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), users); System.Test.stopTest(); @@ -5564,14 +5972,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_debug_entry_for_string_message() { - System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + static void it_should_add_an_info_entry_for_string_message() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage()); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage()); System.Test.stopTest(); @@ -5584,44 +5992,44 @@ private class Logger_Tests { System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End DEBUG methods for String + // End INFO methods for String - // Start FINE methods for LogMessage + // Start DEBUG methods for LogMessage @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResult); System.Test.stopTest(); @@ -5636,112 +6044,2636 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_debug_entry_for_logMessage_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), deleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List saveResults = getSaveResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List undeleteResults = getUndeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), undeleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List upsertResults = getUpsertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), upsertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord().Id); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), users); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_logMessage() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + // End DEBUG methods for LogMessage + + // Start DEBUG methods for String + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List saveResults = getSaveResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List undeleteResults = getUndeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List upsertResults = getUpsertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord().Id); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), users); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_debug_entry_for_string_message() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.debug(getMessage()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + // End DEBUG methods for String + + // Start FINE methods for LogMessage + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List saveResults = getSaveResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List undeleteResults = getUndeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List upsertResults = getUpsertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord().Id); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), users); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_logMessage() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + // End FINE methods for LogMessage + + // Start FINE methods for String + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), emptyRecycleBinResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List leadConvertResults = getLeadConvertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), leadConvertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List saveResults = getSaveResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List undeleteResults = getUndeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List upsertResults = getUpsertResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord().Id); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), users); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_fine_entry_for_string_message() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.fine(getMessage()); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + // End FINE methods for String + + // Start FINER methods for LogMessage + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), emptyRecycleBinResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), leadConvertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResults); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_deleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + List leadConvertResults = getLeadConvertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), leadConvertResults); System.Test.stopTest(); @@ -5750,14 +8682,14 @@ private class Logger_Tests { System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_saveResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5765,7 +8697,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResults); System.Test.stopTest(); @@ -5780,8 +8712,8 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5789,7 +8721,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResults); System.Test.stopTest(); @@ -5804,8 +8736,8 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5813,7 +8745,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResults); System.Test.stopTest(); @@ -5828,14 +8760,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_recordId() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord().Id); System.Test.stopTest(); @@ -5850,14 +8782,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord()); System.Test.stopTest(); @@ -5872,15 +8804,15 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage_with_recordList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), users); System.Test.stopTest(); @@ -5895,14 +8827,14 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_logMessage() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_logMessage() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage()); + LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage()); System.Test.stopTest(); @@ -5915,44 +8847,44 @@ private class Logger_Tests { System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End FINE methods for LogMessage + // End FINER methods for LogMessage - // Start FINE methods for String + // Start FINER methods for String @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResult); System.Test.stopTest(); @@ -5967,251 +8899,304 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_deleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_saveResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_string_message_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); + + System.Test.stopTest(); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); + } + + @IsTest + static void it_should_add_an_finer_entry_for_string_message_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + List deleteResults = getDeleteResultList(); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResults); System.Test.stopTest(); @@ -6219,21 +9204,23 @@ private class Logger_Tests { System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_fine_entry_for_string_message() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + static void it_should_add_an_finer_entry_for_string_message_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getMessage()); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), emptyRecycleBinResults); System.Test.stopTest(); @@ -6242,433 +9229,431 @@ private class Logger_Tests { System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End FINE methods for String - // Start FINER methods for LogMessage @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_leadConvertResult() { + static void it_should_add_an_finer_entry_for_string_message_with_leadConvertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + List leadConvertResults = getLeadConvertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), leadConvertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_deleteResult() { + static void it_should_add_an_finer_entry_for_string_message_with_saveResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + List saveResults = getSaveResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_saveResult() { + static void it_should_add_an_finer_entry_for_string_message_with_undeleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + List undeleteResults = getUndeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_undeleteResult() { + static void it_should_add_an_finer_entry_for_string_message_with_upsertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + List upsertResults = getUpsertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_upsertResult_when_insert() { + static void it_should_add_an_finer_entry_for_string_message_with_recordId() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord().Id); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_upsertResult_when_update() { + static void it_should_add_an_finer_entry_for_string_message_with_record() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_deleteResultList() { + static void it_should_add_an_finer_entry_for_string_message_with_recordList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), deleteResults); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), users); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_saveResultList() { + static void it_should_add_an_finer_entry_for_string_message() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.finer(getMessage()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + // End FINER methods for String + // Start FINEST methods for LogMessage @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_deleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_emptyRecycleBinResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_logMessage() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getLogMessage()); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End FINER methods for LogMessage - // Start FINER methods for String @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_leadConvertResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_deleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_undeleteResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_undeleteResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -6677,8 +9662,8 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_successful_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -6686,13 +9671,13 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -6701,702 +9686,707 @@ private class Logger_Tests { } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_upsertResult_when_update() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_upsertResult_when_insert() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_deleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + @IsTest + static void it_should_add_an_finest_entry_for_logMessage_with_successful_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_saveResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_failed_upsertResult_when_update() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_undeleteResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_deleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + List deleteResults = getDeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_upsertResultList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_emptyRecycleBinResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_recordId() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List leadConvertResults = getLeadConvertResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), leadConvertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_record() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_saveResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List saveResults = getSaveResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message_with_recordList() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_undeleteResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List undeleteResults = getUndeleteResultList(); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finer_entry_for_string_message() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINER; + static void it_should_add_an_finest_entry_for_logMessage_with_upsertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + List upsertResults = getUpsertResultList(); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finer(getMessage()); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End FINER methods for String - // Start FINEST methods for LogMessage @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_leadConvertResult() { + static void it_should_add_an_finest_entry_for_logMessage_with_recordId() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord().Id); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_deleteResult() { + static void it_should_add_an_finest_entry_for_logMessage_with_record() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_saveResult() { + static void it_should_add_an_finest_entry_for_logMessage_with_recordList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResult); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), users); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_undeleteResult() { + static void it_should_add_an_finest_entry_for_logMessage() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage()); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } + // End FINEST methods for LogMessage + // Start FINEST methods for String @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_upsertResult_when_insert() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_upsertResult_when_update() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_deleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_deleteResultList() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_saveResultList() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_emptyRecycleBinResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); + Database.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), emptyRecycleBinResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(emptyRecycleBinResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_undeleteResultList() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List undeleteResults = getUndeleteResultList(); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), undeleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_upsertResultList() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_leadConvertResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List upsertResults = getUpsertResultList(); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), leadConvertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_recordId() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord().Id); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_record() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_saveResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), getRecord()); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), saveResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); - System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(getRecord().Id, entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(getRecord()), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage_with_recordList() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_undeleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage(), users); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); - System.Assert.areEqual(System.JSON.serializePretty(users), entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_logMessage() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_undeleteResult() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getLogMessage()); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), undeleteResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); - System.Assert.areEqual(getLogMessage().getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionMessage__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().ExceptionType__c); + System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } - // End FINEST methods for LogMessage - // Start FINEST methods for String @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_leadConvertResult() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(leadConvertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_deleteResult() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_upsertResult_when_insert() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(deleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_saveResult() { + static void it_should_add_an_finest_entry_for_string_message_with_successful_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(saveResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_undeleteResult() { + static void it_should_add_an_finest_entry_for_string_message_with_failed_upsertResult_when_update() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(undeleteResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_upsertResult_when_insert() { + static void it_should_add_an_finest_entry_for_string_message_with_deleteResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + List deleteResults = getDeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Insert', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_upsertResult_when_update() { + static void it_should_add_an_finest_entry_for_string_message_with_emptyRecycleBinResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), emptyRecycleBinResults); System.Test.stopTest(); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.areEqual(loggingLevel.name(), entryBuilder.getLogEntryEvent().LoggingLevel__c); System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.areEqual(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); + System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.class.getName() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(emptyRecycleBinResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.EmptyRecycleBinResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @IsTest - static void it_should_add_an_finest_entry_for_string_message_with_deleteResultList() { + static void it_should_add_an_finest_entry_for_string_message_with_leadConvertResultList() { System.LoggingLevel loggingLevel = System.LoggingLevel.FINEST; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List deleteResults = getDeleteResultList(); + List leadConvertResults = getLeadConvertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.finest(getMessage(), leadConvertResults); System.Test.stopTest(); @@ -7405,8 +10395,8 @@ private class Logger_Tests { System.Assert.areEqual(getMessage(), entryBuilder.getLogEntryEvent().Message__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); - System.Assert.areEqual(System.JSON.serializePretty(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); + System.Assert.areEqual(System.JSON.serializePretty(leadConvertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); + System.Assert.areEqual(Database.LeadConvertResult.class.getName(), entryBuilder.getLogEntryEvent().DatabaseResultType__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().Tags__c); } @@ -7574,102 +10564,102 @@ private class Logger_Tests { // Start logDatabaseErrors() test methods @IsTest - static void it_should_skip_logging_database_leadConvertResult_for_logMessage_when_logging_level_is_disabled() { + static void it_should_skip_logging_database_deleteResult_for_logMessage_when_logging_level_is_disabled() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); Id recordId = System.UserInfo.getUserId(); - Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); - List leadConvertResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, leadConvertResults.size()); + Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); + List deleteResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, leadConvertResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_skip_logging_database_leadConvertResult_for_logMessage_when_no_errors_found() { + static void it_should_skip_logging_database_deleteResult_for_logMessage_when_no_errors_found() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); Id recordId = System.UserInfo.getUserId(); - Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - Database.LeadConvertResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - List leadConvertResults = new List{ successfulResult, anotherSuccessfulResult }; - System.Assert.areEqual(2, leadConvertResults.size()); + Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + Database.DeleteResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + List deleteResults = new List{ successfulResult, anotherSuccessfulResult }; + System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, leadConvertResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_log_database_leadConvertResult_for_string_message_when_isSuccess_is_false() { + static void it_should_log_database_deleteResult_for_logMessage_when_isSuccess_is_false() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; - String message = 'Some message'; + LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); Id recordId = System.UserInfo.getUserId(); - Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); - List convertResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, convertResults.size()); + Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); + List deleteResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, convertResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.isTrue(returnedBuilder.shouldSave()); - System.Assert.areEqual(message, returnedBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(logMessage.getMessage(), returnedBuilder.getLogEntryEvent().Message__c); System.Assert.areEqual(1, returnedBuilder.getLogEntryEvent().DatabaseResultCollectionSize__c); String expectedDatabaseResultJson = System.JSON.serializePretty(unsuccessfulResult); System.Assert.areEqual(expectedDatabaseResultJson, returnedBuilder.getLogEntryEvent().DatabaseResultJson__c); } @IsTest - static void it_should_skip_logging_database_leadConvertResult_for_string_message_when_logging_level_is_disabled() { + static void it_should_skip_logging_database_deleteResult_for_string_message_when_logging_level_is_disabled() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); - Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); - List leadConvertResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, leadConvertResults.size()); + Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); + List deleteResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, leadConvertResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_skip_logging_database_leadConvertResult_for_string_message_when_no_errors_found() { + static void it_should_skip_logging_database_deleteResult_for_string_message_when_no_errors_found() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); - Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - Database.LeadConvertResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); - List leadConvertResults = new List{ successfulResult, anotherSuccessfulResult }; - System.Assert.areEqual(2, leadConvertResults.size()); + Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + Database.DeleteResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); + List deleteResults = new List{ successfulResult, anotherSuccessfulResult }; + System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, leadConvertResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_skip_logging_database_deleteResult_for_logMessage_when_logging_level_is_disabled() { + static void it_should_log_database_deleteResult_for_string_message_when_isSuccess_is_false() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; - LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); + String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); @@ -7677,43 +10667,64 @@ private class Logger_Tests { System.Assert.areEqual(2, deleteResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); + + System.Assert.areEqual(1, Logger.getBufferSize()); + System.Assert.isTrue(returnedBuilder.shouldSave()); + System.Assert.areEqual(message, returnedBuilder.getLogEntryEvent().Message__c); + System.Assert.areEqual(1, returnedBuilder.getLogEntryEvent().DatabaseResultCollectionSize__c); + String expectedDatabaseResultJson = System.JSON.serializePretty(unsuccessfulResult); + System.Assert.areEqual(expectedDatabaseResultJson, returnedBuilder.getLogEntryEvent().DatabaseResultJson__c); + } + + @IsTest + static void it_should_skip_logging_database_leadConvertResult_for_logMessage_when_logging_level_is_disabled() { + System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; + LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); + Id recordId = System.UserInfo.getUserId(); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); + List leadConvertResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, leadConvertResults.size()); + System.Assert.areEqual(0, Logger.getBufferSize()); + Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, leadConvertResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_skip_logging_database_deleteResult_for_logMessage_when_no_errors_found() { + static void it_should_skip_logging_database_leadConvertResult_for_logMessage_when_no_errors_found() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); Id recordId = System.UserInfo.getUserId(); - Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - Database.DeleteResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - List deleteResults = new List{ successfulResult, anotherSuccessfulResult }; - System.Assert.areEqual(2, deleteResults.size()); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + List leadConvertResults = new List{ successfulResult, anotherSuccessfulResult }; + System.Assert.areEqual(2, leadConvertResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, leadConvertResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_log_database_deleteResult_for_logMessage_when_isSuccess_is_false() { + static void it_should_log_database_leadConvertResult_for_logMessage_when_isSuccess_is_false() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; LogMessage logMessage = new LogMessage('Some logMessage for ID {0}', System.UserInfo.getUserId()); Id recordId = System.UserInfo.getUserId(); - Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); - List deleteResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, deleteResults.size()); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); + List convertResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, convertResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, logMessage, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, LogMessage, convertResults); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.isTrue(returnedBuilder.shouldSave()); @@ -7724,53 +10735,53 @@ private class Logger_Tests { } @IsTest - static void it_should_skip_logging_database_deleteResult_for_string_message_when_logging_level_is_disabled() { + static void it_should_skip_logging_database_leadConvertResult_for_string_message_when_logging_level_is_disabled() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); - Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); - List deleteResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, deleteResults.size()); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); + List leadConvertResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, leadConvertResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, leadConvertResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_skip_logging_database_deleteResult_for_string_message_when_no_errors_found() { + static void it_should_skip_logging_database_leadConvertResult_for_string_message_when_no_errors_found() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); - Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - Database.DeleteResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - List deleteResults = new List{ successfulResult, anotherSuccessfulResult }; - System.Assert.areEqual(2, deleteResults.size()); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult anotherSuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + List leadConvertResults = new List{ successfulResult, anotherSuccessfulResult }; + System.Assert.areEqual(2, leadConvertResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); Logger.getUserSettings().LoggingLevel__c = System.LoggingLevel.ERROR.name(); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, leadConvertResults); System.Assert.areEqual(0, Logger.getBufferSize()); System.Assert.isFalse(returnedBuilder.shouldSave()); } @IsTest - static void it_should_log_database_deleteResult_for_string_message_when_isSuccess_is_false() { + static void it_should_log_database_leadConvertResult_for_string_message_when_isSuccess_is_false() { System.LoggingLevel logEntryLevel = System.LoggingLevel.WARN; String message = 'Some message'; Id recordId = System.UserInfo.getUserId(); - Database.DeleteResult successfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(true, recordId); - Database.DeleteResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseDeleteResult(false, recordId); - List deleteResults = new List{ successfulResult, unsuccessfulResult }; - System.Assert.areEqual(2, deleteResults.size()); + Database.LeadConvertResult successfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true, recordId); + Database.LeadConvertResult unsuccessfulResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false, recordId); + List convertResults = new List{ successfulResult, unsuccessfulResult }; + System.Assert.areEqual(2, convertResults.size()); System.Assert.areEqual(0, Logger.getBufferSize()); - LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, deleteResults); + LogEntryEventBuilder returnedBuilder = Logger.logDatabaseErrors(logEntryLevel, message, convertResults); System.Assert.areEqual(1, Logger.getBufferSize()); System.Assert.isTrue(returnedBuilder.shouldSave()); @@ -8492,6 +11503,22 @@ private class Logger_Tests { return deleteResults; } + static List getEmptyRecycleBinResultList() { + List emptyRecycleBinResults = new List(); + for (Integer i = 0; i < 3; i++) { + emptyRecycleBinResults.add(LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true)); + } + return emptyRecycleBinResults; + } + + static List getLeadConvertResultList() { + List leadConvertResults = new List(); + for (Integer i = 0; i < 3; i++) { + leadConvertResults.add(LoggerMockDataCreator.createDatabaseLeadConvertResult(true)); + } + return leadConvertResults; + } + static List getSaveResultList() { List saveResults = new List(); for (Integer i = 0; i < 3; i++) { @@ -8501,11 +11528,11 @@ private class Logger_Tests { } static List getUpsertResultList() { - List upsertresults = new List(); + List upsertResults = new List(); for (Integer i = 0; i < 3; i++) { - upsertresults.add(LoggerMockDataCreator.createDatabaseUpsertResult(true, true)); + upsertResults.add(LoggerMockDataCreator.createDatabaseUpsertResult(true, true)); } - return upsertresults; + return upsertResults; } static List getUndeleteResultList() { diff --git a/nebula-logger/extra-tests/classes/NebulaLogger_E2E_Tests.cls b/nebula-logger/extra-tests/classes/NebulaLogger_E2E_Tests.cls index 860dbee94..bfeb1fb72 100644 --- a/nebula-logger/extra-tests/classes/NebulaLogger_E2E_Tests.cls +++ b/nebula-logger/extra-tests/classes/NebulaLogger_E2E_Tests.cls @@ -138,7 +138,7 @@ private class NebulaLogger_E2E_Tests { private static LogEntry__c findMatchingLogEntry(String message) { LogEntry__c matchingLogEntry; - for (LogEntry__c logEntry : [SELECT Id, Message__c FROM LogEntry__c]) { + for (LogEntry__c logEntry : [SELECT Id, Message__c FROM LogEntry__c LIMIT 100]) { if (logEntry.Message__c == message) { matchingLogEntry = logEntry; break; diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls index 7d5d38cf7..7e4ad268c 100644 --- a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogBatchApexErrorEventHandler_Tests.cls @@ -95,6 +95,6 @@ private class LogBatchApexErrorEventHandler_Tests implements Database.Batchable< } private static Log__c getLog() { - return [SELECT Id, (SELECT Message__c FROM LogEntries__r) FROM Log__c]; + return [SELECT Id, (SELECT Message__c FROM LogEntries__r) FROM Log__c LIMIT 1]; } } diff --git a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFlowExecutionErrorEventHandler_Tests.cls b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFlowExecutionErrorEventHandler_Tests.cls index b621be035..467e80127 100644 --- a/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFlowExecutionErrorEventHandler_Tests.cls +++ b/nebula-logger/plugins/async-failure-additions/plugin/classes/LogFlowExecutionErrorEventHandler_Tests.cls @@ -24,7 +24,7 @@ private class LogFlowExecutionErrorEventHandler_Tests { flowExecutionErrorEvent.ElementApiName = 'test_exception_element'; flowExecutionErrorEvent.FlowApiName = 'Testing_FlowExecutionErrorEvent'; flowExecutionErrorEvent.FlowVersionNumber = 1; - flowExecutionErrorEvent.Username = System.UserInfo.getUserName(); + flowExecutionErrorEvent.Username = System.UserInfo.getUsername(); System.runAs(new Schema.User(Id = [SELECT Id FROM User WHERE Alias = 'autoproc'].Id)) { System.Test.startTest(); diff --git a/nebula-logger/recipes/triggers/Account_Trigger_Logger_Example.trigger b/nebula-logger/recipes/triggers/Account_Trigger_Logger_Example.trigger index cef2a11f4..258d58d1e 100644 --- a/nebula-logger/recipes/triggers/Account_Trigger_Logger_Example.trigger +++ b/nebula-logger/recipes/triggers/Account_Trigger_Logger_Example.trigger @@ -4,7 +4,7 @@ */ trigger Account_Trigger_Logger_Example on Account(before insert, before update, before delete, after insert, after update, after delete, after undelete) { // Get the trigger's list of records - List triggerRecords = Trigger.new != null ? Trigger.new : Trigger.old; + List triggerRecords = Trigger.new ?? Trigger.old; // Log using an instance of LogMessage for more complex strings String messageTemplate = 'Example log entry from Account trigger, processing {0} records'; diff --git a/package.json b/package.json index 05a4aaf55..c8675b027 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nebula-logger", - "version": "4.15.1", + "version": "4.15.2", "description": "The most robust logger for Salesforce. Works with Apex, Lightning Components, Flow, Process Builder & Integrations. Designed for Salesforce admins, developers & architects.", "author": "Jonathan Gillespie", "license": "MIT", @@ -67,7 +67,8 @@ "test": "npm run test:lwc && npm run test:apex", "test:apex": "npm run test:apex:nocoverage -- --code-coverage --detailed-coverage", "test:apex:nocoverage": "npx sf apex run test --concise --test-level RunLocalTests --wait 30 --result-format human --output-dir ./test-coverage/apex", - "test:apex:suite": "npx sf apex run test --concise --suite-names LoggerCore --wait 30 --result-format human --code-coverage --detailed-coverage --output-dir ./tests/apex", + "test:apex:suite": "npx sf apex run test --concise --suite-names LoggerCore --wait 30 --result-format human --code-coverage --detailed-coverage --output-dir ./test-coverage/apex", + "test:apex:suite:nocoverage": "npx sf apex run test --concise --suite-names LoggerCore --wait 30 --result-format human --output-dir ./test-coverage/apex", "test:lwc": "sfdx-lwc-jest --skipApiVersionCheck --coverage", "test:lwc:nocoverage": "sfdx-lwc-jest --skipApiVersionCheck", "test:nocoverage": "npm run test:lwc:nocoverage && npm run test:apex:nocoverage" diff --git a/sfdx-project.json b/sfdx-project.json index 97dbbffcd..4f32927d4 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -9,9 +9,9 @@ "path": "./nebula-logger/core", "definitionFile": "./config/scratch-orgs/base-scratch-def.json", "scopeProfiles": true, - "versionNumber": "4.15.1.NEXT", - "versionName": "System.OrgLimits Optimisations", - "versionDescription": "Updated LogHandler class to cache the Apex call to System.OrgLimits.getMap() to reduce CPU usage", + "versionNumber": "4.15.2.NEXT", + "versionName": "Added Support for Logging EmptyRecyleBinResult", + "versionDescription": "Added Logger method overloads & new LogEntryEventBuilder methods to capture instances of EmptyRecyleBinResult and List. Several LogHandler class to cache the Apex call to System.OrgLimits.getMap() to reduce CPU usage", "releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases", "unpackagedMetadata": { "path": "./nebula-logger/extra-tests" @@ -205,6 +205,7 @@ "Nebula Logger - Core@4.14.18-added-setrecord()-overload-for-list-and-set-parameters": "04t5Y0000015ocbQAA", "Nebula Logger - Core@4.15.0-winter-'25-release": "04t5Y0000015odKQAQ", "Nebula Logger - Core@4.15.1-system.orglimits-optimisations": "04t5Y0000015ohhQAA", + "Nebula Logger - Core@4.15.2-added-support-for-logging-emptyrecylebinresult": "04t5Y0000015oifQAA", "Nebula Logger - Core Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI", "Nebula Logger - Core Plugin - Async Failure Additions@1.0.0": "04t5Y0000015lhiQAA", "Nebula Logger - Core Plugin - Async Failure Additions@1.0.1": "04t5Y0000015lhsQAA",