The test bootstraps an IIQ environment using the contents of the “build/extract” folder, which is where your artifacts would be located post-build if you are using SailPoint’s SSB framework. You can then run arbitrary IIQ code, and make various JUnit assertions.

This example also demonstrates mocking and provisioning to an existing application from your codebase, one called “Delimited File” in this case. This test runs “offline”, outside of any running IIQ installation.

@ExtendWith(IIQTestExtension.class)
@InitBasePath("build/extract")
public class Test1 {

    /**
     * This is auto-injected by the extension
     */
    @Inject
    private SailPointContext context;


    @Inject
    private TestUtil testUtil;

    @Test
    public void testProvisionDelimitedFile() throws GeneralException, ConnectorException {
        Identity identity = context.getObjectByName(Identity.class, "user.amy");
        assertNotNull(identity);

        Application delimitedFile = context.getObjectByName(Application.class, "Delimited File");
        testUtil.getApplicationMock().mockAndSave(delimitedFile);

        ProvisioningUtilities utils = new ProvisioningUtilities(context);
        utils.setUseWorkflow(false);
        ProvisioningPlan plan = new ProvisioningPlan();
        plan.setArguments(new Attributes<>());
        plan.setIdentity(identity);
        plan.add("Delimited File", "user.amy", ProvisioningPlan.AccountRequest.Operation.Create);
        utils.doProvisioning(plan);

        context.saveObject(identity);

        assertEquals(3, identity.getLinks().size());
        assertEquals("Delimited File", identity.getLinks().get(2).getApplicationName());
        assertNotNull(identity.getLinks().get(2).getId());
    }


}
Scroll to Top