I have not tried this, but I think the following approach will work. (I used it with another library that had a similar problem.)
Step 1 - Subclass AbstractMojoTestCase
I know what you are thinking. This class has the same problem as the JUnit 3.8 class. But it normal. You are not going to run it. All you are going to do is make the public methods you need to call. For instance:
public org.codehaus.plexus.PlexusContainer getContainer() { return super.getContainer(); }
Step 2 - write your JUnit 4 test
Write your Junit 4 test, giving it the "helper" class instance variable in step 1. If the @Before and @After methods call the setUp and tearDown helper methods.
source share