Help Troubleshooting rule error

Hello all,

I am in the processing of fully learning how to utilize the Rule Development Tool Kit. I have a simple example I am using to learn this tool using based on the base username generator that Tylor provided as part of the project.

I am not getting an error message and I am not even 100% sure that I have added everything that is needed for the test be successful. Any advice or pointers welcome. I am still in the learning phase I have 0 Java background I am coming at this from a Python and .Net developer and I am not even sure where to start looking into these errors.

ERROR:

-------------------------------------------------------------------------------
Test set: sailpoint.SamAccountNameGeneratorTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.425 s <<< FAILURE! -- in sailpoint.SamAccountNameGeneratorTest
sailpoint.SamAccountNameGeneratorTest.testSamAccountNameGenerator -- Time elapsed: 0.190 s <<< ERROR!
java.lang.ClassCastException: class java.lang.Class cannot be cast to class java.lang.String (java.lang.Class and java.lang.String are in module java.base of loader 'bootstrap')
	at sailpoint.SamAccountNameGeneratorTest.testSamAccountNameGenerator(SamAccountNameGeneratorTest.java:75)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

sailpoint.SamAccountNameGeneratorTest.testbuildUserNameBase -- Time elapsed: 0.141 s <<< ERROR!
java.lang.ClassCastException: class java.lang.Class cannot be cast to class java.lang.String (java.lang.Class and java.lang.String are in module java.base of loader 'bootstrap')
	at sailpoint.SamAccountNameGeneratorTest.testbuildUserNameBase(SamAccountNameGeneratorTest.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
	at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
	at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
	at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
	at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
	at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
	at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
	at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
	at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

JAVA Class:

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

import sailpoint.object.Application;
import sailpoint.object.Field;
import sailpoint.object.Identity;
import sailpoint.server.IdnRuleUtil;
import sailpoint.tools.GeneralException;


public class SamAccountNameGenerator {
    Logger log = LogManager.getLogger(UsernameGenerator.class);
    Identity identity = new Identity();
    Application application = new Application();
    IdnRuleUtil idn;
    Field field = new Field();

    int MAX_USERNAME_LENGTH = 9;

    public String buildUserNameBase(String firstName, String lastName) throws GeneralException {
        firstName = firstName.replaceAll("[^a-zA-Z0-9]", "");
        String firstIntial = firstName.substring(0, 1);
        lastName = lastName.replaceAll("[^a-zA-Z0-9]","");
        String lastFirst5 = lastName.substring(0, 5);
        String userName =  firstIntial + lastFirst5;
        return userName;
    } 

    public String findNextId(String userNameBase) throws  GeneralException {
        int counter = 1;

        while(!isUnique(userNameBase + "9" + Integer.toString(counter)))
        {
            counter++;
        }

        String userName = userNameBase + "9" + Integer.toString(counter);
        return userName;
    }

    public boolean maxCountCheck(String userName, int maxLength) throws GeneralException {
        int userIdLength = userName.length();
        if(userIdLength <= maxLength){
            return true;
        }
        else{
            return false;
        }
    }

    public boolean isUnique(String username) throws GeneralException {
        return !idn.accountExistsByDisplayName(application.getName(), username);
    }

    public String SamAccountNameGenerator(String firstName, String lastName) throws GeneralException{
        String userIdBase = buildUserNameBase(firstName, lastName);
        String userId = findNextId(userIdBase);
        if(userId.length() <= MAX_USERNAME_LENGTH){
            return userId.toLowerCase();
        }
        else{
            return null;
        }
    }
}

TEST Class:

package sailpoint;

import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import bsh.EvalError;
import bsh.Interpreter;
import sailpoint.object.Application;
import sailpoint.object.Identity;
import sailpoint.rdk.utils.RuleXmlUtils;
import sailpoint.server.IdnRuleUtil;
import sailpoint.tools.GeneralException;


public class SamAccountNameGeneratorTest{
    Logger log = LogManager.getLogger(SamAccountNameGeneratorTest.class);
    private static final String RULE_FILENAME = "src/main/resources/rules/Rule - AttributeGenerator - SamAccountNameGenerator.xml";

    @Test
    public void testbuildUserNameBase() throws GeneralException, EvalError {
        Interpreter i = new Interpreter();

        IdnRuleUtil idn = mock();
        when(idn.accountExistsByDisplayName(any(), any())).thenReturn(false);

        Application application = mock(Application.class);
        when(application.getName()).thenReturn("Active Directory [source]");

        Identity identity = mock(Identity.class);
        when(identity.getFirstname()).thenReturn("Tyler");
        when(identity.getLastname()).thenReturn("Smith");
        String result = "";

        i.set("log", log);
        i.set("idn", idn);
        i.set("application", application);
        i.set("identity", identity);

        String source = RuleXmlUtils.readRuleSourceFromFilePath(RULE_FILENAME);
        result = (String) i.eval(source);

        assertNotNull(result);
        assertEquals(result, "tsmith");

        log.info("Beanshell script returned: " + result);
    }

    @Test
    public void testSamAccountNameGenerator() throws GeneralException, EvalError{
        Interpreter i = new Interpreter();

        IdnRuleUtil idn = mock();
        when(idn.accountExistsByDisplayName(any(), any())).thenReturn(false);

        Application application = mock(Application.class);
        when(application.getName()).thenReturn("Active Directory [source]");

        Identity identity = mock(Identity.class);
        when(identity.getFirstname()).thenReturn("Tyler");
        when(identity.getLastname()).thenReturn("Smith");
        String result = "";

        i.set("log", log);
        i.set("idn", idn);
        i.set("application", application);
        i.set("identity", identity);

        String source = RuleXmlUtils.readRuleSourceFromFilePath(RULE_FILENAME);
        result = (String) i.eval(source);

        assertNotNull(result);
        assertEquals(result, "tsmith91");

        log.info("Beanshell script returned: " + result);
    }
}

XML Rule:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="SamAccountNameGenerator" type="AttributeGenerator">
  <Description>Calculates LCS based on start and end dates.</Description>
  <Source><![CDATA[
    import org.apache.log4j.LogManager;
    import org.apache.log4j.Logger;

    import sailpoint.object.Application;
    import sailpoint.object.Field;
    import sailpoint.object.Identity;
    import sailpoint.server.IdnRuleUtil;
    import sailpoint.tools.GeneralException;


    public class SamAccountNameGenerator {
        Logger log = LogManager.getLogger(UsernameGenerator.class);
        Identity identity = new Identity();
        Application application = new Application();
        IdnRuleUtil idn;
        Field field = new Field();

        int MAX_USERNAME_LENGTH = 9;

        public String buildUserNameBase(String firstName, String lastName) throws GeneralException {
            firstName = firstName.replaceAll("[^a-zA-Z0-9]", "");
            String firstIntial = firstName.substring(0, 1);
            lastName = lastName.replaceAll("[^a-zA-Z0-9]","");
            String lastFirst5 = lastName.substring(0, 5);
            String userName =  firstIntial + lastFirst5;
            return userName;
        } 

        public String findNextId(String userNameBase) throws  GeneralException {
            int counter = 1;

            while(!isUnique(userNameBase + "9" + Integer.toString(counter)))
            {
                counter++;
            }

            String userName = userNameBase + "9" + Integer.toString(counter);
            return userName;
        }

        public boolean maxCountCheck(String userName, int maxLength) throws GeneralException {
            int userIdLength = userName.length();
            if(userIdLength <= maxLength){
                return true;
            }
            else{
                return false;
            }
        }

        public boolean isUnique(String username) throws GeneralException {
            return !idn.accountExistsByDisplayName(application.getName(), username);
        }

        public String SamAccountNameGenerator(String firstName, String lastName) throws GeneralException{
            String userIdBase = buildUserNameBase(firstName, lastName);
            String userId = findNextId(userIdBase);
            if(userId.length() <= MAX_USERNAME_LENGTH){
                return userId.toLowerCase();
            }
            else{
                return null;
            }
        }
    }

 ]]></Source>
</Rule>

File set up:

I ran both myself, and it seems that there is something wrong with the generator rule, the test class is working fine. I’ll have a look further to see if I can pinpoint the issue in your code.

you should not put the whole class inside xml file for the rule.
Just

  • the import statements
  • any methods (or are they called functions?)
  • a return statement at the end that will call the method to generate the string

Your XML should look something like below:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="SamAccountNameGenerator" type="AttributeGenerator">
  <Description>Calculates LCS based on start and end dates.</Description>
  <Source><![CDATA[
    import org.apache.log4j.LogManager;
    import org.apache.log4j.Logger;

    import sailpoint.object.Application;
    import sailpoint.object.Field;
    import sailpoint.object.Identity;
    import sailpoint.server.IdnRuleUtil;
    import sailpoint.tools.GeneralException;

        int MAX_USERNAME_LENGTH = 9;

        public String buildUserNameBase(String firstName, String lastName) throws GeneralException {
            firstName = firstName.replaceAll("[^a-zA-Z0-9]", "");
            String firstIntial = firstName.substring(0, 1);
            lastName = lastName.replaceAll("[^a-zA-Z0-9]","");
            String lastFirst5 = lastName.substring(0, 5);
            String userName =  firstIntial + lastFirst5;
            return userName;
        } 

        public String findNextId(String userNameBase) throws  GeneralException {
            int counter = 1;

            while(!isUnique(userNameBase + "9" + Integer.toString(counter)))
            {
                counter++;
            }

            String userName = userNameBase + "9" + Integer.toString(counter);
            return userName;
        }

        public boolean maxCountCheck(String userName, int maxLength) throws GeneralException {
            int userIdLength = userName.length();
            if(userIdLength <= maxLength){
                return true;
            }
            else{
                return false;
            }
        }

        public boolean isUnique(String username) throws GeneralException {
            return !idn.accountExistsByDisplayName(application.getName(), username);
        }

        public String SamAccountNameGenerator(String firstName, String lastName) throws GeneralException{
            String userIdBase = buildUserNameBase(firstName, lastName);
            String userId = findNextId(userIdBase);
            if(userId.length() <= MAX_USERNAME_LENGTH){
                return userId.toLowerCase();
            }
            else{
                return null;
            }
        }
		
		String firstName = "GET FIRST NAME FROM IDENTITY OBJECT???";
		String lastName = "GET LAST NAME FROM IDENTITY OBJECT???";
		
		return SamAccountNameGenerator(firstName, lastName)
 

 ]]></Source>
</Rule>

As mentioned indeed, you don’t need to declare the class in your XML rule version (this is beanshell, not proper java).

Also, your rule originally didn’t return any value (see @nitheshra0 example).

This worked for me:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="SamAccountNameGenerator" type="AttributeGenerator">
  <Description>Calculates LCS based on start and end dates.</Description>
  <Source><![CDATA[
    import org.apache.log4j.LogManager;
    import org.apache.log4j.Logger;

    import sailpoint.object.Application;
    import sailpoint.object.Field;
    import sailpoint.object.Identity;
    import sailpoint.server.IdnRuleUtil;
    import sailpoint.tools.GeneralException;

        int MAX_USERNAME_LENGTH = 9;

        public String buildUserNameBase(String firstName, String lastName) throws GeneralException {
            firstName = firstName.replaceAll("[^a-zA-Z0-9]", "");
            String firstIntial = firstName.substring(0, 1);
            lastName = lastName.replaceAll("[^a-zA-Z0-9]","");
            String lastFirst5 = lastName.substring(0, 5);
            String userName =  firstIntial + lastFirst5;
            return userName;
        } 

        public String findNextId(String userNameBase) throws  GeneralException {
            int counter = 1;

            while(!isUnique(userNameBase + "9" + Integer.toString(counter)))
            {
                counter++;
            }

            String userName = userNameBase + "9" + Integer.toString(counter);
            return userName;
        }

        public boolean maxCountCheck(String userName, int maxLength) throws GeneralException {
            int userIdLength = userName.length();
            if(userIdLength <= maxLength){
                return true;
            }
            else{
                return false;
            }
        }

        public boolean isUnique(String username) throws GeneralException {
            return !idn.accountExistsByDisplayName(application.getName(), username);
        }

        public String SamAccountNameGenerator(String firstName, String lastName) throws GeneralException{
            String userIdBase = buildUserNameBase(firstName, lastName);
            String userId = findNextId(userIdBase);
            if(userId.length() <= MAX_USERNAME_LENGTH){
                return userId.toLowerCase();
            }
            else{
                return null;
            }
        }
				
		return SamAccountNameGenerator(identity.getFirstname(), identity.getLastname());
 

 ]]></Source>
</Rule>

Thank you both for your input and help. One thing I am still struggling with is why I am getting an error massage when testing one of the methods within the class. If I remove that test I then get a build successful. I verified the test case and logic and it should be behaving exactly as excepted. I am not sure what I am missing for this.

Test with just the primary method:

PS C:\Users\mpotti\OneDrive - SSM Health\Documents\Visual Studio Code Projects\SailPoint Rule Devkit\rule-development-kit> mvn test
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< sailpoint:rule-development-kit >-------------------
[INFO] Building rule-development-kit 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] 1 problem was encountered while building the effective model for org.javassist:javassist:jar:3.18.1-GA during dependency collection step for project (use -X to see details)
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ rule-development-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources from src\main\resources to target\classes
[INFO]
[INFO] --- compiler:3.13.0:compile (default-compile) @ rule-development-kit ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ rule-development-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource from src\test\resources to target\test-classes
[INFO]
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ rule-development-kit ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- surefire:3.2.5:test (default-test) @ rule-development-kit ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running sailpoint.FlattenMultiValuedAttributeTest
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
09:16:17.385 [main] DEBUG sailpoint.FlattenMultiValuedAttributeTest - Attribute not found with default application name. Adding ' [source]' to application name and searching again
09:16:17.389 [main] DEBUG sailpoint.FlattenMultiValuedAttributeTest - Raw object returned from attribute: [read, write, manage]
09:16:17.396 [main] INFO  sailpoint.FlattenMultiValuedAttributeTest - Beanshell script returned: read,write,manage
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.656 s -- in sailpoint.FlattenMultiValuedAttributeTest
[INFO] Running sailpoint.IdentityAttributeTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.413 s -- in sailpoint.IdentityAttributeTest
[INFO] Running sailpoint.JoinAttributesTest
09:16:18.920 [main] DEBUG sailpoint.ManagerCorrelationTest - Map log: {access=admin, permission=write, [email protected]}
09:16:18.926 [main] INFO  sailpoint.ManagerCorrelationTest - access="admin - write" email="[email protected]"
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.141 s -- in sailpoint.JoinAttributesTest
[INFO] Running sailpoint.ManagerCorrelationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.486 s -- in sailpoint.ManagerCorrelationTest
[INFO] Running sailpoint.NameNormalizerTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.750 s -- in sailpoint.NameNormalizerTest
[INFO] Running sailpoint.ProvisioningTest
09:16:22.042 [main] DEBUG sailpoint.ProvisioningTest - Setting Provisioning plan to modify
09:16:22.045 [main] INFO  sailpoint.ProvisioningTest - Beanshell script returned: null
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.658 s -- in sailpoint.ProvisioningTest
[INFO] Running sailpoint.SamAccountNameGeneratorTest
09:16:22.510 [main] INFO  sailpoint.SamAccountNameGeneratorTest - Beanshell script returned: tsmith91
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.263 s -- in sailpoint.SamAccountNameGeneratorTest
[INFO] Running sailpoint.UsernameGeneratorTest
09:16:22.944 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: kiefer.s
09:16:22.944 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:16:22.945 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: kiefer.s
09:16:23.025 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: tyler.smith
09:16:23.025 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:16:23.026 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: tyler.smith
09:16:23.296 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: kiefer.t
09:16:23.297 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:16:23.297 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: kiefer.t
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.775 s -- in sailpoint.UsernameGeneratorTest
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  15.777 s
[INFO] Finished at: 2025-04-18T09:16:25-05:00
[INFO] ------------------------------------------------------------------------

Test Case Removed:

 @Test
    public void testbuildUserNameBase() throws GeneralException, EvalError {
        Interpreter i = new Interpreter();

        IdnRuleUtil idn = mock();
        when(idn.accountExistsByDisplayName(any(), any())).thenReturn(false);

        Application application = mock(Application.class);
        when(application.getName()).thenReturn("Active Directory [source]");

        Identity identity = mock(Identity.class);
        when(identity.getFirstname()).thenReturn("Tyler");
        when(identity.getLastname()).thenReturn("Smith");
        String result = "";

        i.set("log", log);
        i.set("idn", idn);
        i.set("application", application);
        i.set("identity", identity);

        String source = RuleXmlUtils.readRuleSourceFromFilePath(RULE_FILENAME);
        result = (String) i.eval(source);

        assertNotNull(result);
        assertEquals(result, "tsmith");

        log.info("Beanshell script returned: " + result);
    }

Updated XML File:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule name="SamAccountNameGenerator" type="AttributeGenerator">
  <Description>Calculates LCS based on start and end dates.</Description>
  <Source><![CDATA[
    import org.apache.log4j.LogManager;
    import org.apache.log4j.Logger;

    import sailpoint.object.Application;
    import sailpoint.object.Field;
    import sailpoint.object.Identity;
    import sailpoint.server.IdnRuleUtil;
    import sailpoint.tools.GeneralException;

        int MAX_USERNAME_LENGTH = 9;

        public String buildUserNameBase(String firstName, String lastName) throws GeneralException {
            firstName = firstName.replaceAll("[^a-zA-Z0-9]", "");
            String firstIntial = firstName.substring(0, 1);
            lastName = lastName.replaceAll("[^a-zA-Z0-9]","");
            String lastFirst5 = lastName.substring(0, 5);
            String userName =  firstIntial + lastFirst5;
            return userName;
        } 

        public String findNextId(String userNameBase) throws  GeneralException {
            int counter = 1;

            while(!isUnique(userNameBase + "9" + Integer.toString(counter)))
            {
                counter++;
            }

            String userName = userNameBase + "9" + Integer.toString(counter);
            return userName;
        }

        public boolean maxCountCheck(String userName, int maxLength) throws GeneralException {
            int userIdLength = userName.length();
            if(userIdLength <= maxLength){
                return true;
            }
            else{
                return false;
            }
        }

        public boolean isUnique(String username) throws GeneralException {
            return !idn.accountExistsByDisplayName(application.getName(), username);
        }

        public String SamAccountNameGenerator(String firstName, String lastName) throws GeneralException{
            String userIdBase = buildUserNameBase(firstName, lastName);
            String userId = findNextId(userIdBase);
            if(userId.length() <= MAX_USERNAME_LENGTH){
                return userId.toLowerCase();
            }
            else{
                return null;
            }
        }
				
		return SamAccountNameGenerator(identity.getFirstname(), identity.getLastname());
 

 ]]></Source>
</Rule>

Error when including the method test case:

[INFO] Scanning for projects...
[INFO] 
[INFO] -------------------< sailpoint:rule-development-kit >-------------------
[INFO] Building rule-development-kit 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] 1 problem was encountered while building the effective model for org.javassist:javassist:jar:3.18.1-GA during dependency collection step for project (use -X to see details)
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ rule-development-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources from src\main\resources to target\classes
[INFO] 
[INFO] --- compiler:3.13.0:compile (default-compile) @ rule-development-kit ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ rule-development-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource from src\test\resources to target\test-classes
[INFO]
[INFO] --- compiler:3.13.0:testCompile (default-testCompile) @ rule-development-kit ---
[INFO] Nothing to compile - all classes are up to date.
[INFO]
[INFO] --- surefire:3.2.5:test (default-test) @ rule-development-kit ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running sailpoint.FlattenMultiValuedAttributeTest
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
09:04:17.856 [main] DEBUG sailpoint.FlattenMultiValuedAttributeTest - Attribute not found with default application name. Adding ' [source]' to application name and searching again
09:04:17.863 [main] DEBUG sailpoint.FlattenMultiValuedAttributeTest - Raw object returned from attribute: [read, write, manage]
09:04:17.869 [main] INFO  sailpoint.FlattenMultiValuedAttributeTest - Beanshell script returned: read,write,manage
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.687 s -- in sailpoint.FlattenMultiValuedAttributeTest
[INFO] Running sailpoint.IdentityAttributeTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.624 s -- in sailpoint.IdentityAttributeTest
[INFO] Running sailpoint.JoinAttributesTest
09:04:18.577 [main] DEBUG sailpoint.ManagerCorrelationTest - Map log: {access=admin, permission=write, [email protected]}
09:04:18.587 [main] INFO  sailpoint.ManagerCorrelationTest - access="admin - write" email="[email protected]"
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 s -- in sailpoint.JoinAttributesTest
[INFO] Running sailpoint.ManagerCorrelationTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.304 s -- in sailpoint.ManagerCorrelationTest
[INFO] Running sailpoint.NameNormalizerTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.437 s -- in sailpoint.NameNormalizerTest
[INFO] Running sailpoint.ProvisioningTest
09:04:20.420 [main] DEBUG sailpoint.ProvisioningTest - Setting Provisioning plan to modify
09:04:20.423 [main] INFO  sailpoint.ProvisioningTest - Beanshell script returned: null
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.994 s -- in sailpoint.ProvisioningTest
[INFO] Running sailpoint.SamAccountNameGeneratorTest
09:04:20.514 [main] INFO  sailpoint.SamAccountNameGeneratorTest - Beanshell script returned: tsmith91
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.353 s <<< FAILURE! -- in sailpoint.SamAccountNameGeneratorTest
[ERROR] sailpoint.SamAccountNameGeneratorTest.testbuildUserNameBase -- Time elapsed: 0.173 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <tsmith91> but was: <tsmith>
        at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
        at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
        at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1142)
        at sailpoint.SamAccountNameGeneratorTest.testbuildUserNameBase(SamAccountNameGeneratorTest.java:49)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
        at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
        at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
        at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
        at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
        at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
        at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
        at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
        at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:56)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)

[INFO] Running sailpoint.UsernameGeneratorTest
09:04:20.965 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: kiefer.s
09:04:20.966 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:04:20.966 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: kiefer.s
09:04:21.259 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: tyler.smith
09:04:21.260 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:04:21.267 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: tyler.smith
09:04:21.290 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Unique username generated: kiefer.t
09:04:21.290 [main] DEBUG sailpoint.UsernameGeneratorTest - AD Create User Name | Exit from the  GenerateUsername Method
09:04:21.290 [main] INFO  sailpoint.UsernameGeneratorTest - Beanshell script returned: kiefer.t
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.505 s -- in sailpoint.UsernameGeneratorTest
[INFO] 
[INFO] Results:
[INFO]
[ERROR] Failures: 
[ERROR]   SamAccountNameGeneratorTest.testbuildUserNameBase:49 expected: <tsmith91> but was: <tsmith>
[INFO]
[ERROR] Tests run: 15, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.917 s
[INFO] Finished at: 2025-04-18T09:04:22-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.5:test (default-test) on project rule-development-kit: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\mpotti\OneDrive - SSM Health\Documents\Visual Studio Code Projects\SailPoint Rule Devkit\rule-development-kit\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException