I have a basic maven project with the folder structure: -main and -test directories.
I have one package in the main source directory which consists of a few classes, say a.class b.class and c.class, all under the same package. All classes have dependencies to each other. To do proper unit testing, and to cut the dependencies from each class, I write stub classes of each a, b and c class, define them to have the same package and put them inside the test source directory. Then I run: mvn test
Fine, the stubs are now being found first from the classpath and used, but I want to modify the classpath (on the fly?) so that, when testing class a, I need to have the original a.class and stubs used for b.class and c.class. Similarly, when testing class b, I need to have the original class b and stubs used for a.class and c.class.
How do I accomplish this using Maven and JUnit?
This is kind of frustrating in Java, because in C++, one can use the makefile source path and user defined include paths in unit test header files to force the stubs to be found first and then explicitly add an include to the original class to be tested.