Hi guys,
I've recently come up with (what I believe is) an elegant way to mock the Config
object using JUnit @Rules and Mockito (The gritty details can be found at
http://gerrit.ovirt.org/4155).
This presented me with another issue:
On the one hand, the code depends on junit and mockito jars, which are not available in
the main scope, only in the test scope.
On the other hand, in vanilla Maven there is no dependency between tests of different
projects, so placing this class in util's test would make it inaccessible to bll
tests.
The solution Maven suggests for these kind of issues is creating a test jar
(
http://maven.apache.org/guides/mini/guide-attached-tests.html): In addition to the
regular jar the module produces, you'll get another -test jar, which other modules can
depend on using the <type>test-jar</type>, which could of course be put in
<scope>test</scope>.
Before pushing forward with this approach, I'd like to know if anyone has a principle
objection to it.
Thanks,
Allon