Index: maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java =================================================================== --- maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (revision 699392) +++ maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java (working copy) @@ -401,9 +401,9 @@ private File[] suiteXmlFiles; /** - * Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used. + * Allows you to specify the name of the JUnit artifact. If not set, junit:junit-dep will be used. * - * @parameter expression="${junitArtifactName}" default-value="junit:junit" + * @parameter expression="${junitArtifactName}" default-value="junit:junit-dep" * @since 2.3.1 */ private String junitArtifactName; @@ -666,10 +666,10 @@ addArtifact( surefireBooter, surefireArtifact ); junitArtifact = (Artifact) projectArtifactMap.get( junitArtifactName ); - // SUREFIRE-378, junit can have an alternate artifact name - if ( junitArtifact == null && "junit:junit".equals( junitArtifactName ) ) + // SUREFIRE-378/SUREFIRE-519, junit can have an alternate artifact name + if ( junitArtifact == null && "junit:junit-dep".equals( junitArtifactName ) ) { - junitArtifact = (Artifact) projectArtifactMap.get( "junit:junit-dep" ); + junitArtifact = (Artifact) projectArtifactMap.get( "junit:junit" ); } // TODO: this is pretty manual, but I'd rather not require the plugin > dependencies section right now Index: surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDep45WithJUnit3DependencyTest.java =================================================================== --- surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDep45WithJUnit3DependencyTest.java (revision 0) +++ surefire-integration-tests/src/test/java/org/apache/maven/surefire/its/JUnitDep45WithJUnit3DependencyTest.java (revision 0) @@ -0,0 +1,31 @@ +package org.apache.maven.surefire.its; + + +import java.io.File; + +import org.apache.maven.it.Verifier; +import org.apache.maven.it.util.ResourceExtractor; + +/** + * Test project using JUnit4.5-dep and a transtivie dependency to JUnit3 (through JMock). + * junit-dep includes only junit.* classes, and depends explicitly on hamcrest-core + * + * @author Dan Fabulich + * @author Henrik Kaipe + */ +public class JUnitDep45WithJUnit3DependencyTest + extends AbstractSurefireIT +{ + public void testJUnitDep45WithJUnit3Dependency () + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/junitdep45-and-transitive-junit3-dependency" ); + + Verifier verifier = new Verifier( testDir.getAbsolutePath() ); + this.executeGoal( verifier, "test" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + HelperAssertions.assertTestSuiteResults( 1, 0, 0, 0, testDir ); + } +} Index: surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/pom.xml =================================================================== --- surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/pom.xml (revision 0) +++ surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/pom.xml (revision 0) @@ -0,0 +1,52 @@ + + 4.0.0 + org.apache.maven.plugins.surefire + junitdep45-with-junit3-dependency + 1.0-SNAPSHOT + Test junitdep-4.5 Dependency With junit-3.8.1 Transitive Dependency + + + + + + maven-compiler-plugin + + 1.5 + 1.5 + + + + + maven-surefire-plugin + ${surefire.version} + + + + + + + + + + jmock + jmock + 1.2.0 + test + + + + + junit + junit-dep + 4.5 + test + + + + + Index: surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/src/test/java/junitdep45withjunit3dependency/JunitDepDependencyTest.java =================================================================== --- surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/src/test/java/junitdep45withjunit3dependency/JunitDepDependencyTest.java (revision 0) +++ surefire-integration-tests/src/test/resources/junitdep45-and-transitive-junit3-dependency/src/test/java/junitdep45withjunit3dependency/JunitDepDependencyTest.java (revision 0) @@ -0,0 +1,19 @@ +package junitdep45withjunit3dependency; + +import org.junit.Test; + +public class JunitDepDependencyTest +{ + + @Test + public void shouldBeExecutedWithTestDependencyJunitDep() + { +// System.out.println("JUnit4 would execute this test-method"); + } + + public void test_PojoTestMethod_WouldBeIgnoredByJUnit4() + { + throw new AssertionError( + "This test-method would not have been executed by JUnit4"); + } +}