Apex
BOOST
Library
v1.7 from
Lucidware Solutions
(LWS)
Home
Assert
AssertException
BatchJob
Http
Logger
Query
SObjects
Test
TriggerHandler
Util
Test
global inherited sharing class
Test
Description
Utilities and methods for unit tests.
Easy user creation for use in
System.runAs()
.
Consistent system-wide initialization for things like custom settings and required data.
A mechanism for testing exception situations.
SObject
fake
Id
generation
Properties
adminUser
global static User adminUser
A system admin user for use in
System.runAs()
. The record is not inserted.
minAccessUser
global static User minAccessUser
A standard Minimum Access Salesforce user for use in
System.runAs()
. The record is not inserted.
testException
global static
Boolean
testException
Use this in conjunction with
aBoost.Test.throwIfTesting()
to get coverage for catch blocks
Methods
generateAdminUser
global static User generateAdminUser(
String
username)
Description
Create a system admin user for use in
System.runAs()
. The record is not inserted.
generateReadonlyUser
global static User generateReadonlyUser(
String
username)
Description
Create a minimum-access user for use in
System.runAs()
. The record is not inserted.
generateUser
global static User generateUser(
String
username,
Id
profileId)
Description
Create a user with the specified profile for use in
System.runAs()
. The record is not inserted.
getFakeId
global static
Id
getFakeId(
SObjectType
objType)
Description
Create an
Id
for the specified
SObjectType
. Useful for writing fast tests that don't do SOQL or DML.
init
global static void init()
Description
Initialize the system. This base implementation creates default Apex
BOOST
custon settings. To run this, include the following in your unit test class:
static { aBoost.Test.init(); }
throwIfTesting
global static void throwIfTesting(
Exception
ex)
Description
Call this method during unit testing to get coverage of catch blocks