Apex BOOST Library
v1.7 from Lucidware Solutions (LWS)

Test

global inherited sharing class Test
DescriptionUtilities 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)
DescriptionCreate a system admin user for use in System.runAs(). The record is not inserted.

  generateReadonlyUser

global static User generateReadonlyUser(String username)
DescriptionCreate a minimum-access user for use in System.runAs(). The record is not inserted.

  generateUser

global static User generateUser(String username, Id profileId)
DescriptionCreate 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()
DescriptionInitialize 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)
DescriptionCall this method during unit testing to get coverage of catch blocks