Closed ops4j-issues closed 3 weeks ago
Harald Wellmann commented
We had a similar issue with Mockito and JUnit, see PAXEXAM-274 .
I'm afraid there is no quick solution.
All these xxxBundles() options are hard to maintain and are likely to be deprecated.
Pax Exam 2.4.0 will let the user override all provisioning defaults, including Exam's own bundles.
Regarding JUnit and Hamcrest, it's really a nuisance that JUnit is not osgified by default, and the SpringSource bundle we're currently using is also flawed, it exports the org.hamcrest packages with an incorrect version.
We might solve this by properly osgifying JUnit on our own.
Anyway, thanks for posting your workaround!
Caspar MacRae created PAXEXAM-343
Hi, there's a few issues with getting jMock to work in Pax Exam (2.3.0).
Annoyingly jUnit's default distribution includes some (but not all) of the hamcrest library and this is the one being used in PaxExam (org.junit/com.springsource.org.junit/4.9.0) which doesn't contain org.hamcrest.TypeSafeMatcher, required by jMock.
This is easily worked around by replacing the JUnitBundlesOption with, e.g. wrap:mvn:junit/junit-dep/4.10 (junit-dep doesn't include any of hamcrest).
Then hamcrest has a split package org.hamcrest between hamcrest-core and hamcrest-library (version 1.3.RC2), which can be worked around by not exporting this package from the hamcrest-library (where it just contains a static builder/helper). Hamcrest also requires DynamicImport-Package to be specified.
The code below works, but if you replace customJunitBundles() with junitBundles() then it will fail. Not sure what's the best solution to get this working out of the box - perhaps make jmockBundles and junitBundles options mutually exclusive and include all the junit and hamcrest specifics in the jmockBundles option?
JMockIntegrationTest.java
Affects: 2.3.0.M1, 2.3.0 Votes: 0, Watches: 1