Tests
An instance of the forvendi.BreezzApi.BreezzTest class (accessible via forvendi.BreezzApi.TESTS) provides utility methods to initialize test contexts, deliver asynchronous queue events, mock callouts, query data, and perform framework assertions in Apex unit tests.
init()
Initializes the framework testing context using the default Apex class instance provider (BreezzPlugin).
Signature:
public void init()Return Value: void
Usage Example:
forvendi.BreezzApi.TESTS.init();init(String baseApexPlugin)
Initializes the testing context with a custom Apex plugin class provider.
Signature:
public void init(String baseApexPlugin)Parameters:
baseApexPlugin: Name of the custom Apex class providing plugin instances.
Return Value: void
deliverStepAsyncQueueEvents(String stepConfigDevName)
Delivers asynchronous queue events for a selected Step configuration. Useful for testing steps executed from the Scheduler.
Signature:
public void deliverStepAsyncQueueEvents(String stepConfigDevName)Parameters:
stepConfigDevName: Developer name of the Step Configuration custom metadata.
Return Value: void
deliverAsyncQueueEvents()
Delivers all pending asynchronous queue events in the test context.
Signature:
public void deliverAsyncQueueEvents()Return Value: void
deliverDelayedAsyncJobs()
Delivers pending delayed asynchronous jobs in the test context.
Signature:
public void deliverDelayedAsyncJobs()Return Value: void
assertErrorLogs()
Asserts that no error logs were captured during execution.
Signature:
public void assertErrorLogs()Return Value: void
Usage Example:
forvendi.BreezzApi.TESTS.assertErrorLogs();assertErrorLogs(Integer numOfErrors)
Asserts that an exact specified number of error logs were captured.
Signature:
public void assertErrorLogs(Integer numOfErrors)Parameters:
numOfErrors: Expected number of error log records.
Return Value: void
assertAsyncJobsErrors()
Asserts error conditions within the AsyncJob queue processing.
Signature:
public void assertAsyncJobsErrors()Return Value: void
getAllAsyncJobs()
Retrieves all asynchronous job records created during the test execution.
Signature:
public forvendi__B_AsyncJob__c[] getAllAsyncJobs()Return Value: forvendi__B_AsyncJob__c[] – List of asynchronous job records.
loadRecordById(Id id)
Loads an SObject record by its Record ID.
Signature:
public SObject loadRecordById(Id id)Parameters:
id: ID of the record to load.
Return Value: SObject – Record instance, or null if not found.
loadRecordByIds(Set<Id> ids)
Loads multiple SObject records matching a set of IDs.
Signature:
public SObject[] loadRecordByIds(Set<Id> ids)Parameters:
ids: Set of record IDs to retrieve.
Return Value: SObject[] – Array of retrieved records.
loadAllRecords(SObjectType objectType)
Loads all records of a specified SObjectType from the test database.
Signature:
public SObject[] loadAllRecords(SObjectType objectType)Parameters:
objectType: TargetSObjectType.
Return Value: SObject[] – Array of all records for the specified SObject.
loadRecordsByParentIds(SObjectType objectType, Set<Id> ids, SObjectField parentId)
Loads records filtering by parent record IDs via an SObjectField reference.
Signature:
public SObject[] loadRecordsByParentIds(
SObjectType objectType,
Set<Id> ids,
SObjectField parentId
)Parameters:
objectType: TargetSObjectType.ids: Set of parent record IDs.parentId:SObjectFieldreference for the parent lookup field.
Return Value: SObject[] – Array of matching child records.
loadRecordsByParentIds(SObjectType objectType, Set<Id> ids, String parentId)
Loads records filtering by parent record IDs via a field API name string.
Signature:
public SObject[] loadRecordsByParentIds(
SObjectType objectType,
Set<Id> ids,
String parentId
)Parameters:
objectType: TargetSObjectType.ids: Set of parent record IDs.parentId: String API name of the parent lookup field.
Return Value: SObject[] – Array of matching child records.
setCalloutMock()
Registers a single HTTP callout mock and returns the instance for further configuration.
Signature:
public forvendi.CalloutMock setCalloutMock()Return Value: forvendi.CalloutMock – Configurable mock instance.
setCalloutMultiMock()
Registers a multi-response HTTP callout mock engine.
Signature:
public forvendi.CalloutMultiMock setCalloutMultiMock()Return Value: forvendi.CalloutMultiMock – Multi-mock engine instance.
validateTestContext()
Validates that the current transaction is executing inside an Apex unit test context.
Signature:
public void validateTestContext()Return Value: void
getRecordsByIdsQuery(SObjectType objectType, Id[] ids, String idField)
Generates a SOQL query string to retrieve records by IDs.
Signature:
public String getRecordsByIdsQuery(SObjectType objectType, Id[] ids, String idField)Parameters:
objectType: TargetSObjectType.ids: Array of record IDs.idField: Field API name used for identification.
Return Value: String – Generated SOQL query string.
getAllRecords(SObjectType objectType)
Generates a SOQL query string to retrieve all records for a given SObjectType.
Signature:
public String getAllRecords(SObjectType objectType)Parameters:
objectType: TargetSObjectType.
Return Value: String – Generated SOQL query string.