This commit is contained in:
Daniel Ballinger 2026-03-25 14:34:32 +13:00
parent a4f2dcbb37
commit aef6597b91
22 changed files with 168 additions and 168 deletions

View File

@ -1,5 +1,5 @@
/**
* @description Test class for {{ClassName}}
* Test class for {{ClassName}}
* Tests core functionality with positive, negative, and bulk scenarios.
* @author {{Author}}
* @created {{Date}}
@ -25,7 +25,7 @@ private class {{ClassName}}Test {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests successful {{methodUnderTest}} with valid input
* Tests successful {{methodUnderTest}} with valid input
*/
@IsTest
static void test{{MethodUnderTest}}_ValidInput_Success() {
@ -55,7 +55,7 @@ private class {{ClassName}}Test {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests {{methodUnderTest}} throws exception with null input
* Tests {{methodUnderTest}} throws exception with null input
*/
@IsTest
static void test{{MethodUnderTest}}_NullInput_ThrowsException() {
@ -82,7 +82,7 @@ private class {{ClassName}}Test {
}
/**
* @description Tests {{methodUnderTest}} handles invalid data gracefully
* Tests {{methodUnderTest}} handles invalid data gracefully
*/
@IsTest
static void test{{MethodUnderTest}}_InvalidData_ReturnsError() {
@ -111,7 +111,7 @@ private class {{ClassName}}Test {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests {{methodUnderTest}} handles bulk operations (251 records)
* Tests {{methodUnderTest}} handles bulk operations (251 records)
* 251 records crosses the 200-record trigger batch boundary
*/
@IsTest
@ -146,7 +146,7 @@ private class {{ClassName}}Test {
// ═══════════════════════════════════════════════────────────────────────────
/**
* @description Tests {{methodUnderTest}} with empty list input
* Tests {{methodUnderTest}} with empty list input
*/
@IsTest
static void test{{MethodUnderTest}}_EmptyList_NoError() {

View File

@ -1,5 +1,5 @@
/**
* @description Bulk testing template for trigger and service validation
* Bulk testing template for trigger and service validation
* Tests with 251+ records to ensure bulkification compliance.
* 251 records crosses the 200-record trigger batch boundary.
* @author {{Author}}
@ -18,7 +18,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests bulk insert with 251 records
* Tests bulk insert with 251 records
* Verifies trigger handles multiple batch chunks correctly
*/
@IsTest
@ -52,7 +52,7 @@ private class {{ClassName}}BulkTest {
}
/**
* @description Tests bulk insert at exact batch boundary (200 records)
* Tests bulk insert at exact batch boundary (200 records)
*/
@IsTest
static void testBulkInsert_ExactBatchSize_AllProcessed() {
@ -76,7 +76,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests bulk update with 251 records
* Tests bulk update with 251 records
* Verifies update triggers handle multiple batches
*/
@IsTest
@ -114,7 +114,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests bulk delete with 251 records
* Tests bulk delete with 251 records
* Verifies delete triggers handle cleanup correctly
*/
@IsTest
@ -148,7 +148,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests mixed operations in bulk
* Tests mixed operations in bulk
* Verifies partial success scenarios are handled
*/
@IsTest
@ -195,7 +195,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Helper method to verify governor limits not exceeded
* Helper method to verify governor limits not exceeded
* Call after Test.stopTest() to check limit usage
*/
private static void assertGovernorLimitsNotExceeded() {
@ -234,7 +234,7 @@ private class {{ClassName}}BulkTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Stress test with 501 records (multiple batch boundaries)
* Stress test with 501 records (multiple batch boundaries)
* Use sparingly - consumes significant test execution time
*/
@IsTest

View File

@ -1,5 +1,5 @@
/**
* @description Test class for external API callouts using mock framework
* Test class for external API callouts using mock framework
* Demonstrates HttpCalloutMock and WebServiceMock patterns.
* @author {{Author}}
* @created {{Date}}
@ -12,7 +12,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Mock for successful HTTP response (200 OK)
* Mock for successful HTTP response (200 OK)
*/
private class SuccessMock implements HttpCalloutMock {
public HttpResponse respond(HttpRequest req) {
@ -33,7 +33,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Mock for error HTTP response (500 Internal Server Error)
* Mock for error HTTP response (500 Internal Server Error)
*/
private class ErrorMock implements HttpCalloutMock {
private Integer statusCode;
@ -58,7 +58,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Mock for timeout simulation
* Mock for timeout simulation
*/
private class TimeoutMock implements HttpCalloutMock {
public HttpResponse respond(HttpRequest req) {
@ -68,7 +68,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Mock that validates request parameters
* Mock that validates request parameters
*/
private class ValidatingMock implements HttpCalloutMock {
private String expectedEndpoint;
@ -97,7 +97,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests successful API call returns expected data
* Tests successful API call returns expected data
*/
@IsTest
static void testCallout_Success_ReturnsData() {
@ -123,7 +123,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests POST request with body
* Tests POST request with body
*/
@IsTest
static void testCallout_PostWithBody_Success() {
@ -154,7 +154,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests handling of 400 Bad Request
* Tests handling of 400 Bad Request
*/
@IsTest
static void testCallout_BadRequest_HandlesGracefully() {
@ -178,7 +178,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests handling of 500 Internal Server Error
* Tests handling of 500 Internal Server Error
*/
@IsTest
static void testCallout_ServerError_HandlesGracefully() {
@ -198,7 +198,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests handling of timeout exception
* Tests handling of timeout exception
*/
@IsTest
static void testCallout_Timeout_ThrowsException() {
@ -221,7 +221,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests handling of 401 Unauthorized
* Tests handling of 401 Unauthorized
*/
@IsTest
static void testCallout_Unauthorized_HandlesGracefully() {
@ -245,7 +245,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Verifies correct endpoint and method are used
* Verifies correct endpoint and method are used
*/
@IsTest
static void testCallout_ValidatesRequestParameters() {
@ -270,7 +270,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Tests @future method with callout
* Tests @future method with callout
* Note: Must use Test.startTest/stopTest to execute @future
*/
@IsTest
@ -289,7 +289,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests Queueable with callout
* Tests Queueable with callout
*/
@IsTest
static void testQueueableCallout_ExecutesSuccessfully() {
@ -311,7 +311,7 @@ private class {{ClassName}}CalloutTest {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Mock for multiple sequential callouts
* Mock for multiple sequential callouts
*/
private class MultiCalloutMock implements HttpCalloutMock {
private Integer callCount = 0;
@ -326,7 +326,7 @@ private class {{ClassName}}CalloutTest {
}
/**
* @description Tests multiple callouts in sequence (limit: 100 per transaction)
* Tests multiple callouts in sequence (limit: 100 per transaction)
*/
@IsTest
static void testMultipleCallouts_AllSucceed() {

View File

@ -1,5 +1,5 @@
/**
* @description Test Data Factory for creating consistent test data across all test classes.
* Test Data Factory for creating consistent test data across all test classes.
* Use this pattern to avoid hardcoded test data and ensure test isolation.
*
* USAGE:
@ -20,7 +20,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates Account records without inserting
* Creates Account records without inserting
* @param count Number of accounts to create
* @return List of Account records (not inserted)
*/
@ -43,7 +43,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts Account records
* Creates and inserts Account records
* @param count Number of accounts to create
* @return List of inserted Account records
*/
@ -54,7 +54,7 @@ public class TestDataFactory {
}
/**
* @description Creates Account with specific attributes
* Creates Account with specific attributes
* @param name Account name
* @param industry Industry value
* @return Account record (not inserted)
@ -74,7 +74,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates Contact records without inserting
* Creates Contact records without inserting
* @param count Number of contacts to create
* @param accountId Parent account ID
* @return List of Contact records (not inserted)
@ -100,7 +100,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts Contact records
* Creates and inserts Contact records
* @param count Number of contacts to create
* @param accountId Parent account ID
* @return List of inserted Contact records
@ -116,7 +116,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates Lead records without inserting
* Creates Lead records without inserting
* @param count Number of leads to create
* @return List of Lead records (not inserted)
*/
@ -138,7 +138,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts Lead records
* Creates and inserts Lead records
* @param count Number of leads to create
* @return List of inserted Lead records
*/
@ -153,7 +153,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates Opportunity records without inserting
* Creates Opportunity records without inserting
* @param count Number of opportunities to create
* @param accountId Parent account ID
* @return List of Opportunity records (not inserted)
@ -173,7 +173,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts Opportunity records
* Creates and inserts Opportunity records
* @param count Number of opportunities to create
* @param accountId Parent account ID
* @return List of inserted Opportunity records
@ -189,7 +189,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates Case records without inserting
* Creates Case records without inserting
* @param count Number of cases to create
* @param accountId Parent account ID (optional)
* @param contactId Related contact ID (optional)
@ -212,7 +212,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts Case records
* Creates and inserts Case records
* @param count Number of cases to create
* @param accountId Parent account ID (optional)
* @param contactId Related contact ID (optional)
@ -229,7 +229,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Creates a test User with specified profile
* Creates a test User with specified profile
* Use with System.runAs() for permission testing
* @param profileName Name of the profile to assign
* @param uniqueIdentifier Unique string to avoid duplicate usernames
@ -256,7 +256,7 @@ public class TestDataFactory {
}
/**
* @description Creates and inserts a test User
* Creates and inserts a test User
* @param profileName Name of the profile to assign
* @param uniqueIdentifier Unique string to avoid duplicate usernames
* @return Inserted User record
@ -272,7 +272,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Template for custom object creation
* Template for custom object creation
* Copy and modify for your custom objects
* @param count Number of records to create
* @return List of custom object records (not inserted)
@ -302,7 +302,7 @@ public class TestDataFactory {
// ═══════════════════════════════════════════════════════════════════════════
/**
* @description Generates a unique string for test data
* Generates a unique string for test data
* Useful for avoiding unique constraint violations
* @return Unique string based on timestamp
*/
@ -312,7 +312,7 @@ public class TestDataFactory {
}
/**
* @description Creates a map of records by a specified field
* Creates a map of records by a specified field
* Useful for test assertions
* @param records List of SObjects
* @param fieldName API name of the field to use as key

View File

@ -1,8 +1,8 @@
/**
* @description Batch Apex class for identifying and flagging duplicate Account records.
* Compares Accounts by Name and BillingPostalCode to find potential duplicates.
* Flags duplicates by setting the Is_Potential_Duplicate__c checkbox.
* Implements Database.Stateful to track results across batch chunks.
* Batch Apex class for identifying and flagging duplicate Account records.
* Compares Accounts by Name and BillingPostalCode to find potential duplicates.
* Flags duplicates by setting the Is_Potential_Duplicate__c checkbox.
* Implements Database.Stateful to track results across batch chunks.
* @author Generated by Apex Class Writer Skill
*
* @example
@ -26,7 +26,7 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
// ─── Batchable Interface ─────────────────────────────────────────────
/**
* @description Queries all active Accounts that haven't already been flagged
* Queries all active Accounts that haven't already been flagged
* @param bc The batch context
* @return QueryLocator scoped to unflagged active Accounts
*/
@ -42,8 +42,8 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
}
/**
* @description Processes each batch by building a duplicate key and checking for matches.
* Uses a composite key of normalized Name + BillingPostalCode.
* Processes each batch by building a duplicate key and checking for matches.
* Uses a composite key of normalized Name + BillingPostalCode.
* @param bc The batch context
* @param scope List of Account records in the current batch
*/
@ -83,7 +83,7 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
}
/**
* @description Logs a summary of the deduplication batch run
* Logs a summary of the deduplication batch run
* @param bc The batch context
*/
public void finish(Database.BatchableContext bc) {
@ -102,7 +102,7 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
// ─── Private Helpers ─────────────────────────────────────────────────
/**
* @description Builds a normalized composite key for duplicate detection
* Builds a normalized composite key for duplicate detection
* @param account The Account record
* @return Normalized key string, or null if insufficient data
*/
@ -118,7 +118,7 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
}
/**
* @description Processes DML results, tracking successes and failures
* Processes DML results, tracking successes and failures
* @param results List of Database.SaveResult from update operation
*/
private void processResults(List<Database.SaveResult> results) {
@ -140,7 +140,7 @@ public with sharing class AccountDeduplicationBatch implements Database.Batchabl
// ─── Static Helpers ──────────────────────────────────────────────────
/**
* @description Convenience method to execute with default batch size
* Convenience method to execute with default batch size
* @return The batch job Id
*/
public static Id run() {

View File

@ -1,7 +1,7 @@
/**
* @description Selector class for Account queries.
* Encapsulates all SOQL for Account records.
* All methods return bulkified results (Lists or Maps).
* Selector class for Account queries.
* Encapsulates all SOQL for Account records.
* All methods return bulkified results (Lists or Maps).
* @author Generated by Apex Class Writer Skill
*/
public inherited sharing class AccountSelector {
@ -9,7 +9,7 @@ public inherited sharing class AccountSelector {
// ─── Field Lists ─────────────────────────────────────────────────────
/**
* @description Returns the default set of fields to query for Account.
* Returns the default set of fields to query for Account.
* Centralizes field references to keep queries DRY.
* @return Comma-separated field list as a String
*/
@ -34,7 +34,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Returns fields needed for billing/territory operations
* Returns fields needed for billing/territory operations
* @return Comma-separated field list as a String
*/
private static String getBillingFields() {
@ -56,7 +56,7 @@ public inherited sharing class AccountSelector {
// ─── Query Methods ───────────────────────────────────────────────────
/**
* @description Selects Account records by their Ids
* Selects Account records by their Ids
* @param recordIds Set of Account Ids to query
* @return List of Account records matching the provided Ids
* @example
@ -77,7 +77,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Selects Account records as a Map keyed by Id
* Selects Account records as a Map keyed by Id
* @param recordIds Set of Account Ids to query
* @return Map of Id to Account
*/
@ -86,7 +86,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Selects Accounts with billing address fields for territory assignment
* Selects Accounts with billing address fields for territory assignment
* @param recordIds Set of Account Ids to query
* @return List of Account records with billing address fields populated
*/
@ -104,7 +104,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Selects Accounts by Account Type
* Selects Accounts by Account Type
* @param accountTypes Set of Account Type values to filter by
* @return List of matching Account records
* @example
@ -127,7 +127,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Selects Accounts by Industry with a minimum annual revenue
* Selects Accounts by Industry with a minimum annual revenue
* @param industries Set of Industry values to filter by
* @param minRevenue Minimum AnnualRevenue threshold
* @return List of matching Account records ordered by revenue descending
@ -155,7 +155,7 @@ public inherited sharing class AccountSelector {
}
/**
* @description Selects Accounts with their related Contacts (subquery)
* Selects Accounts with their related Contacts (subquery)
* @param recordIds Set of Account Ids to query
* @return List of Account records with nested Contacts
*/
@ -178,7 +178,7 @@ public inherited sharing class AccountSelector {
// ─── Aggregate Queries ───────────────────────────────────────────────
/**
* @description Returns a count of Accounts grouped by Industry
* Returns a count of Accounts grouped by Industry
* @return List of AggregateResult with Industry and record count
* @example
* List<AggregateResult> results = AccountSelector.countByIndustry();

View File

@ -1,7 +1,7 @@
/**
* @description Service class for Account business logic.
* Provides account deduplication, enrichment, and territory assignment.
* Delegates queries to AccountSelector and SObject manipulation to AccountDomain.
* Service class for Account business logic.
* Provides account deduplication, enrichment, and territory assignment.
* Delegates queries to AccountSelector and SObject manipulation to AccountDomain.
* @author Generated by Apex Class Writer Skill
*/
public with sharing class AccountService {
@ -14,8 +14,8 @@ public with sharing class AccountService {
// ─── Public API ──────────────────────────────────────────────────────
/**
* @description Merges duplicate Account records into a master record.
* The master record retains its field values; child records are reparented.
* Merges duplicate Account records into a master record.
* The master record retains its field values; child records are reparented.
* @param masterIds Map of master Account Id to Set of duplicate Account Ids to merge
* @return List of master Account Ids that were successfully merged
* @throws AccountServiceException if merge processing fails
@ -77,8 +77,8 @@ public with sharing class AccountService {
}
/**
* @description Assigns accounts to territories based on Billing State/Country.
* Uses Custom Metadata Type (Territory_Mapping__mdt) for mappings.
* Assigns accounts to territories based on Billing State/Country.
* Uses Custom Metadata Type (Territory_Mapping__mdt) for mappings.
* @param accountIds Set of Account Ids to assign territories for
* @return Number of accounts successfully updated
* @throws AccountServiceException if territory assignment fails
@ -115,7 +115,7 @@ public with sharing class AccountService {
// ─── Convenience Overloads ───────────────────────────────────────────
/**
* @description Single-account territory assignment convenience method
* Single-account territory assignment convenience method
* @param accountId The Account Id to assign a territory for
* @return 1 if updated, 0 if no change needed
*/
@ -126,7 +126,7 @@ public with sharing class AccountService {
// ─── Private Helpers ─────────────────────────────────────────────────
/**
* @description Loads territory mappings from Custom Metadata
* Loads territory mappings from Custom Metadata
* @return Map of territory key (State:Country) to territory name
*/
private static Map<String, String> loadTerritoryMappings() {
@ -139,7 +139,7 @@ public with sharing class AccountService {
}
/**
* @description Builds a consistent territory lookup key
* Builds a consistent territory lookup key
* @param state The billing state
* @param country The billing country
* @return A normalized key string
@ -149,7 +149,7 @@ public with sharing class AccountService {
}
/**
* @description Chunks a list of Accounts into sublists of the given size
* Chunks a list of Accounts into sublists of the given size
* @param accounts The accounts to chunk
* @param chunkSize Maximum chunk size
* @return List of account sublists
@ -172,7 +172,7 @@ public with sharing class AccountService {
}
/**
* @description Counts successful results from a DML operation
* Counts successful results from a DML operation
* @param results List of Database.SaveResult
* @return Count of successful operations
*/
@ -195,7 +195,7 @@ public with sharing class AccountService {
// ─── Exception ───────────────────────────────────────────────────────
/**
* @description Custom exception for AccountService errors
* Custom exception for AccountService errors
*/
public class AccountServiceException extends Exception {}
}

View File

@ -1,7 +1,7 @@
/**
* @description Abstract base class for {describe the family of classes this serves}.
* Provides common behavior and defines extension points for subclasses.
* Subclasses must implement the abstract methods to provide specific behavior.
* Abstract base class for {describe the family of classes this serves}.
* Provides common behavior and defines extension points for subclasses.
* Subclasses must implement the abstract methods to provide specific behavior.
* @author {Author}
*
* @example
@ -29,7 +29,7 @@ public abstract with sharing class {ClassName} {
// ─── Constructor ─────────────────────────────────────────────────────
/**
* @description Initializes the base class with default configuration
* Initializes the base class with default configuration
*/
protected {ClassName}() {
this.timeoutMs = DEFAULT_TIMEOUT_MS;
@ -38,14 +38,14 @@ public abstract with sharing class {ClassName} {
// ─── Abstract Methods (must be implemented by subclasses) ────────────
/**
* @description Returns the endpoint URL for this integration.
* Returns the endpoint URL for this integration.
* Subclasses must provide their specific endpoint.
* @return The endpoint URL as a String
*/
protected abstract String getEndpoint();
/**
* @description Returns the HTTP headers for this integration.
* Returns the HTTP headers for this integration.
* Subclasses define their own required headers.
* @return Map of header name to header value
*/
@ -54,7 +54,7 @@ public abstract with sharing class {ClassName} {
// ─── Virtual Methods (can be overridden by subclasses) ───────────────
/**
* @description Hook called before the main operation executes.
* Hook called before the main operation executes.
* Override to add pre-processing logic.
* Default implementation does nothing.
* @param context Map of contextual data
@ -64,7 +64,7 @@ public abstract with sharing class {ClassName} {
}
/**
* @description Hook called after the main operation completes.
* Hook called after the main operation completes.
* Override to add post-processing logic.
* Default implementation does nothing.
* @param context Map of contextual data
@ -77,7 +77,7 @@ public abstract with sharing class {ClassName} {
// ─── Template Method (common workflow) ───────────────────────────────
/**
* @description Executes the operation using the template method pattern.
* Executes the operation using the template method pattern.
* Calls beforeExecute doExecute afterExecute in sequence.
* @param context Map of data needed for the operation
* @return The result of the operation
@ -100,7 +100,7 @@ public abstract with sharing class {ClassName} {
// ─── Protected Helpers ───────────────────────────────────────────────
/**
* @description Core execution logic override this for the main operation.
* Core execution logic override this for the main operation.
* Default implementation throws subclass must provide implementation.
* @param context Map of data needed for the operation
* @return The result of the operation
@ -112,7 +112,7 @@ public abstract with sharing class {ClassName} {
}
/**
* @description Error handler called when doExecute throws.
* Error handler called when doExecute throws.
* Override to customize error handling (e.g., logging, retry).
* @param e The exception that was thrown
*/

View File

@ -1,7 +1,7 @@
/**
* @description Controller for {ComponentName} Lightning Web Component.
* Exposes server-side operations to LWC via @AuraEnabled methods.
* All queries use WITH USER_MODE for CRUD/FLS enforcement.
* Controller for {ComponentName} Lightning Web Component.
* Exposes server-side operations to LWC via @AuraEnabled methods.
* All queries use WITH USER_MODE for CRUD/FLS enforcement.
* @author {Author}
*/
public with sharing class {ClassName}Controller {
@ -9,7 +9,7 @@ public with sharing class {ClassName}Controller {
// ─── Read Operations (cacheable) ─────────────────────────────────────
/**
* @description Retrieves {SObject} records for the given parent Id.
* Retrieves {SObject} records for the given parent Id.
* Cacheable for LDS/wire adapter performance.
* @param parentId The parent record Id to filter by
* @return List of {SObject} records
@ -32,7 +32,7 @@ public with sharing class {ClassName}Controller {
// ─── Write Operations (non-cacheable) ────────────────────────────────
/**
* @description Creates or updates a {SObject} record.
* Creates or updates a {SObject} record.
* Cannot use cacheable=true because this performs DML.
* @param record The {SObject} record to save
* @return The saved record Id
@ -52,7 +52,7 @@ public with sharing class {ClassName}Controller {
}
/**
* @description Deletes a {SObject} record by Id.
* Deletes a {SObject} record by Id.
* @param recordId The Id of the record to delete
*/
@AuraEnabled
@ -71,7 +71,7 @@ public with sharing class {ClassName}Controller {
// ─── Action Operations ───────────────────────────────────────────────
/**
* @description Processes a {SObject} record and returns a result map.
* Processes a {SObject} record and returns a result map.
* Use for imperative calls from LWC that need structured responses.
* @param recordId The Id of the record to process
* @return Map with isSuccess (Boolean), message (String), and optional data

View File

@ -1,7 +1,7 @@
/**
* @description Batch Apex class for {describe the batch operation}.
* Processes {SObject} records in configurable batch sizes.
* Implements Database.Stateful to track cumulative results across chunks.
* Batch Apex class for {describe the batch operation}.
* Processes {SObject} records in configurable batch sizes.
* Implements Database.Stateful to track cumulative results across chunks.
* @author {Author}
*
* @example
@ -24,7 +24,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
// ─── Constructor ─────────────────────────────────────────────────────
/**
* @description Default constructor
* Default constructor
*/
public {ClassName}() {
// Default configuration
@ -33,7 +33,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
// ─── Batchable Interface ─────────────────────────────────────────────
/**
* @description Defines the scope of records to process.
* Defines the scope of records to process.
* Uses Database.QueryLocator for efficient large-dataset processing.
* @param bc The batch context
* @return QueryLocator for the records to process
@ -49,7 +49,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
}
/**
* @description Processes each batch of records.
* Processes each batch of records.
* Uses Database.update with allOrNone=false for partial success handling.
* @param bc The batch context
* @param scope List of {SObject} records in the current batch
@ -69,7 +69,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
}
/**
* @description Performs post-processing after all batches complete.
* Performs post-processing after all batches complete.
* Logs a summary of the batch execution.
* @param bc The batch context
*/
@ -95,7 +95,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
// ─── Private Helpers ─────────────────────────────────────────────────
/**
* @description Processes Database.SaveResult list, tracking successes and failures
* Processes Database.SaveResult list, tracking successes and failures
* @param results List of SaveResult from a DML operation
*/
private void processResults(List<Database.SaveResult> results) {
@ -117,7 +117,7 @@ public with sharing class {ClassName} implements Database.Batchable<SObject>, Da
// ─── Static Helpers ──────────────────────────────────────────────────
/**
* @description Convenience method to execute with default batch size
* Convenience method to execute with default batch size
* @return The batch job Id
*/
public static Id run() {

View File

@ -1,5 +1,5 @@
/**
* @description Domain class for {SObject}.
* Domain class for {SObject}.
* Encapsulates field-level defaults, derivations, and validations.
* Operates only on in-memory SObject data no SOQL or DML.
* @author {Author}
@ -12,7 +12,7 @@ public with sharing class {SObject}Domain {
// ─── Field Defaults ──────────────────────────────────────────────────
/**
* @description Applies default field values to new {SObject} records.
* Applies default field values to new {SObject} records.
* Call this before insert to ensure consistent defaults.
* @param records List of {SObject} records to apply defaults to
*/
@ -33,7 +33,7 @@ public with sharing class {SObject}Domain {
// ─── Derivations ────────────────────────────────────────────────────
/**
* @description Derives calculated field values based on other fields.
* Derives calculated field values based on other fields.
* Call this before insert and before update.
* @param records List of {SObject} records to derive values for
*/
@ -52,7 +52,7 @@ public with sharing class {SObject}Domain {
// ─── Validations ────────────────────────────────────────────────────
/**
* @description Validates {SObject} records and adds errors for any violations.
* Validates {SObject} records and adds errors for any violations.
* Call this before insert and before update.
* @param records List of {SObject} records to validate
*/
@ -73,7 +73,7 @@ public with sharing class {SObject}Domain {
// ─── Comparisons ────────────────────────────────────────────────────
/**
* @description Determines which fields have changed between old and new record versions.
* Determines which fields have changed between old and new record versions.
* Useful in before update context.
* @param oldRecord The previous version of the record
* @param newRecord The current version of the record

View File

@ -1,5 +1,5 @@
/**
* @description Data Transfer Object for {describe the data this DTO represents}.
* Data Transfer Object for {describe the data this DTO represents}.
* Used to pass structured data between layers without exposing SObjects.
* Serialization-friendly for use with JSON.serialize/deserialize and API responses.
* @author {Author}
@ -15,16 +15,16 @@ public class {ClassName} {
// ─── Properties ──────────────────────────────────────────────────────
/** @description {Describe this property} */
/** {Describe this property} */
public String name { get; set; }
/** @description {Describe this property} */
/** {Describe this property} */
public Id recordId { get; set; }
/** @description {Describe this property} */
/** {Describe this property} */
public Boolean isActive { get; set; }
/** @description {Describe this property} */
/** {Describe this property} */
public List<String> tags { get; set; }
// TODO: Add additional properties as needed
@ -32,7 +32,7 @@ public class {ClassName} {
// ─── Constructors ────────────────────────────────────────────────────
/**
* @description No-arg constructor for deserialization compatibility
* No-arg constructor for deserialization compatibility
*/
public {ClassName}() {
this.tags = new List<String>();
@ -40,7 +40,7 @@ public class {ClassName} {
}
/**
* @description Parameterized constructor for convenience
* Parameterized constructor for convenience
* @param name The name value
* @param recordId The associated record Id
*/
@ -53,7 +53,7 @@ public class {ClassName} {
// ─── Factory Methods ─────────────────────────────────────────────────
/**
* @description Creates a DTO instance from an SObject record
* Creates a DTO instance from an SObject record
* @param record The source {SObject} record
* @return A populated {ClassName} instance
*/
@ -71,7 +71,7 @@ public class {ClassName} {
}
/**
* @description Creates a list of DTOs from a list of SObject records
* Creates a list of DTOs from a list of SObject records
* @param records The source records
* @return List of populated {ClassName} instances
*/
@ -90,7 +90,7 @@ public class {ClassName} {
// ─── Utility Methods ─────────────────────────────────────────────────
/**
* @description Serializes this DTO to a JSON string
* Serializes this DTO to a JSON string
* @return JSON representation of this DTO
*/
public String toJson() {
@ -98,7 +98,7 @@ public class {ClassName} {
}
/**
* @description Deserializes a JSON string into a {ClassName} instance
* Deserializes a JSON string into a {ClassName} instance
* @param jsonString The JSON string to deserialize
* @return A {ClassName} instance
*/

View File

@ -1,5 +1,5 @@
/**
* @description Custom exception for {describe when this exception is thrown}.
* Custom exception for {describe when this exception is thrown}.
* Use this exception to signal domain-specific errors that callers
* can catch and handle distinctly from system exceptions.
* @author {Author}

View File

@ -1,5 +1,5 @@
/**
* @description Interface for {describe the capability or contract this interface defines}.
* Interface for {describe the capability or contract this interface defines}.
* Implement this interface to provide {describe what implementations do}.
* @author {Author}
*
@ -13,7 +13,7 @@
public interface {InterfaceName} {
/**
* @description {Describe what this method should do}
* {Describe what this method should do}
* @param records {Describe the parameter}
* @return {Describe the return value}
*/

View File

@ -1,5 +1,5 @@
/**
* @description Invocable Apex for Flow/Process Builder integration
* Invocable Apex for Flow/Process Builder integration
* Exposes business logic as a Flow Action
* @author {{Author}}
* @date {{Date}}
@ -19,7 +19,7 @@ public with sharing class {{ClassName}}Invocable {
// ═══════════════════════════════════════════════════════════════════════
/**
* @description Main entry point for Flow Actions
* Main entry point for Flow Actions
* Method must be static, accept List<Request>, return List<Response>
* This signature supports bulkification when Flow runs for multiple records
*
@ -89,7 +89,7 @@ public with sharing class {{ClassName}}Invocable {
// ═══════════════════════════════════════════════════════════════════════
/**
* @description Core business logic implementation
* Core business logic implementation
* Separated for testability and reuse
*
* @param record The record to process
@ -115,7 +115,7 @@ public with sharing class {{ClassName}}Invocable {
// ═══════════════════════════════════════════════════════════════════════
/**
* @description Request wrapper for Flow inputs
* Request wrapper for Flow inputs
* Each @InvocableVariable appears in Flow's input mapping UI
*
* SUPPORTED TYPES:
@ -162,7 +162,7 @@ public with sharing class {{ClassName}}Invocable {
}
/**
* @description Response wrapper for Flow outputs
* Response wrapper for Flow outputs
* Each @InvocableVariable appears in Flow's output mapping UI
*
* TIP: Always include isSuccess and errorMessage for consistent error handling
@ -217,14 +217,14 @@ public with sharing class {{ClassName}}Invocable {
public List<SObject> outputRecords;
/**
* @description Convenience constructor for success responses
* Convenience constructor for success responses
*/
public Response() {
this.isSuccess = false;
}
/**
* @description Factory method for success response
* Factory method for success response
*/
public static Response success(String message, Id recordId) {
Response res = new Response();
@ -235,7 +235,7 @@ public with sharing class {{ClassName}}Invocable {
}
/**
* @description Factory method for error response
* Factory method for error response
*/
public static Response error(String message) {
Response res = new Response();

View File

@ -1,5 +1,5 @@
/**
* @description Queueable Apex class for {describe the async operation}.
* Queueable Apex class for {describe the async operation}.
* Accepts data through the constructor for stateful processing.
* Optionally implements Database.AllowsCallouts for external integrations.
* @author {Author}
@ -20,7 +20,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
// ─── Constructors ────────────────────────────────────────────────────
/**
* @description Creates a new queueable job to process the specified records
* Creates a new queueable job to process the specified records
* @param recordIds Set of record Ids to process
*/
public {ClassName}(Set<Id> recordIds) {
@ -28,7 +28,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
}
/**
* @description Creates a new queueable job with chain depth tracking
* Creates a new queueable job with chain depth tracking
* @param recordIds Set of record Ids to process
* @param chainDepth Current depth in the queueable chain
*/
@ -40,7 +40,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
// ─── Queueable Interface ─────────────────────────────────────────────
/**
* @description Executes the asynchronous work
* Executes the asynchronous work
* @param context The queueable context
*/
public void execute(QueueableContext context) {
@ -64,7 +64,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
// ─── Private Helpers ─────────────────────────────────────────────────
/**
* @description Chains to the next queueable job if needed, with depth guard
* Chains to the next queueable job if needed, with depth guard
*/
private void chainIfNeeded() {
// TODO: Determine if chaining is needed (e.g., remaining records to process)
@ -78,7 +78,7 @@ public with sharing class {ClassName} implements Queueable /*, Database.AllowsCa
}
/**
* @description Handles errors during execution
* Handles errors during execution
* @param jobId The async job Id
* @param e The exception that occurred
*/

View File

@ -1,5 +1,5 @@
/**
* @description Schedulable Apex class for {describe the scheduled operation}.
* Schedulable Apex class for {describe the scheduled operation}.
* Delegates heavy processing to a Batch or Queueable job.
* Keep execute() lightweight it should only launch other jobs.
* @author {Author}
@ -20,19 +20,19 @@ public with sharing class {ClassName} implements Schedulable {
// ─── CRON Expressions ────────────────────────────────────────────────
// Seconds Minutes Hours Day_of_month Month Day_of_week Optional_year
/** @description Runs daily at 2:00 AM */
/** Runs daily at 2:00 AM */
public static final String CRON_DAILY_2AM = '0 0 2 * * ?';
/** @description Runs every weekday at 6:00 AM */
/** Runs every weekday at 6:00 AM */
public static final String CRON_WEEKDAYS_6AM = '0 0 6 ? * MON-FRI';
/** @description Runs hourly at the top of the hour */
/** Runs hourly at the top of the hour */
public static final String CRON_HOURLY = '0 0 * * * ?';
// ─── Schedulable Interface ───────────────────────────────────────────
/**
* @description Entry point for the scheduled execution.
* Entry point for the scheduled execution.
* Delegates to a Batch or Queueable for the actual work.
* @param sc The schedulable context
*/
@ -49,7 +49,7 @@ public with sharing class {ClassName} implements Schedulable {
// ─── Convenience Scheduling Methods ──────────────────────────────────
/**
* @description Schedules this job to run daily at 2 AM
* Schedules this job to run daily at 2 AM
* @return The scheduled job Id
*/
public static String scheduleDaily() {
@ -61,7 +61,7 @@ public with sharing class {ClassName} implements Schedulable {
}
/**
* @description Aborts this scheduled job by name
* Aborts this scheduled job by name
* @param jobName The name used when scheduling
*/
public static void abort(String jobName) {

View File

@ -1,5 +1,5 @@
/**
* @description Selector class for {SObject} queries.
* Selector class for {SObject} queries.
* Encapsulates all SOQL for {SObject} records.
* All methods return bulkified results (Lists or Maps).
* @author {Author}
@ -9,7 +9,7 @@ public inherited sharing class {SObject}Selector {
// ─── Field Lists ─────────────────────────────────────────────────────
/**
* @description Returns the default set of fields to query for {SObject}.
* Returns the default set of fields to query for {SObject}.
* Centralizes field references to keep queries DRY.
* @return Comma-separated field list as a String
*/
@ -29,7 +29,7 @@ public inherited sharing class {SObject}Selector {
// ─── Query Methods ───────────────────────────────────────────────────
/**
* @description Selects {SObject} records by their Ids
* Selects {SObject} records by their Ids
* @param recordIds Set of {SObject} Ids to query
* @return List of {SObject} records matching the provided Ids
* @example
@ -50,7 +50,7 @@ public inherited sharing class {SObject}Selector {
}
/**
* @description Selects {SObject} records as a Map keyed by Id
* Selects {SObject} records as a Map keyed by Id
* @param recordIds Set of {SObject} Ids to query
* @return Map of Id to {SObject}
*/
@ -59,7 +59,7 @@ public inherited sharing class {SObject}Selector {
}
/**
* @description Selects {SObject} records by a specific field value
* Selects {SObject} records by a specific field value
* @param fieldName API name of the field to filter on
* @param values Set of values to match
* @return List of matching {SObject} records
@ -88,7 +88,7 @@ public inherited sharing class {SObject}Selector {
// ─── Exception ───────────────────────────────────────────────────────
/**
* @description Custom exception for query errors
* Custom exception for query errors
*/
public class QueryException extends Exception {}
}

View File

@ -1,5 +1,5 @@
/**
* @description Service class for {SObject} business logic.
* Service class for {SObject} business logic.
* Follows separation of concerns: delegates queries to {SObject}Selector
* and SObject manipulation to {SObject}Domain where applicable.
* @author {Author}
@ -12,7 +12,7 @@ public with sharing class {SObject}Service {
// ─── Public API ──────────────────────────────────────────────────────
/**
* @description {Describe the primary operation}
* {Describe the primary operation}
* @param recordIds Set of {SObject} Ids to process
* @return List of processed {SObject} records
* @throws {SObject}ServiceException if processing fails
@ -47,7 +47,7 @@ public with sharing class {SObject}Service {
// ─── Convenience Overloads ───────────────────────────────────────────
/**
* @description Single-record convenience overload
* Single-record convenience overload
* @param recordId The {SObject} Id to process
* @return The processed {SObject} record
*/
@ -63,7 +63,7 @@ public with sharing class {SObject}Service {
// ─── Exception ───────────────────────────────────────────────────────
/**
* @description Custom exception for {SObject}Service errors
* Custom exception for {SObject}Service errors
*/
public class {SObject}ServiceException extends Exception {}
}

View File

@ -1,5 +1,5 @@
/**
* @description Trigger Action for {SObject}: {ActionDescription}.
* Trigger Action for {SObject}: {ActionDescription}.
* Implements TriggerAction.{Context} from the Trigger Actions Framework.
* Register via Trigger_Action__mdt custom metadata to activate.
* @author {Author}
@ -14,7 +14,7 @@
public with sharing class TA_{SObject}_{ActionName} implements TriggerAction.BeforeInsert {
/**
* @description Executes before insert logic for {SObject} records
* Executes before insert logic for {SObject} records
* @param newList List of new {SObject} records being inserted
*/
public void beforeInsert(List<{SObject}> newList) {

View File

@ -1,5 +1,5 @@
/**
* @description Trigger for {SObject}.
* Trigger for {SObject}.
* Delegates all logic to the Trigger Actions Framework (MetadataTriggerHandler).
* If TAF is not installed, delegate to a single handler class instead.
* @author {Author}

View File

@ -1,5 +1,5 @@
/**
* @description Utility class for {describe the category of utilities: String, Date, Collection, etc.}.
* Utility class for {describe the category of utilities: String, Date, Collection, etc.}.
* All methods are static and side-effect-free (no SOQL, no DML).
* Private constructor prevents instantiation.
* @author {Author}
@ -9,7 +9,7 @@ public class {ClassName} {
// ─── Private Constructor ─────────────────────────────────────────────
/**
* @description Prevents instantiation use static methods only
* Prevents instantiation use static methods only
*/
@TestVisible
private {ClassName}() {
@ -21,7 +21,7 @@ public class {ClassName} {
// TODO: Add utility methods below. Examples:
/**
* @description Safely converts a String to an Integer, returning a default if parsing fails
* Safely converts a String to an Integer, returning a default if parsing fails
* @param value The String to parse
* @param defaultValue The fallback value if parsing fails
* @return The parsed Integer or the default value
@ -41,7 +41,7 @@ public class {ClassName} {
}
/**
* @description Chunks a list into smaller sublists of the specified size.
* Chunks a list into smaller sublists of the specified size.
* Useful for processing records in governor-limit-safe batches.
* @param items The list to chunk
* @param chunkSize The maximum size of each chunk
@ -72,7 +72,7 @@ public class {ClassName} {
}
/**
* @description Extracts a Set of non-null field values from a list of SObjects
* Extracts a Set of non-null field values from a list of SObjects
* @param records The SObject records to extract from
* @param fieldName The API name of the field to extract
* @return A Set of non-null String values