-
Bug
-
Resolution: Obsolete
-
Major
-
None
-
7.2.0.GA, 7.3.0.GA
-
Windows
jBoss EAP
A JUnit class created outside of Business Central within a Maven src/test/java folder location is unable to pick up classes within the same package found within the Maven src/main/java folder location.
As a separate issue, JUnit classes are recognized as "Data Object" assets by Business Central, seemingly by virtue of simply being a .java file. It throws an error as well. That should be an issue for another task.
A workaround exist to make Business Central happy, which I will describe here... But it's not a feasible alternative to actual work
The workaround is to place the JUnit classes within the Maven src/main/java folder location instead of the conventional src/test/java folder location.
This workaround works, but it is not ideal for several reasons:
- Test resources should not be packaged into the JAR artifact.
- Maven dependencies in test scope are technically not in the classpath of src/main/java classes, but Business Central is happy when clicking on the "Build" and "Deploy" buttons.
- The two reasons above breaks Maven builds in CI/CD environments (i.e. Jenkins) because it will not successfully compile a Maven build when JUnit classes and annotations are used without JUnit Maven dependencies in the classpath. Of course, you can modify the POM to place JUnit in compile scope, but that violates best practices.
- is related to
-
JBPM-8550 JUnit tests in src/test/java folder unable to find classes in src/main/java
- Open