SOAR error with new JUnit Test Case

Hello,

I am starting a new Java project on the MicroEJ SDK and I’d like to add some JUnit test cases, however when I try to add a new test case from the New > Others... > JUnit > JUnit Test Case menu and attempt to build my project for use on hardware, I get this SOAR ERROR :

=============== [ Launching SOAR ] ===============
1 : SOAR ERROR

FAIL
Soar image generation aborted.

[M51] - Class java.lang.reflect.Array not found (class is referenced by the class org/hamcrest/internal/ArrayIterator).

I don’t get this error when running on the simulator, and removing my test case and the JUnit dependency from my classpath removes the error and my project builds and run fine. Is there a JUnit support issue here ? Is there another way to add test cases ?

Thank you.

Hi @harleyj,

It seems to me that adding a test case through the menu added the J2SE Junit library to you classpath. At MicroEJ we are using a custom and optimized version of JUnit, you can find more information at https://docs.microej.com/en/latest/ApplicationDeveloperGuide/testsuite.html.

The error in itself is due to a missing, we do not provide the java.lang.reflect.Array in our runtime mainly for performance reasons (allowing reflection on limited hardware can be quite costly) and the J2SE Junit library references java.lang.reflect.Array.

Hope it’ll help.
Gaëtan for MicroEJ

Thanks for the answer, I removed JUnit from my classpath and added the dependency line in the Ivy file and this seems to have solved the problem, it does build now.