[Engine-devel] The correct way to create test dependencies between
Yair Zaslavsky
yzaslavs at redhat.com
Sun May 6 13:13:28 UTC 2012
On 05/06/2012 03:46 PM, Allon Mureinik wrote:
> 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).
More on @Rule can be found at this blog -
http://blog.schauderhaft.de/2009/10/04/junit-rules/
>
> 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
> _______________________________________________
> Engine-devel mailing list
> Engine-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/engine-devel
More information about the Engine-devel
mailing list