Tests

An instance of the forvendi.BreezzApi.BreezzTest class provides a suite of utility methods to initialize and test Breezz functionalities.


init()

Initializes the testing context using the default Apex class instance provider ‘BreezzPlugin’.

Signature:

forvendi.BreezzApi.TESTS.init();

Return Value:

void


init(String BaseApexPlugin)

Initializes the Breezz test by getting the Breezz settings.

Signature:

forvendi.BreezzApi.TESTS.init(String baseApexPlugin)

Parameters:

  • baseApexPlugin - name of the class that provides an instance of an Apex class

Return Value:

void


deliverStepAsyncQueueEvents(String stepConfigDevName)

Delivers the asynchronous queue events for selected Step configuration. Useful for the steps that are executed from Scheduler

Signature:

forvendi.BreezzApi.TESTS.deliverStepAsyncQueueEvents();

Parameters:

  • stepConfigDevName - step configuration metadata DeveloperName

Return Value:

void


deliverAsyncQueueEvents()

Delivers the asynchronous queue events.

Signature:

forvendi.BreezzApi.TESTS.deliverAsyncQueueEvents();

Return Value:

void


deliverDelayedAsyncJobs()

Delivers the delayed asynchronous jobss.

Signature:

forvendi.BreezzApi.TESTS.deliverDelayedAsyncJobs();

Return Value:

void


assertErrorLogs()

Asserts that there are no error logs.

Signature:

forvendi.BreezzApi.TESTS.assertErrorLogs();

Return Value:

void


assertErrorLogs(Integer numOfErrors)

Asserts that there are specified number of error logs.

Signature:

forvendi.BreezzApi.TESTS.assertErrorLogs(Integer numOfErrors);

Parameters:

  • numOfErrors - the number of error logs

Return Value:

void


assertAsyncJobsErrors()

Asserts errors in the AsyncJob queue.

Signature:

forvendi.BreezzApi.TESTS.assertAsyncJobsErrors();

Return Value:

void


getAllAsyncJobs()

Gets all asynchronous jobs.

Signature:

forvendi.BreezzApi.TESTS.getAllAsyncJobs();

Return Value:

B_AsyncJob__c[] - List of all asynchronous jobs.


loadRecordById(Id id)

Loads a record by its id.

Signature:

forvendi.BreezzApi.TESTS.loadRecordById(Id id);

Parameters:

  • Id - id of the record to be loaded

Return Value:

SObject record with specified id, or null if not found.


loadRecordByIds(Set ids)

Loads a record by their ids.

Signature:

forvendi.BreezzApi.TESTS.loadRecordByIds(Set<Id> ids);

Parameters:

  • Ids - ids of the records to be loaded

Return Value:

SObject[] - an array of records with specified ids.


loadAllRecords(SObjectType objectType)

Loads all records of a specified object type.

Signature:

forvendi.BreezzApi.TESTS.loadAllRecords(SObjectType objectType);

Parameters:

  • objectType - object type of the records to be loaded

Return Value:

SObject[] - an array of all records of the specified object type.


loadRecordsByParentIds(SObjectType objectType, final Set ids, SObjectField parentId)

Loads records by their parent ids.

Signature:

forvendi.BreezzApi.TESTS.loadRecordsByParentIds(SObjectType objectType, final Set<Id> ids, SObjectField parentId);

Parameters:

  • objectType - object type of the records to be loaded
  • ids - parent ids of the records to be loaded
  • parentId - name of the parent id field

Return Value:

SObject[] - an array of records with the specified parent ids.


loadRecordsByParentIds(SObjectType objectType, Set ids, String parentId)

Loads records by their parent ids.

Signature:

forvendi.BreezzApi.TESTS.loadRecordsByParentIds(SObjectType objectType, Set<Id> ids, String parentId);

Parameters:

  • objectType - object type of the records to be loaded.
  • ids - parent ids of the records to be loaded
  • parentId - name of the parent id field

Return Value:

SObject[] - an array of records with the specified parent ids.


setCalloutMock()

Sets a callout mock with a single HTTP response and returns it for further configuration. Refer to CalloutMock to configure a mock.

Signature:

forvendi.BreezzApi.TESTS.setCalloutMock();

Return Value:

CalloutMock - a configurable mock


setCalloutMultiMock()

Sets a callout mock with multiple HTTP responses. A fitting HttpResponse is returned based on configurations of added CalloutMocks. Refer to CalloutMultiMock to configure a mock.

Signature:

forvendi.BreezzApi.TESTS.setCalloutMultiMock();

Return Value:

CalloutMultiMock - instance of CalloutMultiMock used for adding CalloutMocks


validateTestContext()

Validates that the current context is a test context.

Signature:

validateContext();

getRecordsByIdsQuery(SObjectType objectType, Id[] ids, String idField)

Generates a query to retrieve records by their Ids.

Signature:

getRecordsByIdsQuery(SObjectType objectType, Id[] ids, String idField);

Parameters:

  • objectType - type of SObject to retrieve records for.
  • ids - ids of the records to retrieve
  • idField - field name used to identify the records

Return Value:

String - a query string to retrieve the records.


getAllRecords(SObjectType objectType)

Generates a query to retrieve all records for a given SObject type.

Signature:

getAllRecords(SObjectType objectType);

Parameters:

  • objectType - type of SObject to retrieve records for.

Return Value:

String - a query string to retrieve all records for the given SObject type.