From f942352798835e89b02a321ead454147464e15ec Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Wed, 27 Nov 2024 14:45:21 +0100 Subject: [PATCH 01/15] Added EmptyRecycleBinResult - documentation --- .../Logger-Engine/LogEntryEventBuilder.md | 64 +- docs/apex/Logger-Engine/Logger.md | 1200 ++++++++++++++--- .../Test-Utilities/LoggerMockDataCreator.md | 41 + .../DatabaseResultType__c.field-meta.xml | 5 + 4 files changed, 1139 insertions(+), 171 deletions(-) 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/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..a16eec750 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 @@ -11,6 +11,11 @@ false + + Database.EmptyRecycleBinResult + false + + Database.DeleteResult false From fa19e177b7e2e5ab0a60114c9961318fe2419b27 Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Wed, 27 Nov 2024 15:56:15 +0100 Subject: [PATCH 02/15] Added EmptyRecycleBinResult - logic --- .../classes/LogEntryEventBuilder.cls | 41 +- .../main/logger-engine/classes/Logger.cls | 784 ++++++++++++++---- .../classes/LogEntryEventBuilder_Tests.cls | 4 + 3 files changed, 653 insertions(+), 176 deletions(-) diff --git a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index b2949fb1e..0562f8ec6 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -197,29 +197,29 @@ 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 +272,25 @@ 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 diff --git a/nebula-logger/core/main/logger-engine/classes/Logger.cls b/nebula-logger/core/main/logger-engine/classes/Logger.cls index 9765df3eb..6d0e460c5 100644 --- a/nebula-logger/core/main/logger-engine/classes/Logger.cls +++ b/nebula-logger/core/main/logger-engine/classes/Logger.cls @@ -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,70 @@ 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 +3362,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 +3379,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/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls index 120aafe2e..761958be9 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()); From 137a4f778606092fa584d12930aa3964f94498c3 Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 5 Dec 2024 10:23:49 +0100 Subject: [PATCH 03/15] Added EmptyRecycleBinResult mocks to LoggerMockDataCreator --- .../utilities/LoggerMockDataCreator.cls | 75 +++++++++++++------ 1 file changed, 53 insertions(+), 22 deletions(-) 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 ); } } From b75af78368e75698da1f820c678b3b32331b451f Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 5 Dec 2024 14:05:52 +0100 Subject: [PATCH 04/15] unit tests for EmptyRecycleBinResult and UT improvements --- .../classes/LogEntryEventBuilder.cls | 9 +- .../classes/LoggerParameter_Tests.cls | 2 +- .../classes/LogEntryHandler_Tests.cls | 2 +- .../classes/FlowCollectionLogEntry_Tests.cls | 8 +- .../classes/FlowRecordLogEntry_Tests.cls | 8 +- .../classes/LogEntryEventBuilder_Tests.cls | 4 +- .../classes/LoggerSObjectProxy_Tests.cls | 2 +- .../logger-engine/classes/Logger_Tests.cls | 5361 +++++++++++++---- .../plugin/classes/LogEntryArchiveBuilder.cls | 4 +- .../classes/LogEntryArchiveBuilder_Tests.cls | 4 +- 10 files changed, 4210 insertions(+), 1194 deletions(-) diff --git a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index 0562f8ec6..3c3997fc7 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -210,7 +210,11 @@ global with sharing class LogEntryEventBuilder { * @return The same instance of `LogEntryEventBuilder`, useful for chaining methods */ global LogEntryEventBuilder setDatabaseResult(Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return this.setDatabaseDetails(new List{ emptyRecycleBinResult }, Database.EmptyRecycleBinResult.class, emptyRecycleBinResult?.getId()); + return this.setDatabaseDetails( + new List{ emptyRecycleBinResult }, + Database.EmptyRecycleBinResult.class, + emptyRecycleBinResult?.getId() + ); } /** @@ -272,7 +276,6 @@ 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 @@ -1048,7 +1051,7 @@ global with sharing class LogEntryEventBuilder { private static void setUserInfoDetails(LogEntryEvent__e templateLogEntryEvent) { templateLogEntryEvent.Locale__c = System.UserInfo.getLocale(); templateLogEntryEvent.LoggedById__c = System.UserInfo.getUserId(); - templateLogEntryEvent.LoggedByUsername__c = System.UserInfo.getUsername(); + templateLogEntryEvent.LoggedByUsername__c = System.UserInfo.getUserName(); templateLogEntryEvent.ProfileId__c = System.UserInfo.getProfileId(); templateLogEntryEvent.ThemeDisplayed__c = System.UserInfo.getUiThemeDisplayed(); templateLogEntryEvent.TimeZoneId__c = System.UserInfo.getTimeZone().getId(); diff --git a/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls b/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls index f9ce345e4..a163bfd8d 100644 --- a/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls +++ b/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls @@ -7,7 +7,7 @@ @IsTest(IsParallel=true) private class LoggerParameter_Tests { private static Schema.User getUserRecord() { - return new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); + return new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); } @IsTest diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls index de58d8e0c..9403950b5 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls @@ -1266,7 +1266,7 @@ private class LogEntryHandler_Tests { if (IS_OMNISTUDIO_ENABLED == false) { return; } - Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); + Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); SObject mockOmniProcessRecord = (SObject) (System.Type.forName('Schema.OmniProcess').newInstance()); LoggerSObjectProxy.OmniProcess mockOmniProcessProxy = new LoggerSObjectProxy.OmniProcess(mockOmniProcessRecord); mockOmniProcessProxy.CreatedById = System.UserInfo.getUserId(); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls index 8ebfbac13..e2ef02525 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls @@ -22,7 +22,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -63,7 +63,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -102,7 +102,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -148,7 +148,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.ERROR; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls index 4c43f7d46..9359b5e00 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls @@ -22,7 +22,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -64,7 +64,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -108,7 +108,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -145,7 +145,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUsername() + Username = System.UserInfo.getUserName() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.ERROR; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; 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 761958be9..196982545 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls @@ -1221,7 +1221,7 @@ private class LogEntryEventBuilder_Tests { Schema.User nullUser; Map userIdToUser = new Map{ mockUserId => nullUser, - System.UserInfo.getUserId() => new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()) + System.UserInfo.getUserId() => new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()) }; builder.setRecord(userIdToUser); @@ -1877,7 +1877,7 @@ private class LogEntryEventBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), builder.getLogEntryEvent().LoggedById__c); System.Assert.areEqual(System.UserInfo.getLocale(), builder.getLogEntryEvent().Locale__c); System.Assert.areEqual(System.UserInfo.getUserId(), builder.getLogEntryEvent().LoggedById__c); - System.Assert.areEqual(System.UserInfo.getUsername(), builder.getLogEntryEvent().LoggedByUsername__c); + System.Assert.areEqual(System.UserInfo.getUserName(), builder.getLogEntryEvent().LoggedByUsername__c); System.Assert.areEqual(System.UserInfo.getProfileId(), builder.getLogEntryEvent().ProfileId__c); System.Assert.areEqual(System.UserInfo.getUiThemeDisplayed(), builder.getLogEntryEvent().ThemeDisplayed__c); System.Assert.areEqual(System.UserInfo.getTimeZone().getId(), builder.getLogEntryEvent().TimeZoneId__c); diff --git a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls index 680bc019c..34f345b60 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls @@ -102,7 +102,7 @@ private class LoggerSObjectProxy_Tests { if (IS_OMNISTUDIO_ENABLED == false) { return; } - Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); + Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); // String createdByFieldName = 'CreatedBy'; String createdByIdFieldName = 'CreatedById'; String createdDateFieldName = 'CreatedDate'; 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..7e5e8e9e1 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -2201,156 +2201,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 +2369,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 +2441,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 +2489,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 +2508,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 +2537,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,145 +2861,193 @@ 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_saveResult() { + 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.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), saveResult); + 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(saveResult.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(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.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_error_entry_for_string_message_with_failed_saveResult() { + 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.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.error(getMessage(), saveResult); + 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(saveResult.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(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__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_successful_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(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_error_entry_for_string_message_with_failed_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.ERROR; + setUserLoggingLevel(loggingLevel); + System.Assert.areEqual(0, Logger.getBufferSize()); + + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); + + System.Test.startTest(); + + LogEntryEventBuilder entryBuilder = Logger.error(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); } @@ -3076,6 +3220,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 +3520,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 +3856,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 +3874,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 +3993,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 +4015,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.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 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_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.warn(getMessage(), leadConvertResult); + 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(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(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_a_warn_entry_for_string_message_with_failed_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(false); + 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.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_logMessage_with_recordList_and_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, 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(); + + 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(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 +4227,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 +4516,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 +4534,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().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 +4653,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().Tags__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 +4675,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.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(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() + '.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 +5176,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 +5185,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 +5200,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 +5257,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 +5272,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 +5281,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 +5296,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 +5305,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 +5320,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 +5342,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 +5364,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 +5372,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 +5387,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,491 +5459,491 @@ 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); + 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(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(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_debug_entry_for_logMessage_with_record() { - 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.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), getRecord()); + 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(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(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_recordList() { - 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.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), users); + 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(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(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() { - 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.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(false, false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage()); + 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(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.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() + '.Update', entryBuilder.getLogEntryEvent().DatabaseResultType__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; + 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.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(true); + List deleteResults = getDeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), leadConvertResult); + 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(leadConvertResult.getLeadId(), entryBuilder.getLogEntryEvent().RecordId__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.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_deleteResult() { - 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.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResult); + 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(deleteResult.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(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.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_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_leadConvertResultList() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(true); + List leadConvertResults = getLeadConvertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.info(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(saveResult.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(saveResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.SaveResult.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_undeleteResult() { - 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()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + List saveResults = getSaveResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResult); + LogEntryEventBuilder entryBuilder = Logger.info(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(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.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_upsertResult_when_insert() { - 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()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + List undeleteResults = getUndeleteResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(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(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(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_upsertResult_when_update() { - 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()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + List upsertResults = getUpsertResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResult); + LogEntryEventBuilder entryBuilder = Logger.info(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.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(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_deleteResultList() { - 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()); - List deleteResults = getDeleteResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), deleteResults); + LogEntryEventBuilder entryBuilder = Logger.info(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.isNull(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(deleteResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.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_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_record() { + System.LoggingLevel loggingLevel = System.LoggingLevel.INFO; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - List saveResults = getSaveResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), saveResults); + LogEntryEventBuilder entryBuilder = Logger.info(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.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.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_undeleteResultList() { - 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()); - List undeleteResults = getUndeleteResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), undeleteResults); + List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; + LogEntryEventBuilder entryBuilder = Logger.info(getMessage(), users); System.Test.stopTest(); @@ -5466,23 +5951,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.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(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_with_upsertResultList() { - 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()); - List upsertResults = getUpsertResultList(); - System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), upsertResults); + LogEntryEventBuilder entryBuilder = Logger.info(getMessage()); System.Test.stopTest(); @@ -5491,105 +5974,112 @@ 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(upsertResults), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UpsertResult.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 INFO methods for String + // Start DEBUG methods for LogMessage @IsTest - static void it_should_add_an_debug_entry_for_string_message_with_recordId() { + 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.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord().Id); + 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(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.areEqual(deleteResult.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(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_record() { + 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(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), getRecord()); + 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(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.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_recordList() { + 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.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(true); + System.Test.startTest(); - List users = [SELECT Id, Name, Username, IsActive FROM User LIMIT 5]; - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage(), users); + 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(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(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_debug_entry_for_string_message() { + 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.EmptyRecycleBinResult emptyRecycleBinResult = LoggerMockDataCreator.createDatabaseEmptyRecycleBinResult(false); + System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.debug(getMessage()); + 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(getMessage(), entryBuilder.getLogEntryEvent().Message__c); - System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordId__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.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); } - // End DEBUG methods for String - // Start FINE 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_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); @@ -5597,7 +6087,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), leadConvertResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), leadConvertResult); System.Test.stopTest(); @@ -5612,32 +6102,32 @@ private class Logger_Tests { } @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_leadConvertResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.DeleteResult deleteResult = LoggerMockDataCreator.createDatabaseDeleteResult(true); + Database.LeadConvertResult leadConvertResult = LoggerMockDataCreator.createDatabaseLeadConvertResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), deleteResult); + 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(deleteResult.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(deleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.DeleteResult.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_fine_entry_for_logMessage_with_saveResult() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + 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()); @@ -5645,7 +6135,7 @@ private class Logger_Tests { System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), saveResult); + LogEntryEventBuilder entryBuilder = Logger.debug(getLogMessage(), saveResult); System.Test.stopTest(); @@ -5660,47 +6150,2403 @@ private class Logger_Tests { } @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_saveResult() { + System.LoggingLevel loggingLevel = System.LoggingLevel.DEBUG; setUserLoggingLevel(loggingLevel); System.Assert.areEqual(0, Logger.getBufferSize()); - Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); + Database.SaveResult saveResult = LoggerMockDataCreator.createDatabaseSaveResult(false); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), undeleteResult); + 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(undeleteResult.getId(), 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(undeleteResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); - System.Assert.areEqual(Database.UndeleteResult.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_logMessage_with_upsertResult_when_insert() { - System.LoggingLevel loggingLevel = System.LoggingLevel.FINE; + 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.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, true); + Database.UndeleteResult undeleteResult = LoggerMockDataCreator.createDatabaseUndeleteResult(true); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + 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(upsertResult.getId(), 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(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(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_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(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_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(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_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(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_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); @@ -5708,40 +8554,112 @@ private class Logger_Tests { } @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_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()); - Database.UpsertResult upsertResult = LoggerMockDataCreator.createDatabaseUpsertResult(true, false); + List emptyRecycleBinResults = getEmptyRecycleBinResultList(); System.Test.startTest(); - LogEntryEventBuilder entryBuilder = Logger.fine(getLogMessage(), upsertResult); + 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 +8668,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 +8683,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 +8698,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 +8707,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 +8722,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 +8731,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 +8746,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 +8768,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 +8790,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 +8813,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 +8833,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 +8885,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(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_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(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_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 +9190,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 +9215,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 +9648,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 +9657,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 +9672,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; + 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(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(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(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(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() + '.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 +10381,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 +10550,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 +10653,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 +10721,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()); @@ -8475,7 +11472,7 @@ private class Logger_Tests { return new Schema.User( Id = System.UserInfo.getUserId(), ProfileId = System.UserInfo.getProfileId(), - Username = System.UserInfo.getUsername(), + Username = System.UserInfo.getUserName(), UserRoleId = System.UserInfo.getUserRoleId() ); } @@ -8492,6 +11489,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 +11514,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/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls index 328f82db8..3553da7a1 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls @@ -51,7 +51,7 @@ public without sharing class LogEntryArchiveBuilder { ApiVersion__c = this.logEntryEvent.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), ArchivedDate__c = System.now(), - ArchivedByUsername__c = System.UserInfo.getUsername(), + ArchivedByUsername__c = System.UserInfo.getUserName(), ComponentType__c = this.logEntryEvent.ComponentType__c, DatabaseResultCollectionSize__c = this.logEntryEvent.DatabaseResultCollectionSize__c, DatabaseResultCollectionType__c = this.logEntryEvent.DatabaseResultCollectionType__c, @@ -180,7 +180,7 @@ public without sharing class LogEntryArchiveBuilder { ApiVersion__c = this.logEntry.Log__r.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), ArchivedDate__c = System.now(), - ArchivedByUsername__c = System.UserInfo.getUsername(), + ArchivedByUsername__c = System.UserInfo.getUserName(), ClosedById__c = this.logEntry.Log__r.ClosedBy__c, ClosedByUsername__c = this.logEntry.Log__r.ClosedBy__r.Username, ClosedDate__c = this.logEntry.Log__r.ClosedDate__c, diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls index d840c3837..118d18074 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls @@ -93,7 +93,7 @@ private class LogEntryArchiveBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), logEntryArchive.ArchivedById__c, 'logEntryArchive.ArchivedById__c was not properly set'); System.Assert.isNotNull(logEntryArchive.ArchivedDate__c, 'logEntryArchive.ArchivedDate__c was not properly set'); System.Assert.areEqual(System.today(), logEntryArchive.ArchivedDate__c.date(), 'logEntryArchive.ArchivedDate__c was not properly set'); - System.Assert.areEqual(System.UserInfo.getUsername(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); + System.Assert.areEqual(System.UserInfo.getUserName(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); System.Assert.areEqual(mockEvent.ComponentType__c, logEntryArchive.ComponentType__c, 'logEntryArchive.ComponentType__c was not properly set'); System.Assert.areEqual( mockEvent.DatabaseResultCollectionSize__c, @@ -457,7 +457,7 @@ private class LogEntryArchiveBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), logEntryArchive.ArchivedById__c, 'logEntryArchive.ArchivedById__c was not properly set'); System.Assert.isNotNull(logEntryArchive.ArchivedDate__c, 'logEntryArchive.ArchivedDate__c was not properly set'); System.Assert.areEqual(System.today(), logEntryArchive.ArchivedDate__c.date(), 'logEntryArchive.ArchivedDate__c was not properly set'); - System.Assert.areEqual(System.UserInfo.getUsername(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); + System.Assert.areEqual(System.UserInfo.getUserName(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); System.Assert.areEqual(logEntry.Log__r.ClosedBy__c, logEntryArchive.ClosedById__c, 'logEntryArchive.ClosedById__c was not properly set'); System.Assert.areEqual( logEntry.Log__r.ClosedBy__r?.Username, From d21418945eb5fc783570548d2dda2155b5067f80 Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 12 Dec 2024 13:51:41 +0100 Subject: [PATCH 05/15] some tests simplified --- .../main/logger-engine/classes/Logger.cls | 104 +++++++++--------- .../logger-engine/classes/Logger_Tests.cls | 49 +++------ 2 files changed, 68 insertions(+), 85 deletions(-) diff --git a/nebula-logger/core/main/logger-engine/classes/Logger.cls b/nebula-logger/core/main/logger-engine/classes/Logger.cls index 25531aff6..4b2459d9c 100644 --- a/nebula-logger/core/main/logger-engine/classes/Logger.cls +++ b/nebula-logger/core/main/logger-engine/classes/Logger.cls @@ -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); } /** @@ -615,7 +615,7 @@ global with sharing class Logger { * @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); + return error().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -685,7 +685,7 @@ global with sharing class Logger { * @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); + return error().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -695,7 +695,7 @@ global with sharing class Logger { * @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); + return error().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -837,7 +837,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder error(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return error().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return error().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -907,7 +907,7 @@ global with sharing class Logger { * @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); + return error().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -917,7 +917,7 @@ global with sharing class Logger { * @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); + return error().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -1060,7 +1060,7 @@ global with sharing class Logger { * @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); + return warn().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -1130,7 +1130,7 @@ global with sharing class Logger { * @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); + return warn().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -1140,7 +1140,7 @@ global with sharing class Logger { * @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); + return warn().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -1282,7 +1282,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder warn(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return warn().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return warn().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -1352,7 +1352,7 @@ global with sharing class Logger { * @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); + return warn().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -1362,7 +1362,7 @@ global with sharing class Logger { * @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); + return warn().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -1504,7 +1504,7 @@ global with sharing class Logger { * @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); + return info().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -1574,7 +1574,7 @@ global with sharing class Logger { * @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); + return info().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -1584,7 +1584,7 @@ global with sharing class Logger { * @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); + return info().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -1683,7 +1683,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder info(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return info().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return info().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -1753,7 +1753,7 @@ global with sharing class Logger { * @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); + return info().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -1763,7 +1763,7 @@ global with sharing class Logger { * @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); + return info().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -1863,7 +1863,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder debug(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -1933,7 +1933,7 @@ global with sharing class Logger { * @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); + return debug().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -1943,7 +1943,7 @@ global with sharing class Logger { * @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); + return debug().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -2042,7 +2042,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder debug(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return debug().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -2112,7 +2112,7 @@ global with sharing class Logger { * @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); + return debug().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -2122,7 +2122,7 @@ global with sharing class Logger { * @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); + return debug().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -2222,7 +2222,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder fine(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -2292,7 +2292,7 @@ global with sharing class Logger { * @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); + return fine().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -2302,7 +2302,7 @@ global with sharing class Logger { * @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); + return fine().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -2401,7 +2401,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder fine(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return fine().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -2471,7 +2471,7 @@ global with sharing class Logger { * @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); + return fine().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -2481,7 +2481,7 @@ global with sharing class Logger { * @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); + return fine().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -2581,7 +2581,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder finer(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -2651,7 +2651,7 @@ global with sharing class Logger { * @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); + return finer().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -2661,7 +2661,7 @@ global with sharing class Logger { * @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); + return finer().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -2760,7 +2760,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder finer(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return finer().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -2830,7 +2830,7 @@ global with sharing class Logger { * @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); + return finer().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -2840,7 +2840,7 @@ global with sharing class Logger { * @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); + return finer().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -2940,7 +2940,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder finest(LogMessage logMessage, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); + return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(logMessage); } /** @@ -3010,7 +3010,7 @@ global with sharing class Logger { * @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); + return finest().setDatabaseResult(emptyRecycleBinResults).setMessage(logMessage); } /** @@ -3020,7 +3020,7 @@ global with sharing class Logger { * @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); + return finest().setDatabaseResult(leadConvertResults).setMessage(logMessage); } /** @@ -3119,7 +3119,7 @@ global with sharing class Logger { * @return The new entry's instance of `LogEntryEventBuilder`, useful for chaining methods */ global static LogEntryEventBuilder finest(String message, Database.EmptyRecycleBinResult emptyRecycleBinResult) { - return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(message); + return finest().setDatabaseResult(emptyRecycleBinResult).setMessage(message); } /** @@ -3189,7 +3189,7 @@ global with sharing class Logger { * @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); + return finest().setDatabaseResult(emptyRecycleBinResults).setMessage(message); } /** @@ -3199,7 +3199,7 @@ global with sharing class Logger { * @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); + return finest().setDatabaseResult(leadConvertResults).setMessage(message); } /** @@ -3333,7 +3333,11 @@ global with sharing class Logger { * @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) { + global static LogEntryEventBuilder logDatabaseErrors( + System.LoggingLevel loggingLevel, + String message, + List emptyRecycleBinResults + ) { List resultsToLog = new List(); for (Database.EmptyRecycleBinResult emptyRecycleBinResult : emptyRecycleBinResults) { if (emptyRecycleBinResult.isSuccess() == false) { 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 7e5e8e9e1..c21805cd8 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 From 2861c9e0150379b8e9142c86827f5c2a080a7649 Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 12 Dec 2024 14:22:37 +0100 Subject: [PATCH 06/15] null coalescing operators --- .../classes/MicrobatchSelfRegController.cls | 2 +- .../classes/SiteRegisterController.cls | 6 +-- .../configuration/classes/LoggerParameter.cls | 40 +++++++++---------- .../log-management/classes/LogHandler.cls | 4 +- .../classes/LogEntryEventBuilder.cls | 2 +- .../main/logger-engine/classes/Logger.cls | 2 +- .../Account_Trigger_Logger_Example.trigger | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) 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/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/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/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index 3c3997fc7..b9a92a2d6 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -1216,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 4b2459d9c..1148158e1 100644 --- a/nebula-logger/core/main/logger-engine/classes/Logger.cls +++ b/nebula-logger/core/main/logger-engine/classes/Logger.cls @@ -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; } 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'; From 36c937aac917d083cf0f252a781dc6a655f0832a Mon Sep 17 00:00:00 2001 From: Marek Madejski Date: Thu, 12 Dec 2024 14:24:19 +0100 Subject: [PATCH 07/15] System.now and System.today replaced with more explicit equivalents --- docs/apex/Logger-Engine/LogMessage.md | 2 +- .../configuration/classes/LoggerScenarioRule.cls | 2 +- .../fields/EndTime__c.field-meta.xml | 2 +- .../fields/StartTime__c.field-meta.xml | 2 +- .../main/log-management/classes/LogHandler.cls | 2 +- .../classes/LogManagementDataSelector.cls | 2 +- .../classes/FlowCollectionLogEntry.cls | 2 +- .../main/logger-engine/classes/FlowLogEntry.cls | 2 +- .../logger-engine/classes/FlowRecordLogEntry.cls | 2 +- .../core/main/logger-engine/classes/LogMessage.cls | 2 +- .../classes/LoggerScenarioRule_Tests.cls | 12 ++++++------ .../classes/LogEntryEventHandler_Tests.cls | 6 +++--- .../classes/LogEntryHandler_Tests.cls | 6 +++--- .../LogEntryMetadataViewerController_Tests.cls | 8 ++++---- .../classes/LogManagementDataSelector_Tests.cls | 2 +- .../classes/ComponentLogger_Tests.cls | 2 +- .../classes/FlowCollectionLogEntry_Tests.cls | 4 ++-- .../logger-engine/classes/FlowLogEntry_Tests.cls | 4 ++-- .../logger-engine/classes/FlowLogger_Tests.cls | 10 +++++----- .../classes/FlowRecordLogEntry_Tests.cls | 4 ++-- .../classes/LoggerSObjectProxy_Tests.cls | 4 ++-- .../tests/logger-engine/classes/Logger_Tests.cls | 12 ++++++------ .../tests/LoggerCache_Tests_PlatformCache.cls | 4 ++-- .../LogFlowExecutionErrorEventHandler_Tests.cls | 2 +- .../plugin/classes/LogEntryArchiveBuilder.cls | 4 ++-- .../plugin/classes/LogRetentionFilter_Tests.cls | 14 +++++++------- .../plugin/classes/LogRetentionRulesPlugin.cls | 2 +- .../plugin/slack/classes/SlackLoggerPlugin.cls | 2 +- .../slack/classes/SlackLoggerPlugin_Tests.cls | 2 +- 29 files changed, 62 insertions(+), 62 deletions(-) diff --git a/docs/apex/Logger-Engine/LogMessage.md b/docs/apex/Logger-Engine/LogMessage.md index ef1c09337..d9cd161f4 100644 --- a/docs/apex/Logger-Engine/LogMessage.md +++ b/docs/apex/Logger-Engine/LogMessage.md @@ -87,7 +87,7 @@ Constructor to handle dynamically formatting a string with a list of inputs ```java String unformattedMessage = 'my string with 1 input: {0}'; -List arguments = new List{ System.now() }; +List arguments = new List{ System.Datetime.now() }; String formattedMessage = new LogMessage(unformattedMessage, arguments).getMessage(); ``` diff --git a/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls b/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls index d9d344809..d661d7164 100644 --- a/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls +++ b/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls @@ -60,7 +60,7 @@ public without sharing class LoggerScenarioRule { private static Boolean isValid(LoggerScenarioRule__mdt scenarioRule) { Boolean isValid = false; if (scenarioRule.IsEnabled__c) { - Datetime currentTime = System.now(); + Datetime currentTime = System.Datetime.now(); Boolean startTimeIsValid = scenarioRule.StartTime__c == null || scenarioRule.StartTime__c <= currentTime; Boolean endTimeIsValid = scenarioRule.EndTime__c == null || scenarioRule.EndTime__c >= currentTime; diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml index a83ae5fc7..cb23b2ea7 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml @@ -1,7 +1,7 @@ EndTime__c - Optional - when set, the LoggerSettings__c record is only used when EndTime__c >= System.now() + Optional - when set, the LoggerSettings__c record is only used when EndTime__c >= System.Datetime.now() false false diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml index 28027ff74..2a7c41e8b 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml @@ -1,7 +1,7 @@ StartTime__c - Optional - when set, the LoggerSettings__c record is only used when StartTime__c <= System.now() + Optional - when set, the LoggerSettings__c record is only used when StartTime__c <= System.Datetime.now() false false diff --git a/nebula-logger/core/main/log-management/classes/LogHandler.cls b/nebula-logger/core/main/log-management/classes/LogHandler.cls index f8d8d7456..2e763fb15 100644 --- a/nebula-logger/core/main/log-management/classes/LogHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogHandler.cls @@ -82,7 +82,7 @@ public without sharing class LogHandler extends LoggerSObjectHandler { log.ClosedDate__c = null; } else { log.ClosedBy__c = log.ClosedBy__c ?? System.UserInfo.getUserId(); - log.ClosedDate__c = log.ClosedDate__c ?? System.now(); + log.ClosedDate__c = log.ClosedDate__c ?? System.Datetime.now(); } } } diff --git a/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls b/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls index 3658d64e6..3457cf54c 100644 --- a/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls +++ b/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls @@ -121,7 +121,7 @@ public without sharing virtual class LogManagementDataSelector { // Query for recent logs created only today - the status API should be called // at least once per day to make sure that status details are still accurate. // This query should make a callout approximately every 4 hours. - Datetime fourHoursAgo = System.now().addMinutes(-4 * 60); + Datetime fourHoursAgo = System.Datetime.now().addMinutes(-4 * 60); List logs = [ SELECT Id, ApiReleaseNumber__c, ApiReleaseVersion__c, OrganizationReleaseNumber__c, OrganizationReleaseVersion__c diff --git a/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls index 467fae7b4..c0295c461 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls @@ -84,7 +84,7 @@ global inherited sharing class FlowCollectionLogEntry { /** * @description Represents the current system time */ - public DateTime timestamp = System.now(); + public DateTime timestamp = System.Datetime.now(); /** * @description Invocable method for adding LogEntry records via flow or process builder diff --git a/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls index c67a1e496..3cf24853e 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls @@ -84,7 +84,7 @@ global inherited sharing class FlowLogEntry { /** * @description Current system timestamp. */ - public DateTime timestamp = System.now(); + public DateTime timestamp = System.Datetime.now(); /** * @description Invocable method, that can be called via flow. diff --git a/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls index f1ddbd699..6ed01b36d 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls @@ -81,7 +81,7 @@ global inherited sharing class FlowRecordLogEntry { @InvocableVariable(required=false label='DEPRECATED: Use \'Tags\' Instead') public List topics; - public DateTime timestamp = System.now(); + public DateTime timestamp = System.Datetime.now(); /** * @description Invocable method for adding record entries via flow or process builder diff --git a/nebula-logger/core/main/logger-engine/classes/LogMessage.cls b/nebula-logger/core/main/logger-engine/classes/LogMessage.cls index 50c2ef581..d3c01c468 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogMessage.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogMessage.cls @@ -66,7 +66,7 @@ global inherited sharing virtual class LogMessage { * @param messageInputs The list of inputs text to use for any placeholders in the unformatted message * @example * String unformattedMessage = 'my string with 1 input: {0}'; - * List arguments = new List{ System.now() }; + * List arguments = new List{ System.Datetime.now() }; * String formattedMessage = new LogMessage(unformattedMessage, arguments).getMessage(); */ global LogMessage(String unformattedMessage, List messageInputs) { diff --git a/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls b/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls index 4b26c09ef..aec5a8590 100644 --- a/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls +++ b/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls @@ -55,7 +55,7 @@ private class LoggerScenarioRule_Tests { EndTime__c = null, IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.now().addMinutes(-1) + StartTime__c = System.Datetime.now().addMinutes(-1) ); LoggerScenarioRule.setMock(mockRule); @@ -66,7 +66,7 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_load_configured_rule_when_start_time_is_null_and_end_time_is_valid() { - LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt(EndTime__c = System.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario'); + LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt(EndTime__c = System.Datetime.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario'); LoggerScenarioRule.setMock(mockRule); LoggerScenarioRule__mdt returnedRule = LoggerScenarioRule.getInstance(mockRule.Scenario__c); @@ -77,10 +77,10 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_load_configured_rule_when_start_and_end_time_are_both_valid() { LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt( - EndTime__c = System.now().addMinutes(1), + EndTime__c = System.Datetime.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.now().addMinutes(-1) + StartTime__c = System.Datetime.now().addMinutes(-1) ); LoggerScenarioRule.setMock(mockRule); @@ -95,7 +95,7 @@ private class LoggerScenarioRule_Tests { EndTime__c = null, IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.now().addMinutes(1) + StartTime__c = System.Datetime.now().addMinutes(1) ); LoggerScenarioRule.setMock(mockRule); @@ -107,7 +107,7 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_not_load_configured_rule_when_end_time_is_in_the_past() { LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt( - EndTime__c = System.now().addMinutes(-1), + EndTime__c = System.Datetime.now().addMinutes(-1), IsEnabled__c = true, Scenario__c = 'Some Scenario' ); 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..81c8b508a 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls @@ -736,9 +736,9 @@ private class LogEntryEventHandler_Tests { // List tags = new List{ 'test-tag-1', 'test-tag-2' }; // LogEntryEvent__e logEntryEvent = new LogEntryEvent__e( - // EpochTimestamp__c = System.now().getTime(), + // EpochTimestamp__c = System.Datetime.now().getTime(), // Message__c = 'my message', - // Timestamp__c = System.now(), + // Timestamp__c = System.Datetime.now(), // Tags__c = String.join(tags, '\n'), // TransactionEntryNumber__c = 1, // TransactionId__c = transactionId @@ -1125,7 +1125,7 @@ private class LogEntryEventHandler_Tests { TransactionId__c = 'ABC-XYZ' ); insert recentLog; - insert new LogEntry__c(Log__c = recentLog.Id, Timestamp__c = System.now().addHours(-1)); + insert new LogEntry__c(Log__c = recentLog.Id, Timestamp__c = System.Datetime.now().addHours(-1)); LoggerParameter__mdt mockCallStatusApiParameter = new LoggerParameter__mdt(DeveloperName = 'CallStatusApi', Value__c = 'true'); LoggerTestConfigurator.setMock(mockCallStatusApiParameter); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls index 9403950b5..2663c1d5e 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls @@ -13,7 +13,7 @@ private class LogEntryHandler_Tests { LoggerSObjectHandler.shouldExecute(false); Log__c log = (Log__c) LoggerMockDataCreator.createDataBuilder(Schema.Log__c.SObjectType).populateRequiredFields().getRecord(); insert log; - System.Test.setCreatedDate(log.Id, System.now().addDays(-8)); + System.Test.setCreatedDate(log.Id, System.Datetime.now().addDays(-8)); } @IsTest @@ -1271,11 +1271,11 @@ private class LogEntryHandler_Tests { LoggerSObjectProxy.OmniProcess mockOmniProcessProxy = new LoggerSObjectProxy.OmniProcess(mockOmniProcessRecord); mockOmniProcessProxy.CreatedById = System.UserInfo.getUserId(); mockOmniProcessProxy.CreatedBy = currentUser; - mockOmniProcessProxy.CreatedDate = System.now().addDays(-7); + mockOmniProcessProxy.CreatedDate = System.Datetime.now().addDays(-7); mockOmniProcessProxy.Id = LoggerMockDataCreator.createId(mockOmniProcessRecord.getSObjectType()); mockOmniProcessProxy.LastModifiedById = currentUser.Id; mockOmniProcessProxy.LastModifiedBy = currentUser; - mockOmniProcessProxy.LastModifiedDate = System.now().addDays(-1); + mockOmniProcessProxy.LastModifiedDate = System.Datetime.now().addDays(-1); mockOmniProcessProxy.OmniProcessType = 'Integration Procedure'; mockOmniProcessProxy.UniqueName = 'Mock_OmniScript_English_1'; MockLogManagementDataSelector mockSelector = new MockLogManagementDataSelector(); diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls index 48923532d..5f735a916 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls @@ -106,7 +106,7 @@ private class LogEntryMetadataViewerController_Tests { mockLogEntry.ExceptionSourceMetadataType__c = exceptionApexClass == null ? null : LoggerStackTrace.SourceMetadataType.ApexClass.name(); mockLogEntry.OriginSourceApiName__c = originApexClass?.Name; mockLogEntry.OriginSourceMetadataType__c = originApexClass == null ? null : LoggerStackTrace.SourceMetadataType.ApexClass.name(); - mockLogEntry.Timestamp__c = System.now(); + mockLogEntry.Timestamp__c = System.Datetime.now(); return mockLogEntry; } @@ -116,7 +116,7 @@ private class LogEntryMetadataViewerController_Tests { mockLogEntry.ExceptionSourceMetadataType__c = exceptionApexTrigger == null ? null : LoggerStackTrace.SourceMetadataType.ApexTrigger.name(); mockLogEntry.OriginSourceApiName__c = originApexTrigger?.Name; mockLogEntry.OriginSourceMetadataType__c = originApexTrigger == null ? null : LoggerStackTrace.SourceMetadataType.ApexTrigger.name(); - mockLogEntry.Timestamp__c = System.now(); + mockLogEntry.Timestamp__c = System.Datetime.now(); return mockLogEntry; } @@ -125,7 +125,7 @@ private class LogEntryMetadataViewerController_Tests { Body = 'Wow, look at this code for a mock version of apex class ' + mockApexClassName, Name = mockApexClassName ); - return (Schema.ApexClass) LoggerMockDataCreator.setReadOnlyField(mockApexClass, Schema.ApexClass.LastModifiedDate, System.now().addDays(-7)); + return (Schema.ApexClass) LoggerMockDataCreator.setReadOnlyField(mockApexClass, Schema.ApexClass.LastModifiedDate, System.Datetime.now().addDays(-7)); } private static Schema.ApexTrigger createMockApexTrigger(String mockApexTriggerName) { @@ -133,7 +133,7 @@ private class LogEntryMetadataViewerController_Tests { Body = 'Wow, look at this code for a mock version of apex trigger ' + mockApexTriggerName, Name = mockApexTriggerName ); - return (Schema.ApexTrigger) LoggerMockDataCreator.setReadOnlyField(mockApexTrigger, Schema.ApexTrigger.LastModifiedDate, System.now().addDays(-7)); + return (Schema.ApexTrigger) LoggerMockDataCreator.setReadOnlyField(mockApexTrigger, Schema.ApexTrigger.LastModifiedDate, System.Datetime.now().addDays(-7)); } // LogEntryMetadataViewerController uses a few queries via LogManagementDataSelector - this class mocks the query results diff --git a/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls index 4d35cc77d..880129509 100644 --- a/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls @@ -144,7 +144,7 @@ private class LogManagementDataSelector_Tests { TransactionId__c = 'expectedLog.TransactionId__c' ); insert new List{ olderLog, expectedLog }; - System.Test.setCreatedDate(olderLog.Id, System.now().addMinutes(-5)); + System.Test.setCreatedDate(olderLog.Id, System.Datetime.now().addMinutes(-5)); System.Assert.areEqual(1, System.Limits.getQueries(), 'Expected 1 query to be used during test setup'); for (Integer i = 0; i < 3; i++) { diff --git a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls index ce6f9bb55..19ddb1854 100644 --- a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls @@ -507,7 +507,7 @@ private class ComponentLogger_Tests { componentLogEntry.originStackTrace = createMockComponentStackTrace(); componentLogEntry.recordId = currentUser.Id; componentLogEntry.record = currentUser; - componentLogEntry.timestamp = System.now().addDays(-1 / 24); + componentLogEntry.timestamp = System.Datetime.now().addDays(-1 / 24); componentLogEntry.tags = new List{ 'some tag', 'one more tag' }; return componentLogEntry; } diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls index e2ef02525..dd6c43d62 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls @@ -32,7 +32,7 @@ private class FlowCollectionLogEntry_Tests { FlowCollectionLogEntry flowCollectionEntry = createFlowCollectionLogEntry(); flowCollectionEntry.loggingLevelName = flowCollectionEntryLoggingLevel.name(); flowCollectionEntry.records = new List{ currentUser }; - flowCollectionEntry.timestamp = System.now().addSeconds(-20); + flowCollectionEntry.timestamp = System.Datetime.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -246,7 +246,7 @@ private class FlowCollectionLogEntry_Tests { flowCollectionEntry.saveLog = true; flowCollectionEntry.faultMessage = 'Exception message'; flowCollectionEntry.shouldThrowFaultMessageException = true; - flowCollectionEntry.timestamp = System.now(); + flowCollectionEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls index 05b9a27cf..829630f67 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls @@ -25,7 +25,7 @@ private class FlowLogEntry_Tests { LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); FlowLogEntry flowEntry = createFlowLogEntry(); flowEntry.loggingLevelName = flowEntryLoggingLevel.name(); - flowEntry.timestamp = System.now().addSeconds(-20); + flowEntry.timestamp = System.Datetime.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -202,7 +202,7 @@ private class FlowLogEntry_Tests { flowEntry.saveLog = true; flowEntry.faultMessage = 'Exception message'; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls index 6e0489e46..3912a82bb 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls @@ -19,7 +19,7 @@ private class FlowLogger_Tests { flowEntry.message = 'hello from Flow'; flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = false; - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -63,7 +63,7 @@ private class FlowLogger_Tests { flowEntry.message = 'hello from Flow'; flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = true; - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -107,7 +107,7 @@ private class FlowLogger_Tests { flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = true; flowEntry.saveMethodName = Logger.SaveMethod.QUEUEABLE.name(); - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -153,7 +153,7 @@ private class FlowLogger_Tests { flowEntry.saveLog = false; flowEntry.faultMessage = 'Exception message'; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -204,7 +204,7 @@ private class FlowLogger_Tests { flowEntry.saveLog = false; flowEntry.faultMessage = null; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.now(); + flowEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls index 9359b5e00..49ba5da7a 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls @@ -33,7 +33,7 @@ private class FlowRecordLogEntry_Tests { FlowRecordLogEntry flowRecordEntry = createFlowRecordLogEntry(); flowRecordEntry.loggingLevelName = flowRecordEntryLoggingLevel.name(); flowRecordEntry.record = currentUser; - flowRecordEntry.timestamp = System.now().addSeconds(-20); + flowRecordEntry.timestamp = System.Datetime.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -243,7 +243,7 @@ private class FlowRecordLogEntry_Tests { flowRecordEntry.saveLog = true; flowRecordEntry.faultMessage = 'Exception message'; flowRecordEntry.shouldThrowFaultMessageException = true; - flowRecordEntry.timestamp = System.now(); + flowRecordEntry.timestamp = System.Datetime.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls index 34f345b60..953fda33c 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls @@ -116,10 +116,10 @@ private class LoggerSObjectProxy_Tests { Map mockOmniProcessUntyped = new Map{ 'attributes' => new Map{ 'type' => 'OmniProcess' } }; mockOmniProcessUntyped.put(createdByIdFieldName, currentUser.Id); // mockOmniProcessUntyped.put(createdByFieldName, currentUser); - mockOmniProcessUntyped.put(createdDateFieldName, System.now().addDays(-7)); + mockOmniProcessUntyped.put(createdDateFieldName, System.Datetime.now().addDays(-7)); mockOmniProcessUntyped.put(lastModifiedByIdFieldName, currentUser.Id); // mockOmniProcessUntyped.put(lastModifiedByFieldName, currentUser); - mockOmniProcessUntyped.put(lastModifiedDateFieldName, System.now().addDays(-1)); + mockOmniProcessUntyped.put(lastModifiedDateFieldName, System.Datetime.now().addDays(-1)); mockOmniProcessUntyped.put(omniProcessTypeFieldName, 'Integration Procedure'); mockOmniProcessUntyped.put(uniqueFieldName, 'Mock_OmniScript_English_1'); SObject mockOmniProcessRecord = (SObject) System.JSON.deserialize(System.JSON.serialize(mockOmniProcessUntyped), SObject.class); 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 c21805cd8..24d81274a 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -105,7 +105,7 @@ private class Logger_Tests { orgDefaults.Id = null; orgDefaults.LoggingLevel__c = System.LoggingLevel.WARN.name(); orgDefaults.SetupOwnerId = System.UserInfo.getOrganizationId(); - orgDefaults.StartTime__c = System.now().addDays(1); + orgDefaults.StartTime__c = System.Datetime.now().addDays(1); insert orgDefaults; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -124,7 +124,7 @@ private class Logger_Tests { orgDefaults.Id = null; orgDefaults.LoggingLevel__c = System.LoggingLevel.WARN.name(); orgDefaults.SetupOwnerId = System.UserInfo.getOrganizationId(); - orgDefaults.EndTime__c = System.now().addDays(-1); + orgDefaults.EndTime__c = System.Datetime.now().addDays(-1); insert orgDefaults; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -166,7 +166,7 @@ private class Logger_Tests { profileSettings.Id = null; profileSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); profileSettings.SetupOwnerId = System.UserInfo.getProfileId(); - profileSettings.StartTime__c = System.now().addDays(1); + profileSettings.StartTime__c = System.Datetime.now().addDays(1); insert profileSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -188,7 +188,7 @@ private class Logger_Tests { profileSettings.Id = null; profileSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); profileSettings.SetupOwnerId = System.UserInfo.getProfileId(); - profileSettings.EndTime__c = System.now().addDays(-1); + profileSettings.EndTime__c = System.Datetime.now().addDays(-1); insert profileSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -234,7 +234,7 @@ private class Logger_Tests { userSettings.Id = null; userSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); userSettings.SetupOwnerId = System.UserInfo.getUserId(); - userSettings.StartTime__c = System.now().addDays(1); + userSettings.StartTime__c = System.Datetime.now().addDays(1); insert userSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -257,7 +257,7 @@ private class Logger_Tests { userSettings.Id = null; userSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); userSettings.SetupOwnerId = System.UserInfo.getUserId(); - userSettings.EndTime__c = System.now().addDays(-1); + userSettings.EndTime__c = System.Datetime.now().addDays(-1); insert userSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); diff --git a/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls b/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls index 9a6ca83c9..7b186cf11 100644 --- a/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls +++ b/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls @@ -25,7 +25,7 @@ private class LoggerCache_Tests_PlatformCache { // Run the different Cacheable methods to ensure everything works String testKey = 'someKey'; - Object testValue = System.now(); + Object testValue = System.Datetime.now(); System.Assert.isNotNull(organizationCache); System.Assert.isFalse(organizationCache.contains(testKey)); System.Assert.areEqual( @@ -74,7 +74,7 @@ private class LoggerCache_Tests_PlatformCache { // Run the different Cacheable methods to ensure everything works String testKey = 'someKey'; - Object testValue = System.now(); + Object testValue = System.Datetime.now(); System.Assert.isNotNull(sessionCache); System.Assert.isFalse(sessionCache.contains(testKey)); System.Assert.areEqual( 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..4bfb6cf9c 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 @@ -20,7 +20,7 @@ private class LogFlowExecutionErrorEventHandler_Tests { static void it_logs_when_enabled() { setLoggerParamEnabled(true); Schema.FlowExecutionErrorEvent flowExecutionErrorEvent = new Schema.FlowExecutionErrorEvent(); - flowExecutionErrorEvent.EventDate = System.now().addSeconds(-5); + flowExecutionErrorEvent.EventDate = System.Datetime.now().addSeconds(-5); flowExecutionErrorEvent.ElementApiName = 'test_exception_element'; flowExecutionErrorEvent.FlowApiName = 'Testing_FlowExecutionErrorEvent'; flowExecutionErrorEvent.FlowVersionNumber = 1; diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls index 3553da7a1..ed971cf73 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls @@ -50,7 +50,7 @@ public without sharing class LogEntryArchiveBuilder { this.logEntryArchive = new LogEntryArchive__b( ApiVersion__c = this.logEntryEvent.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), - ArchivedDate__c = System.now(), + ArchivedDate__c = System.Datetime.now(), ArchivedByUsername__c = System.UserInfo.getUserName(), ComponentType__c = this.logEntryEvent.ComponentType__c, DatabaseResultCollectionSize__c = this.logEntryEvent.DatabaseResultCollectionSize__c, @@ -179,7 +179,7 @@ public without sharing class LogEntryArchiveBuilder { ApiReleaseVersion__c = this.logEntry.Log__r.ApiReleaseVersion__c, ApiVersion__c = this.logEntry.Log__r.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), - ArchivedDate__c = System.now(), + ArchivedDate__c = System.Datetime.now(), ArchivedByUsername__c = System.UserInfo.getUserName(), ClosedById__c = this.logEntry.Log__r.ClosedBy__c, ClosedByUsername__c = this.logEntry.Log__r.ClosedBy__r.Username, diff --git a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls index 814b5cced..3b095694e 100644 --- a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls +++ b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls @@ -9,7 +9,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_equal_to() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_equal_to'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -32,7 +32,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_not_equal_to() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_not_equal_to'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -55,7 +55,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_less_than() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_less_than'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -77,7 +77,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_less_than_or_equal_to() { - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_less_than_or_equal_to'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'LESS_THAN_OR_EQUAL_TO', 'Value', mockTimestamp) @@ -98,7 +98,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_greater_than() { - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_greater_than'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'GREATER_THAN', 'Value', mockTimestamp) @@ -119,7 +119,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_greater_than_or_equal_to() { - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_greater_than_or_equal_to'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'GREATER_THAN_OR_EQUAL_TO', 'Value', mockTimestamp) @@ -141,7 +141,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_throw_illegal_argument_exception_on_datetime_when_invalid_operator() { String invalidOperator = 'THIS_IS_AN_INVALID_OPERATOR'; - Datetime mockTimestamp = System.now(); + Datetime mockTimestamp = System.Datetime.now(); LogRetentionRule__mdt rule = createMockRule('number_with_invalid_operator'); List conditions = new List{ createMockRuleCondition('Timestamp__c', invalidOperator, 'Value', mockTimestamp) diff --git a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls index 00d782d8f..aef136da7 100644 --- a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls +++ b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls @@ -69,7 +69,7 @@ public without sharing class LogRetentionRulesPlugin implements LoggerPlugin.Tri } Integer numberOfDaysToRetainLogs = Integer.valueOf(filterResult.getRule().NumberOfDaysToRetainLogs__c); - log.LogRetentionDate__c = numberOfDaysToRetainLogs == null ? null : System.today().addDays(numberOfDaysToRetainLogs); + log.LogRetentionDate__c = numberOfDaysToRetainLogs == null ? null : System.Date.today().addDays(numberOfDaysToRetainLogs); logIdToLog.put(log.Id, log); } diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls index 50a596e76..95f95fe20 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls @@ -108,7 +108,7 @@ public without sharing class SlackLoggerPlugin implements LoggerPlugin.Triggerab Logger.finest('Sent log entries to Slack endpoint').setHttpResponseDetails(response); } - log.SlackNotificationDate__c = System.now(); + log.SlackNotificationDate__c = System.Datetime.now(); sentLogs.add(log); } Logger.saveLog(); diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls index c28694aaf..c7b7056ae 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls @@ -224,7 +224,7 @@ private class SlackLoggerPlugin_Tests { LoggingLevel__c = logEntryLoggingLevel.name(), LoggingLevelOrdinal__c = logEntryLoggingLevel.ordinal(), StackTrace__c = 'A stack trace', - Timestamp__c = System.now() + Timestamp__c = System.Datetime.now() ); insert logEntry; return queryLogs(logEntryLoggingLevel); From 31d65d6d9acc688fc33987784cae9a2c0b674842 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Mon, 16 Dec 2024 10:16:56 -0500 Subject: [PATCH 08/15] Bumped package version number, name, and description --- README.md | 2 +- nebula-logger/core/main/logger-engine/classes/Logger.cls | 2 +- .../core/main/logger-engine/lwc/logger/loggerService.js | 2 +- package.json | 5 +++-- sfdx-project.json | 6 +++--- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 95febe2da..82168edd4 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ 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) diff --git a/nebula-logger/core/main/logger-engine/classes/Logger.cls b/nebula-logger/core/main/logger-engine/classes/Logger.cls index 1148158e1..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.'; 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/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..6f0a0f016 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" From dfd7b8c4f7c0e8efa925cff98ef450cbdbb34fd6 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Mon, 16 Dec 2024 10:37:57 -0500 Subject: [PATCH 09/15] [WIP] Fixed some test failures in Logger_Tests --- .../DatabaseResultType__c.field-meta.xml | 8 ++++---- .../logger-engine/classes/Logger_Tests.cls | 20 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) 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 a16eec750..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 @@ -12,14 +12,14 @@ false - Database.EmptyRecycleBinResult + Database.DeleteResult false - + - Database.DeleteResult + Database.EmptyRecycleBinResult false - + Database.LeadConvertResult 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 24d81274a..075c8ce90 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -5693,7 +5693,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -5717,7 +5717,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -6835,7 +6835,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -6859,7 +6859,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -7977,7 +7977,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -8001,7 +8001,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -9119,7 +9119,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -9143,7 +9143,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -10261,7 +10261,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); @@ -10285,7 +10285,7 @@ private class Logger_Tests { 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(upsertResult.getId(), entryBuilder.getLogEntryEvent().RecordId__c); System.Assert.isNull(entryBuilder.getLogEntryEvent().RecordJson__c); System.Assert.areEqual(System.JSON.serializePretty(upsertResult), entryBuilder.getLogEntryEvent().DatabaseResultJson__c); From c37a2dcaeb77e033a92cb768c1dc0157f31ff5a6 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 09:15:53 -0500 Subject: [PATCH 10/15] Reverted changes to casing in UserInfo.getUsername() --- .../main/logger-engine/classes/LogEntryEventBuilder.cls | 2 +- .../tests/configuration/classes/LoggerParameter_Tests.cls | 2 +- .../log-management/classes/LogEntryHandler_Tests.cls | 2 +- .../classes/FlowCollectionLogEntry_Tests.cls | 8 ++++---- .../logger-engine/classes/FlowRecordLogEntry_Tests.cls | 8 ++++---- .../logger-engine/classes/LogEntryEventBuilder_Tests.cls | 4 ++-- .../logger-engine/classes/LoggerSObjectProxy_Tests.cls | 2 +- .../core/tests/logger-engine/classes/Logger_Tests.cls | 2 +- .../classes/LogFlowExecutionErrorEventHandler_Tests.cls | 2 +- .../plugin/classes/LogEntryArchiveBuilder.cls | 4 ++-- .../plugin/classes/LogEntryArchiveBuilder_Tests.cls | 4 ++-- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls index b9a92a2d6..4bb5d820d 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogEntryEventBuilder.cls @@ -1051,7 +1051,7 @@ global with sharing class LogEntryEventBuilder { private static void setUserInfoDetails(LogEntryEvent__e templateLogEntryEvent) { templateLogEntryEvent.Locale__c = System.UserInfo.getLocale(); templateLogEntryEvent.LoggedById__c = System.UserInfo.getUserId(); - templateLogEntryEvent.LoggedByUsername__c = System.UserInfo.getUserName(); + templateLogEntryEvent.LoggedByUsername__c = System.UserInfo.getUsername(); templateLogEntryEvent.ProfileId__c = System.UserInfo.getProfileId(); templateLogEntryEvent.ThemeDisplayed__c = System.UserInfo.getUiThemeDisplayed(); templateLogEntryEvent.TimeZoneId__c = System.UserInfo.getTimeZone().getId(); diff --git a/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls b/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls index a163bfd8d..f9ce345e4 100644 --- a/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls +++ b/nebula-logger/core/tests/configuration/classes/LoggerParameter_Tests.cls @@ -7,7 +7,7 @@ @IsTest(IsParallel=true) private class LoggerParameter_Tests { private static Schema.User getUserRecord() { - return new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); + return new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); } @IsTest diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls index 2663c1d5e..0c93352bb 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls @@ -1266,7 +1266,7 @@ private class LogEntryHandler_Tests { if (IS_OMNISTUDIO_ENABLED == false) { return; } - Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); + Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); SObject mockOmniProcessRecord = (SObject) (System.Type.forName('Schema.OmniProcess').newInstance()); LoggerSObjectProxy.OmniProcess mockOmniProcessProxy = new LoggerSObjectProxy.OmniProcess(mockOmniProcessRecord); mockOmniProcessProxy.CreatedById = System.UserInfo.getUserId(); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls index dd6c43d62..042c4f374 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls @@ -22,7 +22,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -63,7 +63,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -102,7 +102,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -148,7 +148,7 @@ private class FlowCollectionLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.ERROR; System.LoggingLevel flowCollectionEntryLoggingLevel = System.LoggingLevel.DEBUG; diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls index 49ba5da7a..3a3c57556 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls @@ -22,7 +22,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -64,7 +64,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -108,7 +108,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.FINEST; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; @@ -145,7 +145,7 @@ private class FlowRecordLogEntry_Tests { Id = System.UserInfo.getUserId(), FirstName = System.UserInfo.getFirstName(), LastName = System.UserInfo.getLastName(), - Username = System.UserInfo.getUserName() + Username = System.UserInfo.getUsername() ); System.LoggingLevel userLoggingLevel = System.LoggingLevel.ERROR; System.LoggingLevel flowRecordEntryLoggingLevel = System.LoggingLevel.DEBUG; 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 196982545..761958be9 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls @@ -1221,7 +1221,7 @@ private class LogEntryEventBuilder_Tests { Schema.User nullUser; Map userIdToUser = new Map{ mockUserId => nullUser, - System.UserInfo.getUserId() => new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()) + System.UserInfo.getUserId() => new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()) }; builder.setRecord(userIdToUser); @@ -1877,7 +1877,7 @@ private class LogEntryEventBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), builder.getLogEntryEvent().LoggedById__c); System.Assert.areEqual(System.UserInfo.getLocale(), builder.getLogEntryEvent().Locale__c); System.Assert.areEqual(System.UserInfo.getUserId(), builder.getLogEntryEvent().LoggedById__c); - System.Assert.areEqual(System.UserInfo.getUserName(), builder.getLogEntryEvent().LoggedByUsername__c); + System.Assert.areEqual(System.UserInfo.getUsername(), builder.getLogEntryEvent().LoggedByUsername__c); System.Assert.areEqual(System.UserInfo.getProfileId(), builder.getLogEntryEvent().ProfileId__c); System.Assert.areEqual(System.UserInfo.getUiThemeDisplayed(), builder.getLogEntryEvent().ThemeDisplayed__c); System.Assert.areEqual(System.UserInfo.getTimeZone().getId(), builder.getLogEntryEvent().TimeZoneId__c); diff --git a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls index 953fda33c..29f763e72 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls @@ -102,7 +102,7 @@ private class LoggerSObjectProxy_Tests { if (IS_OMNISTUDIO_ENABLED == false) { return; } - Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUserName()); + Schema.User currentUser = new Schema.User(Id = System.UserInfo.getUserId(), Username = System.UserInfo.getUsername()); // String createdByFieldName = 'CreatedBy'; String createdByIdFieldName = 'CreatedById'; String createdDateFieldName = 'CreatedDate'; 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 075c8ce90..25b6cd462 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -11451,7 +11451,7 @@ private class Logger_Tests { return new Schema.User( Id = System.UserInfo.getUserId(), ProfileId = System.UserInfo.getProfileId(), - Username = System.UserInfo.getUserName(), + Username = System.UserInfo.getUsername(), UserRoleId = System.UserInfo.getUserRoleId() ); } 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 4bfb6cf9c..e62ea4120 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/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls index ed971cf73..8fe1f98d4 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls @@ -51,7 +51,7 @@ public without sharing class LogEntryArchiveBuilder { ApiVersion__c = this.logEntryEvent.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), ArchivedDate__c = System.Datetime.now(), - ArchivedByUsername__c = System.UserInfo.getUserName(), + ArchivedByUsername__c = System.UserInfo.getUsername(), ComponentType__c = this.logEntryEvent.ComponentType__c, DatabaseResultCollectionSize__c = this.logEntryEvent.DatabaseResultCollectionSize__c, DatabaseResultCollectionType__c = this.logEntryEvent.DatabaseResultCollectionType__c, @@ -180,7 +180,7 @@ public without sharing class LogEntryArchiveBuilder { ApiVersion__c = this.logEntry.Log__r.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), ArchivedDate__c = System.Datetime.now(), - ArchivedByUsername__c = System.UserInfo.getUserName(), + ArchivedByUsername__c = System.UserInfo.getUsername(), ClosedById__c = this.logEntry.Log__r.ClosedBy__c, ClosedByUsername__c = this.logEntry.Log__r.ClosedBy__r.Username, ClosedDate__c = this.logEntry.Log__r.ClosedDate__c, diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls index 118d18074..d840c3837 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder_Tests.cls @@ -93,7 +93,7 @@ private class LogEntryArchiveBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), logEntryArchive.ArchivedById__c, 'logEntryArchive.ArchivedById__c was not properly set'); System.Assert.isNotNull(logEntryArchive.ArchivedDate__c, 'logEntryArchive.ArchivedDate__c was not properly set'); System.Assert.areEqual(System.today(), logEntryArchive.ArchivedDate__c.date(), 'logEntryArchive.ArchivedDate__c was not properly set'); - System.Assert.areEqual(System.UserInfo.getUserName(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); + System.Assert.areEqual(System.UserInfo.getUsername(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); System.Assert.areEqual(mockEvent.ComponentType__c, logEntryArchive.ComponentType__c, 'logEntryArchive.ComponentType__c was not properly set'); System.Assert.areEqual( mockEvent.DatabaseResultCollectionSize__c, @@ -457,7 +457,7 @@ private class LogEntryArchiveBuilder_Tests { System.Assert.areEqual(System.UserInfo.getUserId(), logEntryArchive.ArchivedById__c, 'logEntryArchive.ArchivedById__c was not properly set'); System.Assert.isNotNull(logEntryArchive.ArchivedDate__c, 'logEntryArchive.ArchivedDate__c was not properly set'); System.Assert.areEqual(System.today(), logEntryArchive.ArchivedDate__c.date(), 'logEntryArchive.ArchivedDate__c was not properly set'); - System.Assert.areEqual(System.UserInfo.getUserName(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); + System.Assert.areEqual(System.UserInfo.getUsername(), logEntryArchive.ArchivedByUsername__c, 'logEntryArchive.ArchivedByUsername__c was not properly set'); System.Assert.areEqual(logEntry.Log__r.ClosedBy__c, logEntryArchive.ClosedById__c, 'logEntryArchive.ClosedById__c was not properly set'); System.Assert.areEqual( logEntry.Log__r.ClosedBy__r?.Username, From 85277b4609f1ded491f08957992e59c333412f00 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 09:17:16 -0500 Subject: [PATCH 11/15] Reverted changes to System.now() and System.today() --- docs/apex/Logger-Engine/LogMessage.md | 2 +- .../configuration/classes/LoggerScenarioRule.cls | 2 +- .../fields/EndTime__c.field-meta.xml | 2 +- .../fields/StartTime__c.field-meta.xml | 2 +- .../main/log-management/classes/LogHandler.cls | 2 +- .../classes/LogManagementDataSelector.cls | 2 +- .../classes/FlowCollectionLogEntry.cls | 2 +- .../main/logger-engine/classes/FlowLogEntry.cls | 2 +- .../logger-engine/classes/FlowRecordLogEntry.cls | 2 +- .../core/main/logger-engine/classes/LogMessage.cls | 2 +- .../classes/LoggerScenarioRule_Tests.cls | 12 ++++++------ .../classes/LogEntryEventHandler_Tests.cls | 6 +++--- .../classes/LogEntryHandler_Tests.cls | 6 +++--- .../LogEntryMetadataViewerController_Tests.cls | 8 ++++---- .../classes/LogManagementDataSelector_Tests.cls | 2 +- .../classes/ComponentLogger_Tests.cls | 2 +- .../classes/FlowCollectionLogEntry_Tests.cls | 4 ++-- .../logger-engine/classes/FlowLogEntry_Tests.cls | 4 ++-- .../logger-engine/classes/FlowLogger_Tests.cls | 10 +++++----- .../classes/FlowRecordLogEntry_Tests.cls | 4 ++-- .../classes/LoggerSObjectProxy_Tests.cls | 4 ++-- .../tests/logger-engine/classes/Logger_Tests.cls | 12 ++++++------ .../tests/LoggerCache_Tests_PlatformCache.cls | 4 ++-- .../LogFlowExecutionErrorEventHandler_Tests.cls | 2 +- .../plugin/classes/LogEntryArchiveBuilder.cls | 4 ++-- .../plugin/classes/LogRetentionFilter_Tests.cls | 14 +++++++------- .../plugin/classes/LogRetentionRulesPlugin.cls | 2 +- .../plugin/slack/classes/SlackLoggerPlugin.cls | 2 +- .../slack/classes/SlackLoggerPlugin_Tests.cls | 2 +- 29 files changed, 62 insertions(+), 62 deletions(-) diff --git a/docs/apex/Logger-Engine/LogMessage.md b/docs/apex/Logger-Engine/LogMessage.md index d9cd161f4..ef1c09337 100644 --- a/docs/apex/Logger-Engine/LogMessage.md +++ b/docs/apex/Logger-Engine/LogMessage.md @@ -87,7 +87,7 @@ Constructor to handle dynamically formatting a string with a list of inputs ```java String unformattedMessage = 'my string with 1 input: {0}'; -List arguments = new List{ System.Datetime.now() }; +List arguments = new List{ System.now() }; String formattedMessage = new LogMessage(unformattedMessage, arguments).getMessage(); ``` diff --git a/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls b/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls index d661d7164..d9d344809 100644 --- a/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls +++ b/nebula-logger/core/main/configuration/classes/LoggerScenarioRule.cls @@ -60,7 +60,7 @@ public without sharing class LoggerScenarioRule { private static Boolean isValid(LoggerScenarioRule__mdt scenarioRule) { Boolean isValid = false; if (scenarioRule.IsEnabled__c) { - Datetime currentTime = System.Datetime.now(); + Datetime currentTime = System.now(); Boolean startTimeIsValid = scenarioRule.StartTime__c == null || scenarioRule.StartTime__c <= currentTime; Boolean endTimeIsValid = scenarioRule.EndTime__c == null || scenarioRule.EndTime__c >= currentTime; diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml index cb23b2ea7..a83ae5fc7 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/EndTime__c.field-meta.xml @@ -1,7 +1,7 @@ EndTime__c - Optional - when set, the LoggerSettings__c record is only used when EndTime__c >= System.Datetime.now() + Optional - when set, the LoggerSettings__c record is only used when EndTime__c >= System.now() false false diff --git a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml index 2a7c41e8b..28027ff74 100644 --- a/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml +++ b/nebula-logger/core/main/configuration/objects/LoggerSettings__c/fields/StartTime__c.field-meta.xml @@ -1,7 +1,7 @@ StartTime__c - Optional - when set, the LoggerSettings__c record is only used when StartTime__c <= System.Datetime.now() + Optional - when set, the LoggerSettings__c record is only used when StartTime__c <= System.now() false false diff --git a/nebula-logger/core/main/log-management/classes/LogHandler.cls b/nebula-logger/core/main/log-management/classes/LogHandler.cls index 2e763fb15..f8d8d7456 100644 --- a/nebula-logger/core/main/log-management/classes/LogHandler.cls +++ b/nebula-logger/core/main/log-management/classes/LogHandler.cls @@ -82,7 +82,7 @@ public without sharing class LogHandler extends LoggerSObjectHandler { log.ClosedDate__c = null; } else { log.ClosedBy__c = log.ClosedBy__c ?? System.UserInfo.getUserId(); - log.ClosedDate__c = log.ClosedDate__c ?? System.Datetime.now(); + log.ClosedDate__c = log.ClosedDate__c ?? System.now(); } } } diff --git a/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls b/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls index 3457cf54c..3658d64e6 100644 --- a/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls +++ b/nebula-logger/core/main/log-management/classes/LogManagementDataSelector.cls @@ -121,7 +121,7 @@ public without sharing virtual class LogManagementDataSelector { // Query for recent logs created only today - the status API should be called // at least once per day to make sure that status details are still accurate. // This query should make a callout approximately every 4 hours. - Datetime fourHoursAgo = System.Datetime.now().addMinutes(-4 * 60); + Datetime fourHoursAgo = System.now().addMinutes(-4 * 60); List logs = [ SELECT Id, ApiReleaseNumber__c, ApiReleaseVersion__c, OrganizationReleaseNumber__c, OrganizationReleaseVersion__c diff --git a/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls index c0295c461..467fae7b4 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowCollectionLogEntry.cls @@ -84,7 +84,7 @@ global inherited sharing class FlowCollectionLogEntry { /** * @description Represents the current system time */ - public DateTime timestamp = System.Datetime.now(); + public DateTime timestamp = System.now(); /** * @description Invocable method for adding LogEntry records via flow or process builder diff --git a/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls index 3cf24853e..c67a1e496 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowLogEntry.cls @@ -84,7 +84,7 @@ global inherited sharing class FlowLogEntry { /** * @description Current system timestamp. */ - public DateTime timestamp = System.Datetime.now(); + public DateTime timestamp = System.now(); /** * @description Invocable method, that can be called via flow. diff --git a/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls b/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls index 6ed01b36d..f1ddbd699 100644 --- a/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls +++ b/nebula-logger/core/main/logger-engine/classes/FlowRecordLogEntry.cls @@ -81,7 +81,7 @@ global inherited sharing class FlowRecordLogEntry { @InvocableVariable(required=false label='DEPRECATED: Use \'Tags\' Instead') public List topics; - public DateTime timestamp = System.Datetime.now(); + public DateTime timestamp = System.now(); /** * @description Invocable method for adding record entries via flow or process builder diff --git a/nebula-logger/core/main/logger-engine/classes/LogMessage.cls b/nebula-logger/core/main/logger-engine/classes/LogMessage.cls index d3c01c468..50c2ef581 100644 --- a/nebula-logger/core/main/logger-engine/classes/LogMessage.cls +++ b/nebula-logger/core/main/logger-engine/classes/LogMessage.cls @@ -66,7 +66,7 @@ global inherited sharing virtual class LogMessage { * @param messageInputs The list of inputs text to use for any placeholders in the unformatted message * @example * String unformattedMessage = 'my string with 1 input: {0}'; - * List arguments = new List{ System.Datetime.now() }; + * List arguments = new List{ System.now() }; * String formattedMessage = new LogMessage(unformattedMessage, arguments).getMessage(); */ global LogMessage(String unformattedMessage, List messageInputs) { diff --git a/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls b/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls index aec5a8590..4b26c09ef 100644 --- a/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls +++ b/nebula-logger/core/tests/configuration/classes/LoggerScenarioRule_Tests.cls @@ -55,7 +55,7 @@ private class LoggerScenarioRule_Tests { EndTime__c = null, IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.Datetime.now().addMinutes(-1) + StartTime__c = System.now().addMinutes(-1) ); LoggerScenarioRule.setMock(mockRule); @@ -66,7 +66,7 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_load_configured_rule_when_start_time_is_null_and_end_time_is_valid() { - LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt(EndTime__c = System.Datetime.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario'); + LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt(EndTime__c = System.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario'); LoggerScenarioRule.setMock(mockRule); LoggerScenarioRule__mdt returnedRule = LoggerScenarioRule.getInstance(mockRule.Scenario__c); @@ -77,10 +77,10 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_load_configured_rule_when_start_and_end_time_are_both_valid() { LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt( - EndTime__c = System.Datetime.now().addMinutes(1), + EndTime__c = System.now().addMinutes(1), IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.Datetime.now().addMinutes(-1) + StartTime__c = System.now().addMinutes(-1) ); LoggerScenarioRule.setMock(mockRule); @@ -95,7 +95,7 @@ private class LoggerScenarioRule_Tests { EndTime__c = null, IsEnabled__c = true, Scenario__c = 'Some Scenario', - StartTime__c = System.Datetime.now().addMinutes(1) + StartTime__c = System.now().addMinutes(1) ); LoggerScenarioRule.setMock(mockRule); @@ -107,7 +107,7 @@ private class LoggerScenarioRule_Tests { @IsTest static void it_should_not_load_configured_rule_when_end_time_is_in_the_past() { LoggerScenarioRule__mdt mockRule = new LoggerScenarioRule__mdt( - EndTime__c = System.Datetime.now().addMinutes(-1), + EndTime__c = System.now().addMinutes(-1), IsEnabled__c = true, Scenario__c = 'Some Scenario' ); 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 81c8b508a..5647ea9d3 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryEventHandler_Tests.cls @@ -736,9 +736,9 @@ private class LogEntryEventHandler_Tests { // List tags = new List{ 'test-tag-1', 'test-tag-2' }; // LogEntryEvent__e logEntryEvent = new LogEntryEvent__e( - // EpochTimestamp__c = System.Datetime.now().getTime(), + // EpochTimestamp__c = System.now().getTime(), // Message__c = 'my message', - // Timestamp__c = System.Datetime.now(), + // Timestamp__c = System.now(), // Tags__c = String.join(tags, '\n'), // TransactionEntryNumber__c = 1, // TransactionId__c = transactionId @@ -1125,7 +1125,7 @@ private class LogEntryEventHandler_Tests { TransactionId__c = 'ABC-XYZ' ); insert recentLog; - insert new LogEntry__c(Log__c = recentLog.Id, Timestamp__c = System.Datetime.now().addHours(-1)); + insert new LogEntry__c(Log__c = recentLog.Id, Timestamp__c = System.now().addHours(-1)); LoggerParameter__mdt mockCallStatusApiParameter = new LoggerParameter__mdt(DeveloperName = 'CallStatusApi', Value__c = 'true'); LoggerTestConfigurator.setMock(mockCallStatusApiParameter); LogEntryEvent__e logEntryEvent = createLogEntryEvent(); diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls index 0c93352bb..de58d8e0c 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryHandler_Tests.cls @@ -13,7 +13,7 @@ private class LogEntryHandler_Tests { LoggerSObjectHandler.shouldExecute(false); Log__c log = (Log__c) LoggerMockDataCreator.createDataBuilder(Schema.Log__c.SObjectType).populateRequiredFields().getRecord(); insert log; - System.Test.setCreatedDate(log.Id, System.Datetime.now().addDays(-8)); + System.Test.setCreatedDate(log.Id, System.now().addDays(-8)); } @IsTest @@ -1271,11 +1271,11 @@ private class LogEntryHandler_Tests { LoggerSObjectProxy.OmniProcess mockOmniProcessProxy = new LoggerSObjectProxy.OmniProcess(mockOmniProcessRecord); mockOmniProcessProxy.CreatedById = System.UserInfo.getUserId(); mockOmniProcessProxy.CreatedBy = currentUser; - mockOmniProcessProxy.CreatedDate = System.Datetime.now().addDays(-7); + mockOmniProcessProxy.CreatedDate = System.now().addDays(-7); mockOmniProcessProxy.Id = LoggerMockDataCreator.createId(mockOmniProcessRecord.getSObjectType()); mockOmniProcessProxy.LastModifiedById = currentUser.Id; mockOmniProcessProxy.LastModifiedBy = currentUser; - mockOmniProcessProxy.LastModifiedDate = System.Datetime.now().addDays(-1); + mockOmniProcessProxy.LastModifiedDate = System.now().addDays(-1); mockOmniProcessProxy.OmniProcessType = 'Integration Procedure'; mockOmniProcessProxy.UniqueName = 'Mock_OmniScript_English_1'; MockLogManagementDataSelector mockSelector = new MockLogManagementDataSelector(); diff --git a/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls index 5f735a916..48923532d 100644 --- a/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogEntryMetadataViewerController_Tests.cls @@ -106,7 +106,7 @@ private class LogEntryMetadataViewerController_Tests { mockLogEntry.ExceptionSourceMetadataType__c = exceptionApexClass == null ? null : LoggerStackTrace.SourceMetadataType.ApexClass.name(); mockLogEntry.OriginSourceApiName__c = originApexClass?.Name; mockLogEntry.OriginSourceMetadataType__c = originApexClass == null ? null : LoggerStackTrace.SourceMetadataType.ApexClass.name(); - mockLogEntry.Timestamp__c = System.Datetime.now(); + mockLogEntry.Timestamp__c = System.now(); return mockLogEntry; } @@ -116,7 +116,7 @@ private class LogEntryMetadataViewerController_Tests { mockLogEntry.ExceptionSourceMetadataType__c = exceptionApexTrigger == null ? null : LoggerStackTrace.SourceMetadataType.ApexTrigger.name(); mockLogEntry.OriginSourceApiName__c = originApexTrigger?.Name; mockLogEntry.OriginSourceMetadataType__c = originApexTrigger == null ? null : LoggerStackTrace.SourceMetadataType.ApexTrigger.name(); - mockLogEntry.Timestamp__c = System.Datetime.now(); + mockLogEntry.Timestamp__c = System.now(); return mockLogEntry; } @@ -125,7 +125,7 @@ private class LogEntryMetadataViewerController_Tests { Body = 'Wow, look at this code for a mock version of apex class ' + mockApexClassName, Name = mockApexClassName ); - return (Schema.ApexClass) LoggerMockDataCreator.setReadOnlyField(mockApexClass, Schema.ApexClass.LastModifiedDate, System.Datetime.now().addDays(-7)); + return (Schema.ApexClass) LoggerMockDataCreator.setReadOnlyField(mockApexClass, Schema.ApexClass.LastModifiedDate, System.now().addDays(-7)); } private static Schema.ApexTrigger createMockApexTrigger(String mockApexTriggerName) { @@ -133,7 +133,7 @@ private class LogEntryMetadataViewerController_Tests { Body = 'Wow, look at this code for a mock version of apex trigger ' + mockApexTriggerName, Name = mockApexTriggerName ); - return (Schema.ApexTrigger) LoggerMockDataCreator.setReadOnlyField(mockApexTrigger, Schema.ApexTrigger.LastModifiedDate, System.Datetime.now().addDays(-7)); + return (Schema.ApexTrigger) LoggerMockDataCreator.setReadOnlyField(mockApexTrigger, Schema.ApexTrigger.LastModifiedDate, System.now().addDays(-7)); } // LogEntryMetadataViewerController uses a few queries via LogManagementDataSelector - this class mocks the query results diff --git a/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls b/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls index 880129509..4d35cc77d 100644 --- a/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls +++ b/nebula-logger/core/tests/log-management/classes/LogManagementDataSelector_Tests.cls @@ -144,7 +144,7 @@ private class LogManagementDataSelector_Tests { TransactionId__c = 'expectedLog.TransactionId__c' ); insert new List{ olderLog, expectedLog }; - System.Test.setCreatedDate(olderLog.Id, System.Datetime.now().addMinutes(-5)); + System.Test.setCreatedDate(olderLog.Id, System.now().addMinutes(-5)); System.Assert.areEqual(1, System.Limits.getQueries(), 'Expected 1 query to be used during test setup'); for (Integer i = 0; i < 3; i++) { diff --git a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls index 19ddb1854..ce6f9bb55 100644 --- a/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/ComponentLogger_Tests.cls @@ -507,7 +507,7 @@ private class ComponentLogger_Tests { componentLogEntry.originStackTrace = createMockComponentStackTrace(); componentLogEntry.recordId = currentUser.Id; componentLogEntry.record = currentUser; - componentLogEntry.timestamp = System.Datetime.now().addDays(-1 / 24); + componentLogEntry.timestamp = System.now().addDays(-1 / 24); componentLogEntry.tags = new List{ 'some tag', 'one more tag' }; return componentLogEntry; } diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls index 042c4f374..8ebfbac13 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowCollectionLogEntry_Tests.cls @@ -32,7 +32,7 @@ private class FlowCollectionLogEntry_Tests { FlowCollectionLogEntry flowCollectionEntry = createFlowCollectionLogEntry(); flowCollectionEntry.loggingLevelName = flowCollectionEntryLoggingLevel.name(); flowCollectionEntry.records = new List{ currentUser }; - flowCollectionEntry.timestamp = System.Datetime.now().addSeconds(-20); + flowCollectionEntry.timestamp = System.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -246,7 +246,7 @@ private class FlowCollectionLogEntry_Tests { flowCollectionEntry.saveLog = true; flowCollectionEntry.faultMessage = 'Exception message'; flowCollectionEntry.shouldThrowFaultMessageException = true; - flowCollectionEntry.timestamp = System.Datetime.now(); + flowCollectionEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls index 829630f67..05b9a27cf 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogEntry_Tests.cls @@ -25,7 +25,7 @@ private class FlowLogEntry_Tests { LoggerTestConfigurator.setupMockSObjectHandlerConfigurations(); FlowLogEntry flowEntry = createFlowLogEntry(); flowEntry.loggingLevelName = flowEntryLoggingLevel.name(); - flowEntry.timestamp = System.Datetime.now().addSeconds(-20); + flowEntry.timestamp = System.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -202,7 +202,7 @@ private class FlowLogEntry_Tests { flowEntry.saveLog = true; flowEntry.faultMessage = 'Exception message'; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls index 3912a82bb..6e0489e46 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowLogger_Tests.cls @@ -19,7 +19,7 @@ private class FlowLogger_Tests { flowEntry.message = 'hello from Flow'; flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = false; - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -63,7 +63,7 @@ private class FlowLogger_Tests { flowEntry.message = 'hello from Flow'; flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = true; - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -107,7 +107,7 @@ private class FlowLogger_Tests { flowEntry.loggingLevelName = entryLoggingLevel.name(); flowEntry.saveLog = true; flowEntry.saveMethodName = Logger.SaveMethod.QUEUEABLE.name(); - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -153,7 +153,7 @@ private class FlowLogger_Tests { flowEntry.saveLog = false; flowEntry.faultMessage = 'Exception message'; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -204,7 +204,7 @@ private class FlowLogger_Tests { flowEntry.saveLog = false; flowEntry.faultMessage = null; flowEntry.shouldThrowFaultMessageException = true; - flowEntry.timestamp = System.Datetime.now(); + flowEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls index 3a3c57556..4c43f7d46 100644 --- a/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/FlowRecordLogEntry_Tests.cls @@ -33,7 +33,7 @@ private class FlowRecordLogEntry_Tests { FlowRecordLogEntry flowRecordEntry = createFlowRecordLogEntry(); flowRecordEntry.loggingLevelName = flowRecordEntryLoggingLevel.name(); flowRecordEntry.record = currentUser; - flowRecordEntry.timestamp = System.Datetime.now().addSeconds(-20); + flowRecordEntry.timestamp = System.now().addSeconds(-20); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); @@ -243,7 +243,7 @@ private class FlowRecordLogEntry_Tests { flowRecordEntry.saveLog = true; flowRecordEntry.faultMessage = 'Exception message'; flowRecordEntry.shouldThrowFaultMessageException = true; - flowRecordEntry.timestamp = System.Datetime.now(); + flowRecordEntry.timestamp = System.now(); System.Assert.areEqual(0, Logger.saveLogCallCount); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishCallCount()); System.Assert.areEqual(0, LoggerMockDataStore.getEventBus().getPublishedPlatformEvents().size()); diff --git a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls index 29f763e72..680bc019c 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LoggerSObjectProxy_Tests.cls @@ -116,10 +116,10 @@ private class LoggerSObjectProxy_Tests { Map mockOmniProcessUntyped = new Map{ 'attributes' => new Map{ 'type' => 'OmniProcess' } }; mockOmniProcessUntyped.put(createdByIdFieldName, currentUser.Id); // mockOmniProcessUntyped.put(createdByFieldName, currentUser); - mockOmniProcessUntyped.put(createdDateFieldName, System.Datetime.now().addDays(-7)); + mockOmniProcessUntyped.put(createdDateFieldName, System.now().addDays(-7)); mockOmniProcessUntyped.put(lastModifiedByIdFieldName, currentUser.Id); // mockOmniProcessUntyped.put(lastModifiedByFieldName, currentUser); - mockOmniProcessUntyped.put(lastModifiedDateFieldName, System.Datetime.now().addDays(-1)); + mockOmniProcessUntyped.put(lastModifiedDateFieldName, System.now().addDays(-1)); mockOmniProcessUntyped.put(omniProcessTypeFieldName, 'Integration Procedure'); mockOmniProcessUntyped.put(uniqueFieldName, 'Mock_OmniScript_English_1'); SObject mockOmniProcessRecord = (SObject) System.JSON.deserialize(System.JSON.serialize(mockOmniProcessUntyped), SObject.class); 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 25b6cd462..45b55bf94 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -105,7 +105,7 @@ private class Logger_Tests { orgDefaults.Id = null; orgDefaults.LoggingLevel__c = System.LoggingLevel.WARN.name(); orgDefaults.SetupOwnerId = System.UserInfo.getOrganizationId(); - orgDefaults.StartTime__c = System.Datetime.now().addDays(1); + orgDefaults.StartTime__c = System.now().addDays(1); insert orgDefaults; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -124,7 +124,7 @@ private class Logger_Tests { orgDefaults.Id = null; orgDefaults.LoggingLevel__c = System.LoggingLevel.WARN.name(); orgDefaults.SetupOwnerId = System.UserInfo.getOrganizationId(); - orgDefaults.EndTime__c = System.Datetime.now().addDays(-1); + orgDefaults.EndTime__c = System.now().addDays(-1); insert orgDefaults; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -166,7 +166,7 @@ private class Logger_Tests { profileSettings.Id = null; profileSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); profileSettings.SetupOwnerId = System.UserInfo.getProfileId(); - profileSettings.StartTime__c = System.Datetime.now().addDays(1); + profileSettings.StartTime__c = System.now().addDays(1); insert profileSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -188,7 +188,7 @@ private class Logger_Tests { profileSettings.Id = null; profileSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); profileSettings.SetupOwnerId = System.UserInfo.getProfileId(); - profileSettings.EndTime__c = System.Datetime.now().addDays(-1); + profileSettings.EndTime__c = System.now().addDays(-1); insert profileSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -234,7 +234,7 @@ private class Logger_Tests { userSettings.Id = null; userSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); userSettings.SetupOwnerId = System.UserInfo.getUserId(); - userSettings.StartTime__c = System.Datetime.now().addDays(1); + userSettings.StartTime__c = System.now().addDays(1); insert userSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); @@ -257,7 +257,7 @@ private class Logger_Tests { userSettings.Id = null; userSettings.LoggingLevel__c = System.LoggingLevel.WARN.name(); userSettings.SetupOwnerId = System.UserInfo.getUserId(); - userSettings.EndTime__c = System.Datetime.now().addDays(-1); + userSettings.EndTime__c = System.now().addDays(-1); insert userSettings; LoggerSettings__c returnedSettings = Logger.getUserSettings(); diff --git a/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls b/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls index 7b186cf11..9a6ca83c9 100644 --- a/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls +++ b/nebula-logger/extra-tests/tests/LoggerCache_Tests_PlatformCache.cls @@ -25,7 +25,7 @@ private class LoggerCache_Tests_PlatformCache { // Run the different Cacheable methods to ensure everything works String testKey = 'someKey'; - Object testValue = System.Datetime.now(); + Object testValue = System.now(); System.Assert.isNotNull(organizationCache); System.Assert.isFalse(organizationCache.contains(testKey)); System.Assert.areEqual( @@ -74,7 +74,7 @@ private class LoggerCache_Tests_PlatformCache { // Run the different Cacheable methods to ensure everything works String testKey = 'someKey'; - Object testValue = System.Datetime.now(); + Object testValue = System.now(); System.Assert.isNotNull(sessionCache); System.Assert.isFalse(sessionCache.contains(testKey)); System.Assert.areEqual( 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 e62ea4120..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 @@ -20,7 +20,7 @@ private class LogFlowExecutionErrorEventHandler_Tests { static void it_logs_when_enabled() { setLoggerParamEnabled(true); Schema.FlowExecutionErrorEvent flowExecutionErrorEvent = new Schema.FlowExecutionErrorEvent(); - flowExecutionErrorEvent.EventDate = System.Datetime.now().addSeconds(-5); + flowExecutionErrorEvent.EventDate = System.now().addSeconds(-5); flowExecutionErrorEvent.ElementApiName = 'test_exception_element'; flowExecutionErrorEvent.FlowApiName = 'Testing_FlowExecutionErrorEvent'; flowExecutionErrorEvent.FlowVersionNumber = 1; diff --git a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls index 8fe1f98d4..328f82db8 100644 --- a/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls +++ b/nebula-logger/plugins/big-object-archiving/plugin/classes/LogEntryArchiveBuilder.cls @@ -50,7 +50,7 @@ public without sharing class LogEntryArchiveBuilder { this.logEntryArchive = new LogEntryArchive__b( ApiVersion__c = this.logEntryEvent.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), - ArchivedDate__c = System.Datetime.now(), + ArchivedDate__c = System.now(), ArchivedByUsername__c = System.UserInfo.getUsername(), ComponentType__c = this.logEntryEvent.ComponentType__c, DatabaseResultCollectionSize__c = this.logEntryEvent.DatabaseResultCollectionSize__c, @@ -179,7 +179,7 @@ public without sharing class LogEntryArchiveBuilder { ApiReleaseVersion__c = this.logEntry.Log__r.ApiReleaseVersion__c, ApiVersion__c = this.logEntry.Log__r.ApiVersion__c, ArchivedById__c = System.UserInfo.getUserId(), - ArchivedDate__c = System.Datetime.now(), + ArchivedDate__c = System.now(), ArchivedByUsername__c = System.UserInfo.getUsername(), ClosedById__c = this.logEntry.Log__r.ClosedBy__c, ClosedByUsername__c = this.logEntry.Log__r.ClosedBy__r.Username, diff --git a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls index 3b095694e..814b5cced 100644 --- a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls +++ b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionFilter_Tests.cls @@ -9,7 +9,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_equal_to() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_equal_to'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -32,7 +32,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_not_equal_to() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_not_equal_to'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -55,7 +55,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_less_than() { Integer numberOfDaysToRetainLogs = 90; - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_less_than'); rule.NumberOfDaysToRetainLogs__c = numberOfDaysToRetainLogs; List conditions = new List{ @@ -77,7 +77,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_less_than_or_equal_to() { - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_less_than_or_equal_to'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'LESS_THAN_OR_EQUAL_TO', 'Value', mockTimestamp) @@ -98,7 +98,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_greater_than() { - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_greater_than'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'GREATER_THAN', 'Value', mockTimestamp) @@ -119,7 +119,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_match_one_condition_on_datetime_greater_than_or_equal_to() { - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_greater_than_or_equal_to'); List conditions = new List{ createMockRuleCondition('Timestamp__c', 'GREATER_THAN_OR_EQUAL_TO', 'Value', mockTimestamp) @@ -141,7 +141,7 @@ private class LogRetentionFilter_Tests { @IsTest static void it_should_throw_illegal_argument_exception_on_datetime_when_invalid_operator() { String invalidOperator = 'THIS_IS_AN_INVALID_OPERATOR'; - Datetime mockTimestamp = System.Datetime.now(); + Datetime mockTimestamp = System.now(); LogRetentionRule__mdt rule = createMockRule('number_with_invalid_operator'); List conditions = new List{ createMockRuleCondition('Timestamp__c', invalidOperator, 'Value', mockTimestamp) diff --git a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls index aef136da7..00d782d8f 100644 --- a/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls +++ b/nebula-logger/plugins/log-retention-rules/plugin/classes/LogRetentionRulesPlugin.cls @@ -69,7 +69,7 @@ public without sharing class LogRetentionRulesPlugin implements LoggerPlugin.Tri } Integer numberOfDaysToRetainLogs = Integer.valueOf(filterResult.getRule().NumberOfDaysToRetainLogs__c); - log.LogRetentionDate__c = numberOfDaysToRetainLogs == null ? null : System.Date.today().addDays(numberOfDaysToRetainLogs); + log.LogRetentionDate__c = numberOfDaysToRetainLogs == null ? null : System.today().addDays(numberOfDaysToRetainLogs); logIdToLog.put(log.Id, log); } diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls index 95f95fe20..50a596e76 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin.cls @@ -108,7 +108,7 @@ public without sharing class SlackLoggerPlugin implements LoggerPlugin.Triggerab Logger.finest('Sent log entries to Slack endpoint').setHttpResponseDetails(response); } - log.SlackNotificationDate__c = System.Datetime.now(); + log.SlackNotificationDate__c = System.now(); sentLogs.add(log); } Logger.saveLog(); diff --git a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls index c7b7056ae..c28694aaf 100644 --- a/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls +++ b/nebula-logger/plugins/slack/plugin/slack/classes/SlackLoggerPlugin_Tests.cls @@ -224,7 +224,7 @@ private class SlackLoggerPlugin_Tests { LoggingLevel__c = logEntryLoggingLevel.name(), LoggingLevelOrdinal__c = logEntryLoggingLevel.ordinal(), StackTrace__c = 'A stack trace', - Timestamp__c = System.Datetime.now() + Timestamp__c = System.now() ); insert logEntry; return queryLogs(logEntryLoggingLevel); From 1f462c14aa2cfeb3bdb08166910363b536d9a169 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 09:42:46 -0500 Subject: [PATCH 12/15] Fixed some test failures in Logger_Tests caused by LogEntryHandler trying to split & parse an Apex source snippet of Logger_Tests I've "fixed" it by ignoring Logger_Tests as an origin using Logger.ignoreOrigin(), which avoids the source snippet code from running in LogEntryHandler --- .../logger-engine/classes/Logger_Tests.cls | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) 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 45b55bf94..a0c008a55 100644 --- a/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/Logger_Tests.cls @@ -1423,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]; @@ -1493,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); @@ -1524,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); @@ -1551,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); @@ -1581,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); @@ -1614,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); @@ -1643,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); From 367b0139e098b20827ac98e279d635b3db5f3b91 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 10:43:10 -0500 Subject: [PATCH 13/15] Fixed & suppressed some existing PMD scan violations --- .../core/main/log-management/classes/LogBatchPurger.cls | 1 + .../main/logger-engine/classes/LoggerEngineDataSelector.cls | 1 + .../tests/log-management/classes/LogEntryEventHandler_Tests.cls | 2 +- nebula-logger/extra-tests/classes/NebulaLogger_E2E_Tests.cls | 2 +- .../plugin/classes/LogBatchApexErrorEventHandler_Tests.cls | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) 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/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/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/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]; } } From 7741ed29ba182a5737cf563aa925efb0a1f1a79e Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 11:35:13 -0500 Subject: [PATCH 14/15] Added some additional tests in LogEntryEventBuilder_Tests for Database.EmptyRecycleBinResult --- .../classes/LogEntryEventBuilder_Tests.cls | 82 +++++++++++++------ 1 file changed, 56 insertions(+), 26 deletions(-) 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 761958be9..f483dfb51 100644 --- a/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls +++ b/nebula-logger/core/tests/logger-engine/classes/LogEntryEventBuilder_Tests.cls @@ -653,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 @@ -753,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 From 09cafe6bdcf23da594fb7fd54a12c6210348ca14 Mon Sep 17 00:00:00 2001 From: Jonathan Gillespie Date: Wed, 18 Dec 2024 11:57:56 -0500 Subject: [PATCH 15/15] [skip ci] Manually created new core unlocked package version --- README.md | 6 +++--- sfdx-project.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 82168edd4..68ada9a70 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,11 @@ The most robust observability solution for Salesforce experts. Built 100% native ## 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/sfdx-project.json b/sfdx-project.json index 6f0a0f016..4f32927d4 100644 --- a/sfdx-project.json +++ b/sfdx-project.json @@ -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",