# Rule Development Kit - Basic Issue

**URL:** <https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998>\
**Category:** SHF Discussion and Questions\
**Tags:** identity-security-cloud, rules\
**Created:** [August 16, 2024, 3:32pm UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998 "2024-08-16T15:32:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ady1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@ady1](https://developer.sailpoint.com/discuss/u/ady1)\
**Post date:** [August 16, 2024, 3:32pm UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/1 "2024-08-16T15:32:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![GOKUL\_ANANTH\_M](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gokul_ananth_m/32/14416_2.png) [@GOKUL\_ANANTH\_M](https://developer.sailpoint.com/discuss/u/GOKUL_ANANTH_M)\
**Post date:** [August 16, 2024, 3:38pm UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/2 "2024-08-16T15:38:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ady1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@ady1](https://developer.sailpoint.com/discuss/u/ady1)\
**Post date:** [August 17, 2024, 10:48am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/3 "2024-08-17T10:48:27Z")

</div>

[UniqueNameGeneratorTest.java](https://developer.sailpoint.com/discuss/uploads/short-url/6DMvHmuvdJOns3c4mdJzyGXYSP6.java) (3.5 KB)

The uploaded file is the java Test script.

Thanks for you help in identifying the issue!

---

<div class="post-metadata">

**Author:** ![GOKUL\_ANANTH\_M](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gokul_ananth_m/32/14416_2.png) [@GOKUL\_ANANTH\_M](https://developer.sailpoint.com/discuss/u/GOKUL_ANANTH_M)\
**Post date:** [August 18, 2024, 5:18pm UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/4 "2024-08-18T17:18:29Z")

</div>

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!!

---

<div class="post-metadata">

**Author:** ![chrishogan](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/chrishogan/32/41505_2.png) [@chrishogan](https://developer.sailpoint.com/discuss/u/chrishogan)\
**Post date:** [August 21, 2024, 5:31am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/5 "2024-08-21T05:31:48Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![varshini303](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@varshini303](https://developer.sailpoint.com/discuss/u/varshini303)\
**Post date:** [August 21, 2024, 7:25am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/6 "2024-08-21T07:25:48Z")

</div>

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.

> <https://stackoverflow.com/questions/41050029/mockito-cannot-mock-this-class>

Thanks!

---

<div class="post-metadata">

**Author:** ![ady1](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@ady1](https://developer.sailpoint.com/discuss/u/ady1)\
**Post date:** [August 21, 2024, 8:00am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/7 "2024-08-21T08:00:36Z")

</div>

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”

@chrishogan - 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.

---

<div class="post-metadata">

**Author:** ![varshini303](https://avatars.discourse-cdn.com/v4/letter/v/9d8465/32.png) [@varshini303](https://developer.sailpoint.com/discuss/u/varshini303)\
**Post date:** [August 21, 2024, 8:37am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/8 "2024-08-21T08:37:21Z")

</div>

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.

> **[GitHub - sailpoint-oss/rule-development-kit: A development environment setup for creating...](https://github.com/sailpoint-oss/rule-development-kit)**
>
> A development environment setup for creating rules.

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [October 20, 2024, 8:37am UTC](https://developer.sailpoint.com/discuss/t/rule-development-kit-basic-issue/76998/9 "2024-10-20T08:37:38Z")

</div>

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