Rule Development Kit - Basic Issue

Hi All,

I have little to no experience in using IDE’s but I have followed the very helpful instructions for deployment and use of the Rule Development Kit.

I have managed to clone the project. I have also written the rule (an AttrributeGenerator rule) using the SailPoint documentation.

When I run the test cases using the command line ‘mvn test -Dtest=“UniqueNameGeneratorTest”’ , I get the error (3 times - once for each test): " [ERROR] UniqueNameGeneratorTest.testUniqueLogic:92 Mockito
Mockito cannot mock this class: class sailpoint.object.Identity."

I assume this is something to do with the Test, XML or Java components not being able to find the ‘sailpoint’ class? But this is where my intelligence runs out.

Can anyone point me in the right direction? Any help you can provide would be appreciated.

Can you send the Test code here? It will be useful to find the issue. Thanks!!

2 Likes

UniqueNameGeneratorTest.java (3.5 KB)

The uploaded file is the java Test script.

Thanks for you help in identifying the issue!

Hi @ady1 ,

I can’t find any mistakes in the code provided. Just check whether you have missed any objects to mock - like links, etc.

In your main code, if you have any objects or variables defined to get the identity, please comment it and try the execution. Thanks!!

2 Likes

Hi Adrian,

I am also encountering the same Mockito error, not only with my own test class but with the provided test classes and rules from the repo. I am investigating and will let you know if I find a solution.

Hi @ady1,

This could be a compatibility issue between the Java and Mockito versions. We might need to find and check either or all the possible ways to conclude which java version would be compatible with mockito version in mocking all the sailpoint classes:

  1. Upgrade the jdk version.
  2. Upgrade the mockito-core dependency version in pom.xml file.

You can try any of these solutions listed here if you feel the issue lies here.

Thanks!

1 Like

Thanks for the review @GOKUL_ANANTH_M ,

I have looked for missing references and also commented out the identity references. It has made no difference - I still get the same error.

I did add the mock ‘Application’ object code (from the UserNameGeneratorTest example) into my UniqueNameGeneratorTest code:

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

This causes an additional error: “Mockito cannot mock this class: class sailpoint.object.Application”

@chris-hogan - I can also confirm I get the same error across all provided Test Classes too.

@varshini303 - I have update Java and modifed the version of mockito-core to be 5.12.0 (it was 5.2.0). However, I still get the same errors.
How can I confirm that the newly installed version of Java is being used by the Rule Dev Kit?
Also, how can I confirm that the updated version of mockito-core in the pom.xml is being used?

Once again, thanks all for your inputs and suggestions.

  1. To check the java version used by RDK: You can run mvn -version
  2. However, I’m not aware of how to check if the expected mockito version is used by RDK. As far as I know, just updating the version number in the pom build file and rebuilding the project would automatically update to the latest version of mockito.

Also, I believe you are using the latest repo of RDK where they have upgraded the rule-java-docs dependency to version 1.1.

Would share any if I find some other lead, thanks!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.