You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2021/01/08 18:42:19 UTC
[maven] 01/08: [MNG-7035] Migrate all tests to JUnit 4
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch MNG-7035-maven5
in repository https://gitbox.apache.org/repos/asf/maven.git
commit 76e5ebbd773bd8e7e8b928ac7c951b6a9894bb7d
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Nov 26 11:47:09 2020 +0100
[MNG-7035] Migrate all tests to JUnit 4
---
.../apache/maven/settings/GlobalSettingsTest.java | 10 +-
.../apache/maven/artifact/ArtifactUtilsTest.java | 8 +-
.../apache/maven/artifact/DefaultArtifactTest.java | 23 +-
.../artifact/versioning/ComparableVersionIT.java | 6 +-
.../artifact/versioning/ComparableVersionTest.java | 17 +-
.../versioning/DefaultArtifactVersionTest.java | 15 +-
.../artifact/versioning/VersionRangeTest.java | 20 +-
.../building/DefaultProblemCollectorTest.java | 5 +-
.../apache/maven/building/DefaultProblemTest.java | 6 +-
.../org/apache/maven/building/FileSourceTest.java | 4 +-
.../building/ProblemCollectorFactoryTest.java | 6 +-
.../apache/maven/building/StringSourceTest.java | 4 +-
.../org/apache/maven/building/UrlSourceTest.java | 4 +-
.../test/java/org/apache/maven/PlexusTestCase.java | 317 ++++++++++++++++++++
.../AbstractArtifactComponentTestCase.java | 36 ++-
.../artifact/deployer/ArtifactDeployerTest.java | 16 ++
.../factory/DefaultArtifactFactoryTest.java | 17 +-
.../artifact/installer/ArtifactInstallerTest.java | 13 +
.../repository/MavenArtifactRepositoryTest.java | 7 +-
.../resolver/ArtifactResolutionExceptionTest.java | 6 +-
.../artifact/resolver/ArtifactResolverTest.java | 20 +-
.../resolver/DefaultArtifactResolverTest.java | 13 +-
.../resolver/filter/AndArtifactFilterTest.java | 8 +-
.../resolver/filter/FilterHashEqualsTest.java | 6 +-
.../resolver/filter/OrArtifactFilterTest.java | 8 +-
.../resolver/filter/ScopeArtifactFilterTest.java | 10 +-
.../transform/TransformationManagerTest.java | 9 +-
.../manager/DefaultProfileManagerTest.java | 17 +-
.../project/AbstractMavenProjectTestCase.java | 21 +-
.../org/apache/maven/project/ModelUtilsTest.java | 24 +-
.../apache/maven/project/ProjectClasspathTest.java | 6 +
.../inheritance/t00/ProjectInheritanceTest.java | 4 +
.../inheritance/t01/ProjectInheritanceTest.java | 4 +
.../inheritance/t02/ProjectInheritanceTest.java | 5 +
.../inheritance/t03/ProjectInheritanceTest.java | 4 +
.../inheritance/t04/ProjectInheritanceTest.java | 6 +
.../inheritance/t05/ProjectInheritanceTest.java | 6 +
.../inheritance/t06/ProjectInheritanceTest.java | 6 +
.../inheritance/t07/ProjectInheritanceTest.java | 7 +
.../inheritance/t08/ProjectInheritanceTest.java | 6 +
.../inheritance/t09/ProjectInheritanceTest.java | 8 +
.../inheritance/t10/ProjectInheritanceTest.java | 6 +
.../inheritance/t11/ProjectInheritanceTest.java | 5 +
.../inheritance/t12/ProjectInheritanceTest.java | 5 +
.../inheritance/t12scm/ProjectInheritanceTest.java | 5 +
.../project/path/DefaultPathTranslatorTest.java | 7 +-
.../repository/LegacyRepositorySystemTest.java | 26 +-
.../maven/repository/MirrorProcessorTest.java | 34 ++-
.../legacy/DefaultUpdateCheckManagerTest.java | 19 +-
.../repository/legacy/DefaultWagonManagerTest.java | 35 ++-
.../legacy/LegacyRepositorySystemTest.java | 22 +-
.../resolver/DefaultArtifactCollectorTest.java | 63 +++-
.../conflict/AbstractConflictResolverTest.java | 20 +-
.../conflict/FarthestConflictResolverTest.java | 5 +
.../conflict/NearestConflictResolverTest.java | 5 +
.../conflict/NewestConflictResolverTest.java | 5 +
.../conflict/OldestConflictResolverTest.java | 5 +
.../DefaultClasspathTransformationTest.java | 19 +-
.../DefaultGraphConflictResolutionPolicyTest.java | 25 +-
.../metadata/DefaultGraphConflictResolverTest.java | 18 +-
.../repository/metadata/TestMetadataSource.java | 7 +-
.../maven/AbstractCoreMavenComponentTestCase.java | 7 +-
.../java/org/apache/maven/DefaultMavenTest.java | 45 +--
.../maven/MavenLifecycleParticipantTest.java | 6 +
.../src/test/java/org/apache/maven/MavenTest.java | 6 +-
.../test/java/org/apache/maven/PlexusTestCase.java | 317 ++++++++++++++++++++
.../maven/ProjectDependenciesResolverTest.java | 11 +-
.../artifact/handler/ArtifactHandlerTest.java | 6 +-
.../configuration/DefaultBeanConfiguratorTest.java | 21 +-
.../DefaultMavenExecutionRequestPopulatorTest.java | 2 +
.../scope/internal/MojoExecutionScopeTest.java | 11 +-
.../graph/DefaultProjectDependencyGraphTest.java | 17 +-
.../maven/lifecycle/DefaultLifecyclesTest.java | 28 +-
.../lifecycle/LifecycleExecutorSubModulesTest.java | 6 +
.../maven/lifecycle/LifecycleExecutorTest.java | 24 +-
.../maven/lifecycle/MavenExecutionPlanTest.java | 12 +-
.../internal/BuildListCalculatorTest.java | 9 +-
.../lifecycle/internal/BuilderCommonTest.java | 12 +-
.../internal/ConcurrencyDependencyGraphTest.java | 15 +-
.../internal/LifecycleDependencyResolverTest.java | 13 +
.../LifecycleExecutionPlanCalculatorTest.java | 4 +
.../LifecycleTaskSegmentCalculatorImplTest.java | 9 +-
.../lifecycle/internal/PhaseRecorderTest.java | 9 +-
.../ConcurrencyDependencyGraphTest.java | 11 +-
.../multithreaded/ThreadOutputMuxerTest.java | 31 +-
.../stub/ProjectDependencyGraphStubTest.java | 24 +-
.../org/apache/maven/plugin/PluginManagerTest.java | 19 +-
.../maven/plugin/PluginParameterExceptionTest.java | 8 +-
.../PluginParameterExpressionEvaluatorTest.java | 32 ++-
.../plugin/internal/DefaultLegacySupportTest.java | 9 +-
.../project/AbstractMavenProjectTestCase.java | 11 +-
.../project/DefaultMavenProjectBuilderTest.java | 25 +-
.../project/ExtensionDescriptorBuilderTest.java | 29 +-
.../org/apache/maven/project/MavenProjectTest.java | 18 ++
.../apache/maven/project/PomConstructionTest.java | 157 +++++++++-
.../apache/maven/project/ProjectBuilderTest.java | 31 +-
.../maven/project/ProjectModelResolverTest.java | 20 +-
.../artifact/DefaultMavenMetadataCacheTest.java | 17 +-
.../artifact/DefaultProjectArtifactsCacheTest.java | 15 +-
.../project/artifact/MavenMetadataSourceTest.java | 15 +-
.../canonical/CanonicalProjectBuilderTest.java | 5 +
.../internal/DefaultRuntimeInformationTest.java | 16 +-
.../settings/PomConstructionWithSettingsTest.java | 28 +-
.../apache/maven/settings/SettingsUtilsTest.java | 10 +-
.../toolchain/RequirementMatcherFactoryTest.java | 14 +-
.../maven/cli/CLIManagerDocumentationTest.java | 5 +-
.../apache/maven/cli/CLIReportingUtilsTest.java | 6 +-
.../model/building/ComplexActivationTest.java | 10 +-
.../building/DefaultModelBuilderFactoryTest.java | 6 +-
.../maven/model/building/FileModelSourceTest.java | 7 +-
.../model/building/FileToRawModelMergerTest.java | 6 +-
.../model/building/SimpleProblemCollector.java | 1 -
.../DefaultInheritanceAssemblerTest.java | 43 +--
.../AbstractModelInterpolatorTest.java | 23 +-
.../interpolation/MavenBuildTimestampTest.java | 6 +-
.../StringSearchModelInterpolatorTest.java | 21 +-
.../maven/model/merge/MavenModelMergerTest.java | 6 +-
.../maven/model/path/DefaultUrlNormalizerTest.java | 4 +-
.../activation/AbstractProfileActivatorTest.java | 20 +-
.../activation/JdkVersionProfileActivatorTest.java | 8 +
.../activation/PropertyProfileActivatorTest.java | 11 +
.../validation/DefaultModelValidatorTest.java | 81 +++++-
.../org/apache/maven/model/ActivationFileTest.java | 11 +-
.../org/apache/maven/model/ActivationOSTest.java | 11 +-
.../apache/maven/model/ActivationPropertyTest.java | 11 +-
.../org/apache/maven/model/ActivationTest.java | 11 +-
.../java/org/apache/maven/model/BuildTest.java | 11 +-
.../org/apache/maven/model/CiManagementTest.java | 11 +-
.../org/apache/maven/model/ContributorTest.java | 11 +-
.../maven/model/DependencyManagementTest.java | 11 +-
.../org/apache/maven/model/DependencyTest.java | 11 +-
.../maven/model/DeploymentRepositoryTest.java | 11 +-
.../java/org/apache/maven/model/DeveloperTest.java | 11 +-
.../maven/model/DistributionManagementTest.java | 11 +-
.../java/org/apache/maven/model/ExclusionTest.java | 11 +-
.../java/org/apache/maven/model/ExtensionTest.java | 11 +-
.../apache/maven/model/IssueManagementTest.java | 11 +-
.../java/org/apache/maven/model/LicenseTest.java | 11 +-
.../org/apache/maven/model/MailingListTest.java | 11 +-
.../java/org/apache/maven/model/ModelTest.java | 11 +-
.../java/org/apache/maven/model/NotifierTest.java | 11 +-
.../org/apache/maven/model/OrganizationTest.java | 11 +-
.../java/org/apache/maven/model/ParentTest.java | 11 +-
.../maven/model/PluginConfigurationTest.java | 11 +-
.../apache/maven/model/PluginContainerTest.java | 11 +-
.../apache/maven/model/PluginExecutionTest.java | 11 +-
.../apache/maven/model/PluginManagementTest.java | 11 +-
.../java/org/apache/maven/model/PluginTest.java | 11 +-
.../org/apache/maven/model/PrerequisitesTest.java | 11 +-
.../java/org/apache/maven/model/ProfileTest.java | 11 +-
.../org/apache/maven/model/RelocationTest.java | 11 +-
.../org/apache/maven/model/ReportPluginTest.java | 11 +-
.../java/org/apache/maven/model/ReportSetTest.java | 11 +-
.../java/org/apache/maven/model/ReportingTest.java | 11 +-
.../apache/maven/model/RepositoryPolicyTest.java | 11 +-
.../org/apache/maven/model/RepositoryTest.java | 11 +-
.../java/org/apache/maven/model/ResourceTest.java | 11 +-
.../test/java/org/apache/maven/model/ScmTest.java | 11 +-
.../test/java/org/apache/maven/model/SiteTest.java | 11 +-
.../descriptor/PluginDescriptorBuilderTest.java | 6 +-
.../test/java/org/apache/maven/PlexusTestCase.java | 318 +++++++++++++++++++++
.../internal/AbstractRepositoryTestCase.java | 10 +-
.../DefaultArtifactDescriptorReaderTest.java | 10 +-
.../internal/DefaultModelResolverTest.java | 16 ++
.../internal/DefaultVersionResolverTest.java | 15 +-
.../internal/MavenRepositorySystemUtilsTest.java | 7 +-
.../internal/RemoteSnapshotMetadataTest.java | 4 +-
.../repository/internal/RepositorySystemTest.java | 20 +-
.../DefaultSettingsBuilderFactoryTest.java | 6 +-
.../validation/DefaultSettingsValidatorTest.java | 29 +-
170 files changed, 2751 insertions(+), 570 deletions(-)
diff --git a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java b/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
index 2d34076..394db3e 100644
--- a/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
+++ b/apache-maven/src/test/java/org/apache/maven/settings/GlobalSettingsTest.java
@@ -19,24 +19,26 @@ package org.apache.maven.settings;
* under the License.
*/
-import junit.framework.TestCase;
-import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
+import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
+
/**
* Tests that the global settings.xml shipped with the distribution is in good state.
*
* @author Benjamin Bentmann
*/
public class GlobalSettingsTest
- extends TestCase
{
+ @Test
public void testValidGlobalSettings()
throws Exception
{
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java
index 333f636..c631aad 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/ArtifactUtilsTest.java
@@ -24,8 +24,10 @@ import java.util.List;
import java.util.Map;
import org.apache.maven.artifact.versioning.VersionRange;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* Tests {@link ArtifactUtils}.
@@ -33,7 +35,6 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ArtifactUtilsTest
- extends TestCase
{
private Artifact newArtifact( String aid )
@@ -41,6 +42,7 @@ public class ArtifactUtilsTest
return new DefaultArtifact( "group", aid, VersionRange.createFromVersion( "1.0" ), "test", "jar", "tests", null );
}
+ @Test
public void testIsSnapshot()
{
assertEquals( false, ArtifactUtils.isSnapshot( null ) );
@@ -52,6 +54,7 @@ public class ArtifactUtilsTest
assertEquals( false, ArtifactUtils.isSnapshot( "1.2.3-20090413X094722-2"));
}
+ @Test
public void testToSnapshotVersion()
{
assertEquals( "1.2.3", ArtifactUtils.toSnapshotVersion( "1.2.3" ) );
@@ -63,6 +66,7 @@ public class ArtifactUtilsTest
/**
* Tests that the ordering of the map resembles the ordering of the input collection of artifacts.
*/
+ @Test
public void testArtifactMapByVersionlessIdOrdering()
throws Exception
{
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
index fbd0119..144f753 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/DefaultArtifactTest.java
@@ -19,13 +19,15 @@ package org.apache.maven.artifact;
* under the License.
*/
-import junit.framework.TestCase;
-
import org.apache.maven.artifact.handler.ArtifactHandlerMock;
import org.apache.maven.artifact.versioning.VersionRange;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
public class DefaultArtifactTest
- extends TestCase
{
private DefaultArtifact artifact;
@@ -43,10 +45,10 @@ public class DefaultArtifactTest
private ArtifactHandlerMock artifactHandler;
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
artifactHandler = new ArtifactHandlerMock();
versionRange = VersionRange.createFromVersion( version );
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, classifier, artifactHandler );
@@ -55,6 +57,7 @@ public class DefaultArtifactTest
snapshotArtifact = new DefaultArtifact( groupId, artifactId, snapshotVersionRange, scope, type, classifier, artifactHandler );
}
+ @Test
public void testGetVersionReturnsResolvedVersionOnSnapshot()
{
assertEquals( snapshotResolvedVersion, snapshotArtifact.getVersion() );
@@ -65,53 +68,62 @@ public class DefaultArtifactTest
assertEquals( snapshotSpecVersion, snapshotArtifact.getBaseVersion() );
}
+ @Test
public void testGetDependencyConflictId()
{
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() );
}
+ @Test
public void testGetDependencyConflictIdNullGroupId()
{
artifact.setGroupId( null );
assertEquals( null + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() );
}
+ @Test
public void testGetDependencyConflictIdNullClassifier()
{
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler );
assertEquals( groupId + ":" + artifactId + ":" + type, artifact.getDependencyConflictId() );
}
+ @Test
public void testGetDependencyConflictIdNullScope()
{
artifact.setScope( null );
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier, artifact.getDependencyConflictId() );
}
+ @Test
public void testToString()
{
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope,
artifact.toString() );
}
+ @Test
public void testToStringNullGroupId()
{
artifact.setGroupId( null );
assertEquals( artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact.toString() );
}
+ @Test
public void testToStringNullClassifier()
{
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler );
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact.toString() );
}
+ @Test
public void testToStringNullScope()
{
artifact.setScope( null );
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version, artifact.toString() );
}
+ @Test
public void testComparisonByVersion()
{
Artifact artifact1 = new DefaultArtifact( groupId, artifactId, VersionRange.createFromVersion( "5.0" ), scope,
@@ -128,6 +140,7 @@ public class DefaultArtifactTest
assertTrue( artifact1.compareTo( artifact ) == 0 );
}
+ @Test
public void testNonResolvedVersionRangeConsistentlyYieldsNullVersions()
throws Exception
{
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionIT.java b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionIT.java
index 394b7f0..326ff57 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionIT.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionIT.java
@@ -19,9 +19,6 @@ package org.apache.maven.artifact.versioning;
* under the License.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
@@ -33,6 +30,9 @@ import java.util.regex.Pattern;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
public class ComparableVersionIT
{
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
index 97fb46d..95d8f50 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
@@ -21,7 +21,10 @@ package org.apache.maven.artifact.versioning;
import java.util.Locale;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
/**
* Test ComparableVersion.
@@ -30,7 +33,6 @@ import junit.framework.TestCase;
*/
@SuppressWarnings( "unchecked" )
public class ComparableVersionTest
- extends TestCase
{
private Comparable newComparable( String version )
{
@@ -101,16 +103,19 @@ public class ComparableVersionTest
assertTrue( "expected " + v2 + " > " + v1, c2.compareTo( c1 ) > 0 );
}
+ @Test
public void testVersionsQualifier()
{
checkVersionsOrder( VERSIONS_QUALIFIER );
}
+ @Test
public void testVersionsNumber()
{
checkVersionsOrder( VERSIONS_NUMBER );
}
+ @Test
public void testVersionsEqual()
{
newComparable( "1.0-alpha" );
@@ -164,6 +169,7 @@ public class ComparableVersionTest
checkVersionsEqual( "1m3", "1MILESTONE3" );
}
+ @Test
public void testVersionComparing()
{
checkVersionsOrder( "1", "2" );
@@ -202,6 +208,7 @@ public class ComparableVersionTest
* see Netbeans issues <a href="https://netbeans.org/bugzilla/show_bug.cgi?id=240845">240845</a> and
* <a href="https://netbeans.org/bugzilla/show_bug.cgi?id=226100">226100</a>
*/
+ @Test
public void testMng5568()
{
String a = "6.1.0";
@@ -216,6 +223,7 @@ public class ComparableVersionTest
/**
* Test <a href="https://jira.apache.org/jira/browse/MNG-6572">MNG-6572</a> optimization.
*/
+ @Test
public void testMng6572()
{
String a = "20190126.230843"; // resembles a SNAPSHOT
@@ -235,6 +243,7 @@ public class ComparableVersionTest
* Test all versions are equal when starting with many leading zeroes regardless of string length
* (related to MNG-6572 optimization)
*/
+ @Test
public void testVersionEqualWithLeadingZeroes()
{
// versions with string lengths from 1 to 19
@@ -267,6 +276,7 @@ public class ComparableVersionTest
* Test all "0" versions are equal when starting with many leading zeroes regardless of string length
* (related to MNG-6572 optimization)
*/
+ @Test
public void testVersionZeroEqualWithLeadingZeroes()
{
// versions with string lengths from 1 to 19
@@ -299,6 +309,7 @@ public class ComparableVersionTest
* Test <a href="https://issues.apache.org/jira/browse/MNG-6964">MNG-6964</a> edge cases
* for qualifiers that start with "-0.", which was showing A == C and B == C but A < B.
*/
+ @Test
public void testMng6964()
{
String a = "1-0.alpha";
@@ -310,6 +321,7 @@ public class ComparableVersionTest
checkVersionsOrder( a, b ); // Should still be true
}
+ @Test
public void testLocaleIndependent()
{
Locale orig = Locale.getDefault();
@@ -328,6 +340,7 @@ public class ComparableVersionTest
}
}
+ @Test
public void testReuse()
{
ComparableVersion c1 = new ComparableVersion( "1" );
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java
index fc5a274..59072d4 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/DefaultArtifactVersionTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.artifact.versioning;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Test DefaultArtifactVersion.
@@ -27,7 +31,6 @@ import junit.framework.TestCase;
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public class DefaultArtifactVersionTest
- extends TestCase
{
private ArtifactVersion newArtifactVersion( String version )
{
@@ -50,6 +53,7 @@ public class DefaultArtifactVersionTest
assertEquals( "check " + version + " string value", version, artifactVersion.toString() );
}
+ @Test
public void testVersionParsing()
{
checkVersionParsing( "1", 1, 0, 0, 0, null );
@@ -87,6 +91,7 @@ public class DefaultArtifactVersionTest
checkVersionParsing( "1.2.3-200705301630", 1, 2, 3, 0, "200705301630" );
}
+ @Test
public void testVersionComparing()
{
assertVersionEqual( "1", "1" );
@@ -134,6 +139,7 @@ public class DefaultArtifactVersionTest
assertVersionOlder( "2.0.0.v200706041905-7C78EK9E_EkMNfNOd2d8qq", "2.0.0.v200706041906-7C78EK9E_EkMNfNOd2d8qq" );
}
+ @Test
public void testVersionSnapshotComparing()
{
assertVersionEqual( "1-SNAPSHOT", "1-SNAPSHOT" );
@@ -168,6 +174,7 @@ public class DefaultArtifactVersionTest
assertVersionOlder( "2.0.1-xyz-SNAPSHOT", "2.0.1-123-SNAPSHOT" );
}
+ @Test
public void testSnapshotVsReleases()
{
assertVersionOlder( "1.0-RC1", "1.0-SNAPSHOT" );
@@ -175,6 +182,7 @@ public class DefaultArtifactVersionTest
assertVersionOlder( "1.0-rc-1", "1.0-SNAPSHOT" );
}
+ @Test
public void testHashCode()
{
ArtifactVersion v1 = newArtifactVersion( "1" );
@@ -183,16 +191,19 @@ public class DefaultArtifactVersionTest
assertEquals( v1.hashCode(), v2.hashCode() );
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( newArtifactVersion( "1" ).equals( null ) );
}
+ @Test
public void testEqualsTypeSafe()
{
assertFalse( newArtifactVersion( "1" ).equals( "non-an-artifact-version-instance" ) );
}
+ @Test
public void testNonNumericVersionRepresentationReturnsANumberFormatException()
{
try
diff --git a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
index 2cf0fec..7e6f5f4 100644
--- a/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
+++ b/maven-artifact/src/test/java/org/apache/maven/artifact/versioning/VersionRangeTest.java
@@ -21,9 +21,15 @@ package org.apache.maven.artifact.versioning;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.maven.artifact.Artifact;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Tests version range construction.
@@ -31,7 +37,6 @@ import org.apache.maven.artifact.Artifact;
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
*/
public class VersionRangeTest
- extends TestCase
{
private static final String CHECK_NUM_RESTRICTIONS = "check number of restrictions";
@@ -49,6 +54,7 @@ public class VersionRangeTest
private static final String CHECK_SELECTED_VERSION = "check selected version";
+ @Test
public void testRange()
throws InvalidVersionSpecificationException, OverConstrainedVersionException
{
@@ -154,6 +160,7 @@ public class VersionRangeTest
assertTrue( range.containsVersion( new DefaultArtifactVersion( "5.0.9.0" ) ) );
}
+ @Test
public void testInvalidRanges()
{
checkInvalidRange( "(1.0)" );
@@ -172,6 +179,7 @@ public class VersionRangeTest
checkInvalidRange( "(1.1,1.2],[1.0,1.1)" );
}
+ @Test
public void testIntersections()
throws InvalidVersionSpecificationException
{
@@ -654,6 +662,7 @@ public class VersionRangeTest
assertEquals( CHECK_NUM_RESTRICTIONS, 0, restrictions.size() );
}
+ @Test
public void testReleaseRangeBoundsContainsSnapshots()
throws InvalidVersionSpecificationException
{
@@ -664,6 +673,7 @@ public class VersionRangeTest
assertFalse( range.containsVersion( new DefaultArtifactVersion( "1.0-SNAPSHOT" ) ) );
}
+ @Test
public void testSnapshotRangeBoundsCanContainSnapshots()
throws InvalidVersionSpecificationException
{
@@ -678,6 +688,7 @@ public class VersionRangeTest
assertTrue( range.containsVersion( new DefaultArtifactVersion( "1.1-SNAPSHOT" ) ) );
}
+ @Test
public void testSnapshotSoftVersionCanContainSnapshot()
throws InvalidVersionSpecificationException
{
@@ -699,6 +710,7 @@ public class VersionRangeTest
}
}
+ @Test
public void testContains() throws InvalidVersionSpecificationException
{
ArtifactVersion actualVersion = new DefaultArtifactVersion( "2.0.5" );
@@ -723,11 +735,13 @@ public class VersionRangeTest
return vr.containsVersion( actualVersion );
}
+ @Test
public void testOrder0()
{
// assertTrue( new DefaultArtifactVersion( "1.0-alpha10" ).compareTo( new DefaultArtifactVersion( "1.0-alpha1" ) ) > 0 );
}
+ @Test
public void testCache()
throws InvalidVersionSpecificationException
{
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemCollectorTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemCollectorTest.java
index 57ddcfa..0e5b20f 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemCollectorTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemCollectorTest.java
@@ -19,11 +19,12 @@ package org.apache.maven.building;
* under the License.
*/
-import static org.junit.Assert.*;
-
import org.apache.maven.building.Problem.Severity;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
public class DefaultProblemCollectorTest
{
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemTest.java
index 1615fc3..d67128e 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/DefaultProblemTest.java
@@ -19,12 +19,12 @@ package org.apache.maven.building;
* under the License.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-
import org.apache.maven.building.Problem.Severity;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
public class DefaultProblemTest
{
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/FileSourceTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/FileSourceTest.java
index 40ab495..40e4808 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/FileSourceTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/FileSourceTest.java
@@ -19,12 +19,12 @@ package org.apache.maven.building;
* under the License.
*/
-import org.junit.Test;
-
import java.io.File;
import java.io.InputStream;
import java.util.Scanner;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/ProblemCollectorFactoryTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/ProblemCollectorFactoryTest.java
index 2fdcbb7..2ca0b37 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/ProblemCollectorFactoryTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/ProblemCollectorFactoryTest.java
@@ -19,13 +19,13 @@ package org.apache.maven.building;
* under the License.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-
import java.util.Collections;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
+
public class ProblemCollectorFactoryTest
{
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/StringSourceTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/StringSourceTest.java
index 6d9a671..0c8531a 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/StringSourceTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/StringSourceTest.java
@@ -19,11 +19,11 @@ package org.apache.maven.building;
* under the License.
*/
-import org.junit.Test;
-
import java.io.InputStream;
import java.util.Scanner;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
public class StringSourceTest
diff --git a/maven-builder-support/src/test/java/org/apache/maven/building/UrlSourceTest.java b/maven-builder-support/src/test/java/org/apache/maven/building/UrlSourceTest.java
index 00f3a68..fab547a 100644
--- a/maven-builder-support/src/test/java/org/apache/maven/building/UrlSourceTest.java
+++ b/maven-builder-support/src/test/java/org/apache/maven/building/UrlSourceTest.java
@@ -19,13 +19,13 @@ package org.apache.maven.building;
* under the License.
*/
-import org.junit.Test;
-
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
diff --git a/maven-compat/src/test/java/org/apache/maven/PlexusTestCase.java b/maven-compat/src/test/java/org/apache/maven/PlexusTestCase.java
new file mode 100644
index 0000000..d3801b8
--- /dev/null
+++ b/maven-compat/src/test/java/org/apache/maven/PlexusTestCase.java
@@ -0,0 +1,317 @@
+package org.apache.maven;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Copyright 2001-2006 Codehaus Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.DefaultContext;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * This is a slightly modified version of the original plexus class
+ * available at https://raw.githubusercontent.com/codehaus-plexus/plexus-containers/master/plexus-container-default/src/main/java/org/codehaus/plexus/PlexusTestCase.java
+ * in order to migrate the tests to JUnit 4.
+ *
+ * @author Jason van Zyl
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
+ * @author Guillaume Nodet
+ */
+public abstract class PlexusTestCase
+{
+ private PlexusContainer container;
+
+ private static String basedir;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ basedir = getBasedir();
+ }
+
+ @SuppressWarnings("ResultOfMethodCallIgnored")
+ protected void setupContainer()
+ {
+ // ----------------------------------------------------------------------------
+ // Context Setup
+ // ----------------------------------------------------------------------------
+
+ DefaultContext context = new DefaultContext();
+
+ context.put( "basedir", getBasedir() );
+
+ customizeContext( context );
+
+ boolean hasPlexusHome = context.contains( "plexus.home" );
+
+ if ( !hasPlexusHome )
+ {
+ File f = getTestFile( "target/plexus-home" );
+
+ if ( !f.isDirectory() )
+ {
+ f.mkdir();
+ }
+
+ context.put( "plexus.home", f.getAbsolutePath() );
+ }
+
+ // ----------------------------------------------------------------------------
+ // Configuration
+ // ----------------------------------------------------------------------------
+
+ String config = getCustomConfigurationName();
+
+ ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration()
+ .setName( "test" )
+ .setContext( context.getContextData() );
+
+ if ( config != null )
+ {
+ containerConfiguration.setContainerConfiguration( config );
+ }
+ else
+ {
+ String resource = getConfigurationName( null );
+
+ containerConfiguration.setContainerConfiguration( resource );
+ }
+
+ customizeContainerConfiguration( containerConfiguration );
+
+ try
+ {
+ container = new DefaultPlexusContainer( containerConfiguration );
+ }
+ catch ( PlexusContainerException e )
+ {
+ throw new IllegalArgumentException( "Failed to create plexus container.", e );
+ }
+ }
+
+ /**
+ * Allow custom test case implementations do augment the default container configuration before
+ * executing tests.
+ *
+ * @param containerConfiguration {@link ContainerConfiguration}.
+ */
+ protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
+ {
+ }
+
+ protected void customizeContext( Context context )
+ {
+ }
+
+ protected PlexusConfiguration customizeComponentConfiguration()
+ {
+ return null;
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ if ( container != null )
+ {
+ container.dispose();
+
+ container = null;
+ }
+ }
+
+ protected PlexusContainer getContainer()
+ {
+ if ( container == null )
+ {
+ setupContainer();
+ }
+
+ return container;
+ }
+
+ protected InputStream getConfiguration()
+ throws Exception
+ {
+ return getConfiguration( null );
+ }
+
+ protected InputStream getConfiguration( String subname )
+ throws Exception
+ {
+ return getResourceAsStream( getConfigurationName( subname ) );
+ }
+
+ protected String getCustomConfigurationName()
+ {
+ return null;
+ }
+
+ /**
+ * Allow the retrieval of a container configuration that is based on the name
+ * of the test class being run. So if you have a test class called org.foo.FunTest, then
+ * this will produce a resource name of org/foo/FunTest.xml which would be used to
+ * configure the Plexus container before running your test.
+ *
+ * @param subname the subname
+ * @return A configruation name
+ */
+ protected String getConfigurationName( String subname )
+ {
+ return getClass().getName().replace( '.', '/' ) + ".xml";
+ }
+
+ protected InputStream getResourceAsStream( String resource )
+ {
+ return getClass().getResourceAsStream( resource );
+ }
+
+ protected ClassLoader getClassLoader()
+ {
+ return getClass().getClassLoader();
+ }
+
+ // ----------------------------------------------------------------------
+ // Container access
+ // ----------------------------------------------------------------------
+
+ @SuppressWarnings("unchecked")
+ protected <T> T lookup( String componentKey )
+ throws ComponentLookupException
+ {
+ return (T) getContainer().lookup( componentKey );
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T lookup( String role,
+ String roleHint )
+ throws ComponentLookupException
+ {
+ return (T) getContainer().lookup( role, roleHint );
+ }
+
+ protected <T> T lookup( Class<T> componentClass )
+ throws ComponentLookupException
+ {
+ return getContainer().lookup( componentClass );
+ }
+
+ protected <T> T lookup( Class<T> componentClass, String roleHint )
+ throws ComponentLookupException
+ {
+ return getContainer().lookup( componentClass, roleHint );
+ }
+
+ protected void release( Object component )
+ throws ComponentLifecycleException
+ {
+ getContainer().release( component );
+ }
+
+ // ----------------------------------------------------------------------
+ // Helper methods for sub classes
+ // ----------------------------------------------------------------------
+
+ public static File getTestFile( String path )
+ {
+ return new File( getBasedir(), path );
+ }
+
+ public static File getTestFile( String basedir,
+ String path )
+ {
+ File basedirFile = new File( basedir );
+
+ if ( !basedirFile.isAbsolute() )
+ {
+ basedirFile = getTestFile( basedir );
+ }
+
+ return new File( basedirFile, path );
+ }
+
+ public static String getTestPath( String path )
+ {
+ return getTestFile( path ).getAbsolutePath();
+ }
+
+ public static String getTestPath( String basedir,
+ String path )
+ {
+ return getTestFile( basedir, path ).getAbsolutePath();
+ }
+
+ public static String getBasedir()
+ {
+ if ( basedir != null )
+ {
+ return basedir;
+ }
+
+ basedir = System.getProperty( "basedir" );
+
+ if ( basedir == null )
+ {
+ basedir = new File( "" ).getAbsolutePath();
+ }
+
+ return basedir;
+ }
+
+ public String getTestConfiguration()
+ {
+ return getTestConfiguration( getClass() );
+ }
+
+ public static String getTestConfiguration( Class<?> clazz )
+ {
+ String s = clazz.getName().replace( '.', '/' );
+
+ return s.substring( 0, s.indexOf( "$" ) ) + ".xml";
+ }
+}
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
index 3c0ce13..6c4540c 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/AbstractArtifactComponentTestCase.java
@@ -19,6 +19,20 @@ package org.apache.maven.artifact;
* under the License.
*/
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.inject.Inject;
+
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
@@ -31,7 +45,6 @@ import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.collection.DependencyGraphTransformer;
@@ -54,18 +67,10 @@ import org.eclipse.aether.util.graph.transformer.NearestVersionSelector;
import org.eclipse.aether.util.graph.transformer.SimpleOptionalitySelector;
import org.eclipse.aether.util.graph.traverser.FatArtifactTraverser;
import org.eclipse.aether.util.repository.SimpleArtifactDescriptorPolicy;
+import org.junit.After;
+import org.junit.Before;
-import javax.inject.Inject;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
+import static org.junit.Assert.fail;
/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
@@ -90,8 +95,8 @@ public abstract class AbstractArtifactComponentTestCase
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
@@ -107,8 +112,9 @@ public abstract class AbstractArtifactComponentTestCase
legacySupport.setSession( session );
}
+ @After
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
release( artifactFactory );
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java
index 30b1ab3..6295a22 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/deployer/ArtifactDeployerTest.java
@@ -25,6 +25,11 @@ import org.apache.maven.artifact.AbstractArtifactComponentTestCase;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -37,11 +42,22 @@ public class ArtifactDeployerTest
@Inject
private ArtifactDeployer artifactDeployer;
+ @Before
+ @Override
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ artifactDeployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE );
+ }
+
protected String component()
{
return "deployer";
}
+ @Test
public void testArtifactInstallation()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
index cee9f5a..f9de70c 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/factory/DefaultArtifactFactoryTest.java
@@ -19,19 +19,19 @@ package org.apache.maven.artifact.factory;
* under the License.
*/
+import java.util.Collections;
+
+import javax.inject.Inject;
+
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.DefaultMavenExecutionResult;
-import org.apache.maven.execution.MavenSession;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-import org.eclipse.aether.RepositorySystemSession;
+import org.junit.Test;
-import javax.inject.Inject;
-import java.util.Collections;
+import static org.junit.Assert.assertEquals;
public class DefaultArtifactFactoryTest
extends PlexusTestCase
@@ -49,7 +49,7 @@ public class DefaultArtifactFactoryTest
}
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -59,6 +59,7 @@ public class DefaultArtifactFactoryTest
binder -> binder.requestInjection( this ) );
}
+ @Test
public void testPropagationOfSystemScopeRegardlessOfInheritedScope()
{
Artifact artifact = factory.createDependencyArtifact( "test-grp", "test-artifact", VersionRange.createFromVersion("1.0"), "type", null, "system", "provided" );
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java
index df519b3..3e22ffd 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/installer/ArtifactInstallerTest.java
@@ -23,6 +23,8 @@ import java.io.File;
import org.apache.maven.artifact.AbstractArtifactComponentTestCase;
import org.apache.maven.artifact.Artifact;
+import org.junit.Before;
+import org.junit.Test;
import javax.inject.Inject;
@@ -35,11 +37,22 @@ public class ArtifactInstallerTest
@Inject
private ArtifactInstaller artifactInstaller;
+ @Before
+ @Override
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+
+ artifactInstaller = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
+ }
+
protected String component()
{
return "installer";
}
+ @Test
public void testArtifactInstallation()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java
index 533f304..686b22e 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/repository/MavenArtifactRepositoryTest.java
@@ -20,10 +20,12 @@ package org.apache.maven.artifact.repository;
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
public class MavenArtifactRepositoryTest
- extends TestCase
{
private static class MavenArtifactRepositorySubclass extends MavenArtifactRepository
{
@@ -41,6 +43,7 @@ public class MavenArtifactRepositoryTest
}
}
+ @Test
public void testHashCodeEquals()
{
MavenArtifactRepositorySubclass r1 = new MavenArtifactRepositorySubclass( "foo" );
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
index 8b75149..f86751b 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolutionExceptionTest.java
@@ -22,7 +22,9 @@ package org.apache.maven.artifact.resolver;
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* Test the artifact resolution exception message
@@ -30,10 +32,10 @@ import junit.framework.TestCase;
* @author Mauro Talevi
*/
public class ArtifactResolutionExceptionTest
- extends TestCase
{
private static final String LS = System.lineSeparator();
+ @Test
public void testMissingArtifactMessageFormat()
{
String message = "Missing artifact";
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
index 00c1344..68cb8d8 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/ArtifactResolverTest.java
@@ -35,6 +35,13 @@ import org.apache.maven.artifact.metadata.ResolutionGroup;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.inject.Inject;
@@ -55,8 +62,9 @@ public class ArtifactResolverTest
private Artifact projectArtifact;
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -64,8 +72,9 @@ public class ArtifactResolverTest
projectArtifact = createLocalArtifact( "project", "3.0" );
}
+ @After
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
projectArtifact = null;
@@ -78,6 +87,7 @@ public class ArtifactResolverTest
return "resolver";
}
+ @Test
public void testResolutionOfASingleArtifactWhereTheArtifactIsPresentInTheLocalRepository()
throws Exception
{
@@ -88,6 +98,7 @@ public class ArtifactResolverTest
assertLocalArtifactPresent( a );
}
+ @Test
public void testResolutionOfASingleArtifactWhereTheArtifactIsNotPresentLocallyAndMustBeRetrievedFromTheRemoteRepository()
throws Exception
{
@@ -105,6 +116,7 @@ public class ArtifactResolverTest
return super.createArtifact( groupId, artifactId, version, type );
}
+ @Test
public void testTransitiveResolutionWhereAllArtifactsArePresentInTheLocalRepository()
throws Exception
{
@@ -127,6 +139,7 @@ public class ArtifactResolverTest
assertLocalArtifactPresent( h );
}
+ @Test
public void testTransitiveResolutionWhereAllArtifactsAreNotPresentInTheLocalRepositoryAndMustBeRetrievedFromTheRemoteRepository()
throws Exception
{
@@ -151,6 +164,7 @@ public class ArtifactResolverTest
assertLocalArtifactPresent( j );
}
+ @Test
public void testResolutionFailureWhenArtifactNotPresentInRemoteRepository()
throws Exception
{
@@ -167,6 +181,7 @@ public class ArtifactResolverTest
}
}
+ @Test
public void testResolutionOfAnArtifactWhereOneRemoteRepositoryIsBadButOneIsGood()
throws Exception
{
@@ -182,6 +197,7 @@ public class ArtifactResolverTest
assertLocalArtifactPresent( l );
}
+ @Test
public void testTransitiveResolutionOrder()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java
index 9e221ee..6e4926b 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactResolverTest.java
@@ -24,6 +24,11 @@ import java.util.Collections;
import org.apache.maven.artifact.AbstractArtifactComponentTestCase;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.DefaultArtifactResolver.DaemonThreadCreator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -35,16 +40,18 @@ public class DefaultArtifactResolverTest
private Artifact projectArtifact;
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
projectArtifact = createLocalArtifact( "project", "3.0" );
}
+ @After
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
projectArtifact = null;
@@ -57,6 +64,7 @@ public class DefaultArtifactResolverTest
return "resolver";
}
+ @Test
public void testMNG4738()
throws Exception
{
@@ -102,6 +110,7 @@ public class DefaultArtifactResolverTest
assertTrue( "Could not find ThreadGroup: " + DaemonThreadCreator.THREADGROUP_NAME, seen );
}
+ @Test
public void testLookup()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java
index 50517f4..1c42a2e 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/AndArtifactFilterTest.java
@@ -21,7 +21,11 @@ package org.apache.maven.artifact.resolver.filter;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@link AndArtifactFilter}.
@@ -29,7 +33,6 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class AndArtifactFilterTest
- extends TestCase
{
private ArtifactFilter newSubFilter()
@@ -37,6 +40,7 @@ public class AndArtifactFilterTest
return artifact -> false;
}
+ @Test
public void testEquals()
{
AndArtifactFilter filter1 = new AndArtifactFilter();
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java
index fb46566..e33a1e4 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/FilterHashEqualsTest.java
@@ -22,15 +22,17 @@ package org.apache.maven.artifact.resolver.filter;
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
/**
* @author Igor Fedorenko
*/
public class FilterHashEqualsTest
- extends TestCase
{
+ @Test
public void testIncludesExcludesArtifactFilter()
{
List<String> patterns = Arrays.asList( "c", "d", "e" );
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java
index 5971cc3..85488ee 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/OrArtifactFilterTest.java
@@ -21,7 +21,11 @@ package org.apache.maven.artifact.resolver.filter;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@link OrArtifactFilter}.
@@ -29,7 +33,6 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class OrArtifactFilterTest
- extends TestCase
{
private ArtifactFilter newSubFilter()
@@ -37,6 +40,7 @@ public class OrArtifactFilterTest
return artifact -> false;
}
+ @Test
public void testEquals()
{
OrArtifactFilter filter1 = new OrArtifactFilter();
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java
index 1a65eca..985f90b 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/resolver/filter/ScopeArtifactFilterTest.java
@@ -21,8 +21,10 @@ package org.apache.maven.artifact.resolver.filter;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@link ScopeArtifactFilter}.
@@ -30,7 +32,6 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ScopeArtifactFilterTest
- extends TestCase
{
private Artifact newArtifact( String scope )
@@ -38,6 +39,7 @@ public class ScopeArtifactFilterTest
return new DefaultArtifact( "g", "a", "1.0", scope, "jar", "", null );
}
+ @Test
public void testInclude_Compile()
{
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE );
@@ -49,6 +51,7 @@ public class ScopeArtifactFilterTest
assertFalse( filter.include( newArtifact( Artifact.SCOPE_TEST ) ) );
}
+ @Test
public void testInclude_CompilePlusRuntime()
{
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_COMPILE_PLUS_RUNTIME );
@@ -60,6 +63,7 @@ public class ScopeArtifactFilterTest
assertFalse( filter.include( newArtifact( Artifact.SCOPE_TEST ) ) );
}
+ @Test
public void testInclude_Runtime()
{
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME );
@@ -71,6 +75,7 @@ public class ScopeArtifactFilterTest
assertFalse( filter.include( newArtifact( Artifact.SCOPE_TEST ) ) );
}
+ @Test
public void testInclude_RuntimePlusSystem()
{
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_RUNTIME_PLUS_SYSTEM );
@@ -82,6 +87,7 @@ public class ScopeArtifactFilterTest
assertFalse( filter.include( newArtifact( Artifact.SCOPE_TEST ) ) );
}
+ @Test
public void testInclude_Test()
{
ScopeArtifactFilter filter = new ScopeArtifactFilter( Artifact.SCOPE_TEST );
diff --git a/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java b/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java
index ff0d3bb..887ae05 100644
--- a/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/artifact/transform/TransformationManagerTest.java
@@ -26,7 +26,11 @@ import org.apache.maven.repository.legacy.resolver.transform.SnapshotTransformat
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -46,7 +50,7 @@ public class TransformationManagerTest
}
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -56,6 +60,7 @@ public class TransformationManagerTest
binder -> binder.requestInjection( this ) );
}
+ @Test
public void testTransformationManager()
{
List<ArtifactTransformation> tms = tm.getArtifactTransformations();
diff --git a/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java b/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java
index 6b8caab..3951ccf 100644
--- a/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/profiles/manager/DefaultProfileManagerTest.java
@@ -19,23 +19,21 @@ package org.apache.maven.profiles.manager;
* under the License.
*/
-import java.util.Collections;
import java.util.List;
import java.util.Properties;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.DefaultMavenExecutionResult;
-import org.apache.maven.execution.MavenSession;
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationProperty;
import org.apache.maven.model.Profile;
import org.apache.maven.profiles.DefaultProfileManager;
import org.apache.maven.profiles.ProfileManager;
import org.codehaus.plexus.ContainerConfiguration;
-import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
-import org.eclipse.aether.RepositorySystemSession;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
public class DefaultProfileManagerTest
extends PlexusTestCase
@@ -49,6 +47,7 @@ public class DefaultProfileManagerTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Test
public void testShouldActivateDefaultProfile()
throws Exception
{
@@ -84,6 +83,7 @@ public class DefaultProfileManagerTest
assertEquals( "defaultActivated", ( (Profile) active.get( 0 ) ).getId() );
}
+ @Test
public void testShouldNotActivateDefaultProfile()
throws Exception
{
@@ -123,6 +123,7 @@ public class DefaultProfileManagerTest
}
+ @Test
public void testShouldNotActivateReversalOfPresentSystemProperty()
throws Exception
{
@@ -150,6 +151,7 @@ public class DefaultProfileManagerTest
assertEquals( 0, active.size() );
}
+ @Test
public void testShouldOverrideAndActivateInactiveProfile()
throws Exception
{
@@ -180,6 +182,7 @@ public class DefaultProfileManagerTest
assertEquals( "syspropActivated", ( (Profile) active.get( 0 ) ).getId() );
}
+ @Test
public void testShouldOverrideAndDeactivateActiveProfile()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
index d05aa8f..002ae55 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
@@ -23,11 +23,11 @@ import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
+import javax.inject.Inject;
+
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.execution.DefaultMavenExecutionRequest;
-import org.apache.maven.execution.DefaultMavenExecutionResult;
-import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.building.ModelBuildingException;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.repository.RepositorySystem;
@@ -35,11 +35,11 @@ import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
-import org.eclipse.aether.RepositorySystemSession;
+import org.junit.After;
+import org.junit.Before;
-import javax.inject.Inject;
+import static org.junit.Assert.fail;
/**
* @author Jason van Zyl
@@ -61,8 +61,9 @@ public abstract class AbstractMavenProjectTestCase
}
@Override
- protected void setUp()
- throws Exception
+ @Before
+ public void setUp()
+ throws Exception
{
super.setUp();
@@ -81,8 +82,8 @@ public abstract class AbstractMavenProjectTestCase
}
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
projectBuilder = null;
diff --git a/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java b/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java
index 402ae74..d67259c 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/ModelUtilsTest.java
@@ -26,8 +26,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-import junit.framework.TestCase;
-
import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Plugin;
@@ -36,11 +34,17 @@ import org.apache.maven.model.PluginExecution;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
public class ModelUtilsTest
- extends TestCase
{
+ @Test
public void testShouldUseMainPluginDependencyVersionOverManagedDepVersion()
{
Plugin mgtPlugin = createPlugin( "group", "artifact", "1", Collections.EMPTY_MAP );
@@ -68,6 +72,7 @@ public class ModelUtilsTest
return dep;
}
+ @Test
public void testShouldNotInheritPluginWithInheritanceSetToFalse()
{
PluginContainer parent = new PluginContainer();
@@ -108,6 +113,7 @@ public class ModelUtilsTest
* X -> Y -> A -> B -> C -> D -> E -> F
* </pre>
*/
+ @Test
public void testShouldPreserveChildOrderingOfPluginsAfterParentMerge()
{
PluginContainer parent = new PluginContainer();
@@ -176,6 +182,7 @@ public class ModelUtilsTest
return plugin;
}
+ @Test
public void testShouldInheritOnePluginWithExecution()
{
Plugin parent = new Plugin();
@@ -198,6 +205,7 @@ public class ModelUtilsTest
assertEquals( 1, child.getExecutions().size() );
}
+ @Test
public void testShouldMergeInheritedPluginHavingExecutionWithLocalPlugin()
{
Plugin parent = new Plugin();
@@ -225,6 +233,7 @@ public class ModelUtilsTest
assertEquals( 2, child.getExecutions().size() );
}
+ @Test
public void testShouldMergeOnePluginWithInheritExecutionWithoutDuplicatingPluginInList()
{
Plugin parent = new Plugin();
@@ -259,6 +268,7 @@ public class ModelUtilsTest
assertEquals( 1, plugin.getExecutions().size() );
}
+ @Test
public void testShouldMergePluginWithDifferentExecutionFromParentWithoutDuplicatingPluginInList()
{
Plugin parent = new Plugin();
@@ -299,6 +309,7 @@ public class ModelUtilsTest
assertEquals( 2, plugin.getExecutions().size() );
}
+ @Test
public void testShouldNOTMergeInheritedPluginHavingInheritEqualFalse()
{
Plugin parent = new Plugin();
@@ -326,6 +337,7 @@ public class ModelUtilsTest
* Verifies MNG-1499: The order of the merged list should be the plugins specified by the parent followed by the
* child list.
*/
+ @Test
public void testShouldKeepOriginalPluginOrdering()
{
Plugin parentPlugin1 = new Plugin();
@@ -390,6 +402,7 @@ public class ModelUtilsTest
/**
* Verifies MNG-1499: The ordering of plugin executions should also be in the specified order.
*/
+ @Test
public void testShouldKeepOriginalPluginExecutionOrdering()
{
Plugin parent = new Plugin();
@@ -439,6 +452,7 @@ public class ModelUtilsTest
assertEquals( dep.getManagementKey(), dep2.getManagementKey() );
}
+ @Test
public void testShouldOverwritePluginConfigurationSubItemsByDefault()
throws XmlPullParserException, IOException
{
@@ -465,6 +479,7 @@ public class ModelUtilsTest
assertEquals( "three", item.getValue() );
}
+ @Test
public void testShouldMergePluginConfigurationSubItemsWithMergeAttributeSet()
throws XmlPullParserException, IOException
{
@@ -496,6 +511,7 @@ public class ModelUtilsTest
assertEquals( expected, actual );
}
+ @Test
public void testShouldNotMergePluginExecutionWhenExecInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
@@ -536,6 +552,7 @@ public class ModelUtilsTest
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
+ @Test
public void testShouldNotMergePluginExecutionWhenPluginInheritedIsFalseAndTreatAsInheritanceIsTrue()
{
String gid = "group";
@@ -576,6 +593,7 @@ public class ModelUtilsTest
assertNull( "test execution should not be inherited from parent.", executionMap.get( testId ) );
}
+ @Test
public void testShouldMergePluginExecutionWhenExecInheritedIsTrueAndTreatAsInheritanceIsTrue()
{
String gid = "group";
diff --git a/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java b/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
index 96f1fea..a056522 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/ProjectClasspathTest.java
@@ -34,6 +34,11 @@ import org.codehaus.plexus.PlexusConstants;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.impl.ArtifactDescriptorReader;
import org.eclipse.aether.impl.ArtifactResolver;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
public class ProjectClasspathTest
extends AbstractMavenProjectTestCase
@@ -71,6 +76,7 @@ public class ProjectClasspathTest
return null;
}
+ @Test
public void testProjectClasspath()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java
index 98da0f5..19c67a4 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t00/ProjectInheritanceTest.java
@@ -21,6 +21,9 @@ package org.apache.maven.project.inheritance.t00;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* A test which demonstrates maven's recursive inheritance where
@@ -50,6 +53,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testProjectInheritance()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java
index 1aa749b..fe4f052 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t01/ProjectInheritanceTest.java
@@ -21,6 +21,9 @@ package org.apache.maven.project.inheritance.t01;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* A test which demonstrates maven's recursive inheritance where
@@ -46,6 +49,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testProjectInheritance()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java
index 2b78343..485e5f0 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t02/ProjectInheritanceTest.java
@@ -28,6 +28,10 @@ import org.apache.maven.model.Build;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
/**
* A test which demonstrates maven's recursive inheritance where
@@ -57,6 +61,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testProjectInheritance()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java
index edb6107..82eaa28 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t03/ProjectInheritanceTest.java
@@ -23,6 +23,9 @@ import java.io.File;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* A test which demonstrates maven's recursive inheritance where
@@ -49,6 +52,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testProjectInheritance()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
index ab775ec..8cedce7 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t04/ProjectInheritanceTest.java
@@ -25,6 +25,11 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Verifies the version of a dependency listed in a parent's
@@ -51,6 +56,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagementOverridesTransitiveDependencyVersion()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
index 1517157..d8d8f22 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t05/ProjectInheritanceTest.java
@@ -25,6 +25,11 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* A test which demonstrates maven's dependency management
@@ -45,6 +50,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagement()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
index 60e3771..f1c61b4 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t06/ProjectInheritanceTest.java
@@ -26,6 +26,11 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* A test which demonstrates maven's dependency management
@@ -46,6 +51,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagement()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java
index b9685e3..1821fa1 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t07/ProjectInheritanceTest.java
@@ -25,6 +25,12 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* A test which demonstrates maven's dependency management
@@ -45,6 +51,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagement()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
index b0a7873..9057752 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t08/ProjectInheritanceTest.java
@@ -26,6 +26,11 @@ import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* A test which demonstrates maven's dependency management
@@ -46,6 +51,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagement()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java
index 29cd2ea..bd1a5d3 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t09/ProjectInheritanceTest.java
@@ -23,6 +23,12 @@ import java.util.Map;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Verifies exclusions listed in dependencyManagement are valid for
@@ -56,6 +62,7 @@ public class ProjectInheritanceTest
* We should see that the resulting size of collected artifacts is two:
* a & b only.
*/
+ @Test
public void testDependencyManagementExclusionsExcludeTransitively()
throws Exception
{
@@ -92,6 +99,7 @@ public class ProjectInheritanceTest
*
* @throws Exception
*/
+ @Test
public void testDependencyManagementExclusionDoesNotOverrideGloballyForTransitives()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java
index b24f70f..02bf015 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t10/ProjectInheritanceTest.java
@@ -25,6 +25,11 @@ import java.util.Map;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Verifies scope inheritance of direct and transitive dependencies.
@@ -52,6 +57,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagementOverridesTransitiveDependencyVersion()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
index d8a3926..4d7fa51 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t11/ProjectInheritanceTest.java
@@ -23,6 +23,10 @@ import java.io.File;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
/**
* Verifies scope of root project is preserved regardless of parent dependency management.
@@ -44,6 +48,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testDependencyManagementDoesNotOverrideScopeOfCurrentArtifact()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java
index 814e487..b872930 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12/ProjectInheritanceTest.java
@@ -25,6 +25,10 @@ import java.util.Map;
import org.apache.maven.model.Plugin;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
/**
* Verifies that plugin execution sections in the parent POM that have
@@ -43,6 +47,7 @@ public class ProjectInheritanceTest extends AbstractProjectInheritanceTestCase
//
// ----------------------------------------------------------------------
+ @Test
public void testFalsePluginExecutionInheritValue() throws Exception
{
File localRepo = getLocalRepositoryPath();
diff --git a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java
index 7627c13..0097961 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/inheritance/t12scm/ProjectInheritanceTest.java
@@ -23,6 +23,9 @@ import java.io.File;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.inheritance.AbstractProjectInheritanceTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* Verifies SCM inheritance uses modules statement from parent.
@@ -43,6 +46,7 @@ public class ProjectInheritanceTest
//
// ----------------------------------------------------------------------
+ @Test
public void testScmInfoCalculatedCorrectlyOnParentAndChildRead()
throws Exception
{
@@ -76,6 +80,7 @@ public class ProjectInheritanceTest
+ "/modules/p1" );
}
+ @Test
public void testScmInfoCalculatedCorrectlyOnChildOnlyRead()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java b/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java
index b19ef99..4705568 100644
--- a/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/project/path/DefaultPathTranslatorTest.java
@@ -21,13 +21,14 @@ package org.apache.maven.project.path;
import java.io.File;
-import junit.framework.TestCase;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
@SuppressWarnings( "deprecation" )
public class DefaultPathTranslatorTest
- extends TestCase
{
+ @Test
public void testAlignToBasedirWhereBasedirExpressionIsTheCompleteValue()
{
File basedir = new File( System.getProperty( "java.io.tmpdir" ), "test" ).getAbsoluteFile();
@@ -37,6 +38,7 @@ public class DefaultPathTranslatorTest
assertEquals( basedir.getAbsolutePath(), aligned );
}
+ @Test
public void testAlignToBasedirWhereBasedirExpressionIsTheValuePrefix()
{
File basedir = new File( System.getProperty( "java.io.tmpdir" ), "test" ).getAbsoluteFile();
@@ -46,6 +48,7 @@ public class DefaultPathTranslatorTest
assertEquals( new File( basedir, "dir" ).getAbsolutePath(), aligned );
}
+ @Test
public void testUnalignToBasedirWherePathEqualsBasedir()
{
File basedir = new File( System.getProperty( "java.io.tmpdir" ), "test" ).getAbsoluteFile();
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java b/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
index 65dbd89..b346e5e 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/LegacyRepositorySystemTest.java
@@ -32,16 +32,21 @@ import org.apache.maven.model.Dependency;
import org.apache.maven.model.Repository;
import org.apache.maven.model.RepositoryPolicy;
import org.apache.maven.plugin.LegacySupport;
-import org.apache.maven.project.ProjectBuilder;
-import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.legacy.LegacyRepositorySystem;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -66,8 +71,9 @@ public class LegacyRepositorySystemTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -77,6 +83,16 @@ public class LegacyRepositorySystemTest
binder -> binder.requestInjection( this ) );
}
+ @After
+ @Override
+ public void tearDown()
+ throws Exception
+ {
+ repositorySystem = null;
+ resolutionErrorHandler = null;
+ super.tearDown();
+ }
+
protected List<ArtifactRepository> getRemoteRepositories()
throws Exception
{
@@ -104,6 +120,7 @@ public class LegacyRepositorySystemTest
return repositorySystem.createLocalRepository( repoDir );
}
+ @Test
public void testThatASystemScopedDependencyIsNotResolvedFromRepositories()
throws Exception
{
@@ -186,6 +203,7 @@ public class LegacyRepositorySystemTest
}
}
+ @Test
public void testLocalRepositoryBasedir()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
index 8492f7b..1c40aea 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/MirrorProcessorTest.java
@@ -23,14 +23,22 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
+import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
import org.apache.maven.settings.Mirror;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -50,9 +58,19 @@ public class MirrorProcessorTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+ mirrorSelector = (DefaultMirrorSelector) lookup( MirrorSelector.class );
+ repositorySystem = lookup( ArtifactRepositoryFactory.class );
+ }
+
+ @After
@Override
- protected void setUp()
- throws Exception
+ public void tearDown()
+ throws Exception
{
super.setUp();
@@ -61,6 +79,7 @@ public class MirrorProcessorTest
binder -> binder.requestInjection( this ) );
}
+ @Test
public void testExternalURL()
{
assertTrue( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "http://somehost" ) ) );
@@ -83,6 +102,7 @@ public class MirrorProcessorTest
assertFalse( DefaultMirrorSelector.isExternalRepo( getRepo( "foo", "" ) ) );
}
+ @Test
public void testMirrorLookup()
{
Mirror mirrorA = newMirror( "a", "a", "http://a" );
@@ -97,6 +117,7 @@ public class MirrorProcessorTest
assertNull( mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
}
+ @Test
public void testMirrorWildcardLookup()
{
Mirror mirrorA = newMirror( "a", "a", "http://a" );
@@ -112,6 +133,7 @@ public class MirrorProcessorTest
assertSame( mirrorC, mirrorSelector.getMirror( getRepo( "c", "http://c.c" ), mirrors ) );
}
+ @Test
public void testMirrorStopOnFirstMatch()
{
// exact matches win first
@@ -140,6 +162,7 @@ public class MirrorProcessorTest
assertSame( mirrorC2, mirrorSelector.getMirror( getRepo( "f", "http://f" ), mirrors ) );
}
+ @Test
public void testPatterns()
{
assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a" ), "*" ) );
@@ -176,6 +199,7 @@ public class MirrorProcessorTest
assertFalse( DefaultMirrorSelector.matchPattern( getRepo( "d" ), "!a,!c*" ) );
}
+ @Test
public void testPatternsWithExternal()
{
assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "a", "http://localhost" ), "*" ) );
@@ -190,6 +214,7 @@ public class MirrorProcessorTest
assertTrue( DefaultMirrorSelector.matchPattern( getRepo( "c", "http://somehost" ), "!a,external:*" ) );
}
+ @Test
public void testLayoutPattern()
{
assertTrue( DefaultMirrorSelector.matchesLayout( "default", null ) );
@@ -209,6 +234,7 @@ public class MirrorProcessorTest
assertFalse( DefaultMirrorSelector.matchesLayout( "default", "!default,*" ) );
}
+ @Test
public void testMirrorLayoutConsideredForMatching()
{
ArtifactRepository repo = getRepo( "a" );
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java
index 1c5f34c..4f1bede 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultUpdateCheckManagerTest.java
@@ -27,9 +27,16 @@ import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
-import org.apache.maven.repository.legacy.DefaultUpdateCheckManager;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.logging.console.ConsoleLogger;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
public class DefaultUpdateCheckManagerTest
extends AbstractArtifactComponentTestCase
@@ -43,8 +50,9 @@ public class DefaultUpdateCheckManagerTest
return "updateCheckManager";
}
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -52,6 +60,7 @@ public class DefaultUpdateCheckManagerTest
updateCheckManager = new DefaultUpdateCheckManager( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
}
+ @Test
public void testArtifact() throws Exception
{
ArtifactRepository remoteRepository = remoteRepository();
@@ -81,6 +90,7 @@ public class DefaultUpdateCheckManagerTest
assertFalse( updateCheckManager.getTouchfile( a ).exists() );
}
+ @Test
public void testMissingArtifact()
throws Exception
{
@@ -108,6 +118,7 @@ public class DefaultUpdateCheckManagerTest
updateCheckManager.getRepositoryKey( remoteRepository ) ) );
}
+ @Test
public void testPom() throws Exception
{
ArtifactRepository remoteRepository = remoteRepository();
@@ -137,6 +148,7 @@ public class DefaultUpdateCheckManagerTest
assertFalse( updateCheckManager.getTouchfile( a ).exists() );
}
+ @Test
public void testMissingPom()
throws Exception
{
@@ -164,6 +176,7 @@ public class DefaultUpdateCheckManagerTest
updateCheckManager.getRepositoryKey( remoteRepository ) ) );
}
+ @Test
public void testMetadata() throws Exception
{
ArtifactRepository remoteRepository = remoteRepository();
@@ -191,6 +204,7 @@ public class DefaultUpdateCheckManagerTest
assertNotNull( updateCheckManager.readLastUpdated( touchFile, updateCheckManager.getMetadataKey( remoteRepository, file ) ) );
}
+ @Test
public void testMissingMetadata() throws Exception
{
ArtifactRepository remoteRepository = remoteRepository();
@@ -216,6 +230,7 @@ public class DefaultUpdateCheckManagerTest
assertNotNull( updateCheckManager.readLastUpdated( touchFile, updateCheckManager.getMetadataKey( remoteRepository, file ) ) );
}
+ @Test
public void testArtifactTouchFileName() throws Exception
{
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
index 9ddbe32..fb8c2ca 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/DefaultWagonManagerTest.java
@@ -30,16 +30,15 @@ import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.repository.legacy.repository.ArtifactRepositoryFactory;
import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.UnsupportedProtocolException;
import org.apache.maven.wagon.Wagon;
-import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.events.TransferEvent;
import org.apache.maven.wagon.events.TransferListener;
import org.apache.maven.wagon.observers.AbstractTransferListener;
@@ -47,8 +46,18 @@ import org.apache.maven.wagon.observers.Debug;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.inject.Inject;
@@ -77,8 +86,9 @@ public class DefaultWagonManagerTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -88,6 +98,17 @@ public class DefaultWagonManagerTest
binder -> binder.requestInjection( this ) );
}
+ @After
+ @Override
+ public void tearDown()
+ throws Exception
+ {
+ wagonManager = null;
+ artifactFactory = null;
+ super.tearDown();
+ }
+
+ @Test
public void testUnnecessaryRepositoryLookup()
throws Exception
{
@@ -123,6 +144,7 @@ public class DefaultWagonManagerTest
assertEquals( 1, listener.events.size() );
}
+ @Test
public void testGetMissingJar() throws TransferFailedException, UnsupportedProtocolException, IOException
{
Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" );
@@ -143,6 +165,7 @@ public class DefaultWagonManagerTest
assertFalse( artifact.getFile().exists() );
}
+ @Test
public void testGetMissingJarForced() throws TransferFailedException, UnsupportedProtocolException, IOException
{
Artifact artifact = createTestArtifact( "target/test-data/get-missing-jar", "jar" );
@@ -163,6 +186,7 @@ public class DefaultWagonManagerTest
assertFalse( artifact.getFile().exists() );
}
+ @Test
public void testGetRemoteJar()
throws TransferFailedException, ResourceDoesNotExistException, UnsupportedProtocolException, IOException
{
@@ -240,6 +264,7 @@ public class DefaultWagonManagerTest
return getRepo( id, "http://something" );
}
+ @Test
public void testDefaultWagonManager()
throws Exception
{
@@ -267,6 +292,7 @@ public class DefaultWagonManagerTest
/**
* Check that transfer listeners are properly removed after getArtifact and putArtifact
*/
+ @Test
public void testWagonTransferListenerRemovedAfterGetArtifactAndPutArtifact()
throws Exception
{
@@ -390,6 +416,7 @@ public class DefaultWagonManagerTest
}
}
+ @Test
public void testPerLookupInstantiation()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
index d5f281f..476c2cf 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/LegacyRepositorySystemTest.java
@@ -26,7 +26,13 @@ import org.apache.maven.settings.Server;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import javax.inject.Inject;
@@ -49,8 +55,9 @@ public class LegacyRepositorySystemTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -60,6 +67,16 @@ public class LegacyRepositorySystemTest
binder -> binder.requestInjection( this ) );
}
+ @After
+ @Override
+ public void tearDown()
+ throws Exception
+ {
+ repositorySystem = null;
+ super.tearDown();
+ }
+
+ @Test
public void testThatLocalRepositoryWithSpacesIsProperlyHandled()
throws Exception
{
@@ -68,6 +85,7 @@ public class LegacyRepositorySystemTest
assertEquals( basedir, new File( repo.getBasedir() ) );
}
+ @Test
public void testAuthenticationHandling()
{
Server server = new Server();
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java
index 5d88702..be742fc 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/DefaultArtifactCollectorTest.java
@@ -19,6 +19,16 @@ package org.apache.maven.repository.legacy.resolver;
* under the License.
*/
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
@@ -39,17 +49,15 @@ import org.apache.maven.artifact.versioning.VersionRange;
import org.apache.maven.repository.legacy.metadata.MetadataResolutionRequest;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* Test the default artifact collector.
@@ -77,8 +85,9 @@ public class DefaultArtifactCollectorTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -90,8 +99,9 @@ public class DefaultArtifactCollectorTest
projectArtifact = createArtifactSpec( "project", "1.0", null );
}
+ @After
@Override
- protected void tearDown()
+ public void tearDown()
throws Exception
{
artifactCollector = null;
@@ -135,6 +145,7 @@ public class DefaultArtifactCollectorTest
}
}
+ @Test
public void testResolveWithFilter()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -154,6 +165,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, c.artifact } ), res.getArtifacts() );
}
+ @Test
public void testResolveCorrectDependenciesWhenDifferentDependenciesOnNearest()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -212,6 +224,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveNearestNewestIsNearest()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -227,6 +240,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "3.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveNearestOldestIsNearest()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -242,6 +256,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveLocalNewestIsLocal()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -254,6 +269,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "3.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveLocalOldestIsLocal()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -266,6 +282,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveLocalWithNewerVersionButLesserScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -279,6 +296,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() );
}
+ @Test
public void testResolveLocalWithNewerVersionButLesserScopeResolvedFirst()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -292,6 +310,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, getArtifact( "junit", res.getArtifacts() ).getScope() );
}
+ @Test
public void testResolveNearestWithRanges()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -307,6 +326,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testResolveRangeWithManagedVersion()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -321,6 +341,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "5.0", getArtifact( "b", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testCompatibleRanges()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -337,6 +358,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.5", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testIncompatibleRanges()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -351,6 +373,7 @@ public class DefaultArtifactCollectorTest
assertTrue( res.hasVersionRangeViolations() );
}
+ @Test
public void testUnboundedRangeWhenVersionUnavailable()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -364,6 +387,7 @@ public class DefaultArtifactCollectorTest
assertTrue( res.hasVersionRangeViolations() );
}
+ @Test
public void testUnboundedRangeBelowLastRelease()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -379,6 +403,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "2.0", getArtifact( "c", res.getArtifacts() ).getVersion() );
}
+ @Test
public void testUnboundedRangeAboveLastRelease()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -391,6 +416,7 @@ public class DefaultArtifactCollectorTest
assertTrue( res.hasVersionRangeViolations() );
}
+ @Test
public void testResolveManagedVersion()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -404,6 +430,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, modifiedB } ), res.getArtifacts() );
}
+ @Test
public void testCollectChangesVersionOfOriginatingArtifactIfInDependencyManagementHasDifferentVersion()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -421,6 +448,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Resolved version don't match original artifact version", "1.0", resolvedArtifact.getVersion() );
}
+ @Test
public void testResolveCompileScopeOverTestScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -439,6 +467,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() );
}
+ @Test
public void testResolveRuntimeScopeOverTestScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -457,6 +486,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_TEST, artifact.getScope() );
}
+ @Test
public void testResolveCompileScopeOverRuntimeScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -475,6 +505,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_COMPILE, artifact.getScope() );
}
+ @Test
public void testResolveCompileScopeOverProvidedScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -493,6 +524,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() );
}
+ @Test
public void testResolveRuntimeScopeOverProvidedScope()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -511,6 +543,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifactScope", Artifact.SCOPE_PROVIDED, artifact.getScope() );
}
+ @Test
public void testProvidedScopeNotTransitive()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -522,6 +555,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
}
+ @Test
public void testOptionalNotTransitive()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -533,6 +567,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
}
+ @Test
public void testOptionalIncludedAtRoot()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -544,6 +579,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
}
+ @Test
public void testScopeUpdate()
throws InvalidVersionSpecificationException, ArtifactResolutionException
{
@@ -674,6 +710,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check version", "3.0", artifact.getVersion() );
}
+ @Test
public void testTestScopeNotTransitive()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -685,6 +722,7 @@ public class DefaultArtifactCollectorTest
assertEquals( "Check artifact list", createSet( new Object[] { a.artifact, b.artifact } ), res.getArtifacts() );
}
+ @Test
public void testSnapshotNotIncluded()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
@@ -703,6 +741,7 @@ public class DefaultArtifactCollectorTest
*/
}
+ @Test
public void testOverConstrainedVersionException()
throws ArtifactResolutionException, InvalidVersionSpecificationException
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java
index 54ae26a..fd890b0 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/AbstractConflictResolverTest.java
@@ -19,21 +19,27 @@ package org.apache.maven.repository.legacy.resolver.conflict;
* under the License.
*/
+import java.util.Collections;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ResolutionNode;
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
import org.apache.maven.artifact.versioning.VersionRange;
-import org.apache.maven.repository.legacy.resolver.conflict.ConflictResolver;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.After;
+import org.junit.Before;
import javax.inject.Inject;
import java.util.Collections;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
/**
* Provides a basis for testing conflict resolvers.
*
@@ -79,8 +85,12 @@ public abstract class AbstractConflictResolverTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
+ /*
+ * @see junit.framework.TestCase#setUp()
+ */
+ @Before
@Override
- protected void setUp()
+ public void setUp()
throws Exception
{
super.setUp();
@@ -99,7 +109,9 @@ public abstract class AbstractConflictResolverTest
/*
* @see org.codehaus.plexus.PlexusTestCase#tearDown()
*/
- protected void tearDown() throws Exception
+ @After
+ @Override
+ public void tearDown() throws Exception
{
a1 = null;
a2 = null;
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java
index 363c7a2..4428f13 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/FarthestConflictResolverTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.repository.legacy.resolver.conflict;
*/
import org.apache.maven.artifact.resolver.ResolutionNode;
+import org.junit.Test;
/**
* Tests <code>FarthestConflictResolver</code>.
@@ -47,6 +48,7 @@ public class FarthestConflictResolverTest
* b:1.0 -> a:2.0
* </pre>
*/
+ @Test
public void testDepth()
{
ResolutionNode a1n = createResolutionNode( a1);
@@ -63,6 +65,7 @@ public class FarthestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testDepthReversed()
{
ResolutionNode b1n = createResolutionNode( b1 );
@@ -79,6 +82,7 @@ public class FarthestConflictResolverTest
* a:2.0
* </pre>
*/
+ @Test
public void testEqual()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -94,6 +98,7 @@ public class FarthestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testEqualReversed()
{
ResolutionNode a2n = createResolutionNode( a2);
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java
index 23683d5..5c188dc 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NearestConflictResolverTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.repository.legacy.resolver.conflict;
*/
import org.apache.maven.artifact.resolver.ResolutionNode;
+import org.junit.Test;
/**
* Tests <code>NearestConflictResolver</code>.
@@ -47,6 +48,7 @@ public class NearestConflictResolverTest
* b:1.0 -> a:2.0
* </pre>
*/
+ @Test
public void testDepth()
{
ResolutionNode a1n = createResolutionNode( a1);
@@ -63,6 +65,7 @@ public class NearestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testDepthReversed()
{
ResolutionNode b1n = createResolutionNode( b1 );
@@ -79,6 +82,7 @@ public class NearestConflictResolverTest
* a:2.0
* </pre>
*/
+ @Test
public void testEqual()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -94,6 +98,7 @@ public class NearestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testEqualReversed()
{
ResolutionNode a2n = createResolutionNode( a2);
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java
index 4cfffc6..a9c4ca2 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/NewestConflictResolverTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.repository.legacy.resolver.conflict;
*/
import org.apache.maven.artifact.resolver.ResolutionNode;
+import org.junit.Test;
/**
* Tests <code>NewestConflictResolver</code>.
@@ -47,6 +48,7 @@ public class NewestConflictResolverTest
* b:1.0 -> a:2.0
* </pre>
*/
+ @Test
public void testDepth()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -63,6 +65,7 @@ public class NewestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testDepthReversed()
{
ResolutionNode b1n = createResolutionNode( b1 );
@@ -79,6 +82,7 @@ public class NewestConflictResolverTest
* a:2.0
* </pre>
*/
+ @Test
public void testEqual()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -94,6 +98,7 @@ public class NewestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testEqualReversed()
{
ResolutionNode a2n = createResolutionNode( a2 );
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java
index 8744de2..3bbfa5f 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/legacy/resolver/conflict/OldestConflictResolverTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.repository.legacy.resolver.conflict;
*/
import org.apache.maven.artifact.resolver.ResolutionNode;
+import org.junit.Test;
/**
* Tests <code>OldestConflictResolver</code>.
@@ -47,6 +48,7 @@ public class OldestConflictResolverTest
* b:1.0 -> a:2.0
* </pre>
*/
+ @Test
public void testDepth()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -64,6 +66,7 @@ public class OldestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testDepthReversed()
{
ResolutionNode b1n = createResolutionNode( b1 );
@@ -80,6 +83,7 @@ public class OldestConflictResolverTest
* a:2.0
* </pre>
*/
+ @Test
public void testEqual()
{
ResolutionNode a1n = createResolutionNode( a1 );
@@ -95,6 +99,7 @@ public class OldestConflictResolverTest
* a:1.0
* </pre>
*/
+ @Test
public void testEqualReversed()
{
ResolutionNode a2n = createResolutionNode( a2);
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java
index 339ce24..c5d9d82 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultClasspathTransformationTest.java
@@ -16,13 +16,12 @@ package org.apache.maven.repository.metadata;
*/
import org.apache.maven.artifact.ArtifactScopeEnum;
-import org.apache.maven.repository.metadata.ArtifactMetadata;
-import org.apache.maven.repository.metadata.ClasspathContainer;
-import org.apache.maven.repository.metadata.ClasspathTransformation;
-import org.apache.maven.repository.metadata.MetadataGraph;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
-import org.apache.maven.repository.metadata.MetadataGraphVertex;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
*
@@ -42,8 +41,9 @@ extends PlexusTestCase
MetadataGraphVertex v3;
MetadataGraphVertex v4;
//------------------------------------------------------------------------------------------
+ @Before
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
transform = (ClasspathTransformation) lookup( ClasspathTransformation.ROLE, "default" );
@@ -74,6 +74,7 @@ extends PlexusTestCase
graph.addEdge(v3, v4, new MetadataGraphEdge( "1.2", true, ArtifactScopeEnum.test, null, 2, 2 ) );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testCompileClasspathTransform()
throws Exception
{
@@ -86,6 +87,7 @@ extends PlexusTestCase
assertEquals("compile classpath should have 3 entries", 3, res.getClasspath().size() );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testRuntimeClasspathTransform()
throws Exception
{
@@ -101,6 +103,7 @@ extends PlexusTestCase
assertEquals("runtime artifact version should be 1.1", "1.1", md.getVersion() );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testTestClasspathTransform()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java
index 472f018..5f144fd 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolutionPolicyTest.java
@@ -15,10 +15,10 @@ package org.apache.maven.repository.metadata;
* the License.
*/
-import org.apache.maven.repository.metadata.GraphConflictResolutionPolicy;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
/**
*
@@ -27,23 +27,22 @@ import junit.framework.TestCase;
*/
public class DefaultGraphConflictResolutionPolicyTest
- extends TestCase
{
GraphConflictResolutionPolicy policy;
MetadataGraphEdge e1;
MetadataGraphEdge e2;
MetadataGraphEdge e3;
//------------------------------------------------------------------------------------------
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- policy = new DefaultGraphConflictResolutionPolicy();
- e1 = new MetadataGraphEdge( "1.1", true, null, null, 2, 1 );
- e2 = new MetadataGraphEdge( "1.2", true, null, null, 3, 2 );
- e3 = new MetadataGraphEdge( "1.2", true, null, null, 2, 3 );
- }
+ @Before
+ public void setUp() throws Exception
+ {
+ policy = new DefaultGraphConflictResolutionPolicy();
+ e1 = new MetadataGraphEdge( "1.1", true, null, null, 2, 1 );
+ e2 = new MetadataGraphEdge( "1.2", true, null, null, 3, 2 );
+ e3 = new MetadataGraphEdge( "1.2", true, null, null, 2, 3 );
+ }
//------------------------------------------------------------------------------------------
+ @Test
public void testDefaultPolicy()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java
index ccd25b4..be09db2 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/DefaultGraphConflictResolverTest.java
@@ -16,13 +16,13 @@ package org.apache.maven.repository.metadata;
*/
import org.apache.maven.artifact.ArtifactScopeEnum;
-import org.apache.maven.repository.metadata.ArtifactMetadata;
-import org.apache.maven.repository.metadata.GraphConflictResolver;
-import org.apache.maven.repository.metadata.MetadataGraph;
-import org.apache.maven.repository.metadata.MetadataGraphEdge;
-import org.apache.maven.repository.metadata.MetadataGraphVertex;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.codehaus.plexus.logging.Logger;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
*
@@ -44,8 +44,9 @@ extends PlexusTestCase
MetadataGraphVertex v3;
MetadataGraphVertex v4;
//------------------------------------------------------------------------------------------
+ @Before
@Override
- protected void setUp() throws Exception
+ public void setUp() throws Exception
{
super.setUp();
resolver = (GraphConflictResolver) lookup( GraphConflictResolver.ROLE, "default" );
@@ -76,6 +77,7 @@ extends PlexusTestCase
graph.addEdge(v3, v4, new MetadataGraphEdge( "1.2", true, ArtifactScopeEnum.provided, null, 2, 2 ) );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testCompileResolution()
throws Exception
{
@@ -101,6 +103,7 @@ extends PlexusTestCase
assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.2", res.getIncidentEdges(v4).get(0).getVersion() );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testRuntimeResolution()
throws Exception
{
@@ -125,6 +128,7 @@ extends PlexusTestCase
assertEquals( "wrong edge v3-v4 in the resulting graph after resolver", "1.1", res.getIncidentEdges(v4).get(0).getVersion() );
}
//------------------------------------------------------------------------------------------
+ @Test
public void testTestResolution()
throws Exception
{
diff --git a/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java b/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java
index fbb9035..efec2e6 100644
--- a/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java
+++ b/maven-compat/src/test/java/org/apache/maven/repository/metadata/TestMetadataSource.java
@@ -19,6 +19,10 @@ package org.apache.maven.repository.metadata;
* under the License.
*/
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -31,9 +35,6 @@ import org.apache.maven.repository.legacy.metadata.ResolutionGroup;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
@Named
@Singleton
diff --git a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
index de0f99b..3ae311f 100644
--- a/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/AbstractCoreMavenComponentTestCase.java
@@ -48,11 +48,11 @@ import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
+import org.junit.Before;
import javax.inject.Inject;
@@ -66,7 +66,9 @@ public abstract class AbstractCoreMavenComponentTestCase
protected org.apache.maven.project.ProjectBuilder projectBuilder;
@Override
- protected void setUp() throws Exception
+ @Before
+ public void setUp()
+ throws Exception
{
super.setUp();
getContainer();
@@ -81,6 +83,7 @@ public abstract class AbstractCoreMavenComponentTestCase
binder -> binder.requestInjection( this ) );
}
+
abstract protected String getProjectsDirectory();
protected File getProject( String name )
diff --git a/maven-core/src/test/java/org/apache/maven/DefaultMavenTest.java b/maven-core/src/test/java/org/apache/maven/DefaultMavenTest.java
index c63acbc..7db406c 100644
--- a/maven-core/src/test/java/org/apache/maven/DefaultMavenTest.java
+++ b/maven-core/src/test/java/org/apache/maven/DefaultMavenTest.java
@@ -1,23 +1,9 @@
package org.apache.maven;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
+import java.io.File;
+import java.nio.file.Files;
+
+import javax.inject.Inject;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
@@ -25,13 +11,10 @@ import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
-
-import java.io.File;
-import java.nio.file.Files;
-
-import javax.inject.Inject;
+import org.junit.Test;
import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
public class DefaultMavenTest
extends AbstractCoreMavenComponentTestCase
@@ -40,6 +23,14 @@ public class DefaultMavenTest
@Inject
private Maven maven;
+ @Override
+ protected String getProjectsDirectory()
+ {
+ return "src/test/projects/default-maven";
+ }
+
+
+ @Test
public void testThatErrorDuringProjectDependencyGraphCreationAreStored()
throws Exception
{
@@ -50,13 +41,7 @@ public class DefaultMavenTest
assertEquals( ProjectCycleException.class, result.getExceptions().get( 0 ).getClass() );
}
- @Override
- protected String getProjectsDirectory()
- {
- return "src/test/projects/default-maven";
- }
-
-
+ @Test
public void testMavenProjectNoDuplicateArtifacts()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java b/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java
index 7d02856..6d9262f 100644
--- a/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java
+++ b/maven-core/src/test/java/org/apache/maven/MavenLifecycleParticipantTest.java
@@ -29,6 +29,10 @@ import org.apache.maven.model.Dependency;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
public class MavenLifecycleParticipantTest
extends AbstractCoreMavenComponentTestCase
@@ -109,6 +113,7 @@ public class MavenLifecycleParticipantTest
return "src/test/projects/lifecycle-listener";
}
+ @Test
public void testDependencyInjection()
throws Exception
{
@@ -138,6 +143,7 @@ public class MavenLifecycleParticipantTest
assertEquals( INJECTED_ARTIFACT_ID, artifacts.get( 0 ).getArtifactId() );
}
+ @Test
public void testReactorDependencyInjection()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/MavenTest.java b/maven-core/src/test/java/org/apache/maven/MavenTest.java
index 711199a..79841c9 100644
--- a/maven-core/src/test/java/org/apache/maven/MavenTest.java
+++ b/maven-core/src/test/java/org/apache/maven/MavenTest.java
@@ -17,14 +17,11 @@ package org.apache.maven;
import org.apache.maven.exception.ExceptionHandler;
-import org.apache.maven.exception.ExceptionSummary;
-import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionResult;
import org.codehaus.plexus.DefaultPlexusContainer;
import javax.inject.Inject;
-import java.io.File;
import java.util.Collections;
+import org.junit.Test;
public class MavenTest
extends AbstractCoreMavenComponentTestCase
@@ -49,6 +46,7 @@ public class MavenTest
return "src/test/projects/lifecycle-executor";
}
+ @Test
public void testLifecycleExecutionUsingADefaultLifecyclePhase()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/PlexusTestCase.java b/maven-core/src/test/java/org/apache/maven/PlexusTestCase.java
new file mode 100644
index 0000000..d3801b8
--- /dev/null
+++ b/maven-core/src/test/java/org/apache/maven/PlexusTestCase.java
@@ -0,0 +1,317 @@
+package org.apache.maven;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * Copyright 2001-2006 Codehaus Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.codehaus.plexus.ContainerConfiguration;
+import org.codehaus.plexus.DefaultContainerConfiguration;
+import org.codehaus.plexus.DefaultPlexusContainer;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.PlexusContainerException;
+import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
+import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.DefaultContext;
+import org.junit.After;
+import org.junit.Before;
+
+/**
+ * This is a slightly modified version of the original plexus class
+ * available at https://raw.githubusercontent.com/codehaus-plexus/plexus-containers/master/plexus-container-default/src/main/java/org/codehaus/plexus/PlexusTestCase.java
+ * in order to migrate the tests to JUnit 4.
+ *
+ * @author Jason van Zyl
+ * @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
+ * @author <a href="mailto:michal@codehaus.org">Michal Maczka</a>
+ * @author Guillaume Nodet
+ */
+public abstract class PlexusTestCase
+{
+ private PlexusContainer container;
+
+ private static String basedir;
+
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ basedir = getBasedir();
+ }
+
+ @SuppressWarnings("ResultOfMethodCallIgnored")
+ protected void setupContainer()
+ {
+ // ----------------------------------------------------------------------------
+ // Context Setup
+ // ----------------------------------------------------------------------------
+
+ DefaultContext context = new DefaultContext();
+
+ context.put( "basedir", getBasedir() );
+
+ customizeContext( context );
+
+ boolean hasPlexusHome = context.contains( "plexus.home" );
+
+ if ( !hasPlexusHome )
+ {
+ File f = getTestFile( "target/plexus-home" );
+
+ if ( !f.isDirectory() )
+ {
+ f.mkdir();
+ }
+
+ context.put( "plexus.home", f.getAbsolutePath() );
+ }
+
+ // ----------------------------------------------------------------------------
+ // Configuration
+ // ----------------------------------------------------------------------------
+
+ String config = getCustomConfigurationName();
+
+ ContainerConfiguration containerConfiguration = new DefaultContainerConfiguration()
+ .setName( "test" )
+ .setContext( context.getContextData() );
+
+ if ( config != null )
+ {
+ containerConfiguration.setContainerConfiguration( config );
+ }
+ else
+ {
+ String resource = getConfigurationName( null );
+
+ containerConfiguration.setContainerConfiguration( resource );
+ }
+
+ customizeContainerConfiguration( containerConfiguration );
+
+ try
+ {
+ container = new DefaultPlexusContainer( containerConfiguration );
+ }
+ catch ( PlexusContainerException e )
+ {
+ throw new IllegalArgumentException( "Failed to create plexus container.", e );
+ }
+ }
+
+ /**
+ * Allow custom test case implementations do augment the default container configuration before
+ * executing tests.
+ *
+ * @param containerConfiguration {@link ContainerConfiguration}.
+ */
+ protected void customizeContainerConfiguration( ContainerConfiguration containerConfiguration )
+ {
+ }
+
+ protected void customizeContext( Context context )
+ {
+ }
+
+ protected PlexusConfiguration customizeComponentConfiguration()
+ {
+ return null;
+ }
+
+ @After
+ public void tearDown()
+ throws Exception
+ {
+ if ( container != null )
+ {
+ container.dispose();
+
+ container = null;
+ }
+ }
+
+ protected PlexusContainer getContainer()
+ {
+ if ( container == null )
+ {
+ setupContainer();
+ }
+
+ return container;
+ }
+
+ protected InputStream getConfiguration()
+ throws Exception
+ {
+ return getConfiguration( null );
+ }
+
+ protected InputStream getConfiguration( String subname )
+ throws Exception
+ {
+ return getResourceAsStream( getConfigurationName( subname ) );
+ }
+
+ protected String getCustomConfigurationName()
+ {
+ return null;
+ }
+
+ /**
+ * Allow the retrieval of a container configuration that is based on the name
+ * of the test class being run. So if you have a test class called org.foo.FunTest, then
+ * this will produce a resource name of org/foo/FunTest.xml which would be used to
+ * configure the Plexus container before running your test.
+ *
+ * @param subname the subname
+ * @return A configruation name
+ */
+ protected String getConfigurationName( String subname )
+ {
+ return getClass().getName().replace( '.', '/' ) + ".xml";
+ }
+
+ protected InputStream getResourceAsStream( String resource )
+ {
+ return getClass().getResourceAsStream( resource );
+ }
+
+ protected ClassLoader getClassLoader()
+ {
+ return getClass().getClassLoader();
+ }
+
+ // ----------------------------------------------------------------------
+ // Container access
+ // ----------------------------------------------------------------------
+
+ @SuppressWarnings("unchecked")
+ protected <T> T lookup( String componentKey )
+ throws ComponentLookupException
+ {
+ return (T) getContainer().lookup( componentKey );
+ }
+
+ @SuppressWarnings("unchecked")
+ protected <T> T lookup( String role,
+ String roleHint )
+ throws ComponentLookupException
+ {
+ return (T) getContainer().lookup( role, roleHint );
+ }
+
+ protected <T> T lookup( Class<T> componentClass )
+ throws ComponentLookupException
+ {
+ return getContainer().lookup( componentClass );
+ }
+
+ protected <T> T lookup( Class<T> componentClass, String roleHint )
+ throws ComponentLookupException
+ {
+ return getContainer().lookup( componentClass, roleHint );
+ }
+
+ protected void release( Object component )
+ throws ComponentLifecycleException
+ {
+ getContainer().release( component );
+ }
+
+ // ----------------------------------------------------------------------
+ // Helper methods for sub classes
+ // ----------------------------------------------------------------------
+
+ public static File getTestFile( String path )
+ {
+ return new File( getBasedir(), path );
+ }
+
+ public static File getTestFile( String basedir,
+ String path )
+ {
+ File basedirFile = new File( basedir );
+
+ if ( !basedirFile.isAbsolute() )
+ {
+ basedirFile = getTestFile( basedir );
+ }
+
+ return new File( basedirFile, path );
+ }
+
+ public static String getTestPath( String path )
+ {
+ return getTestFile( path ).getAbsolutePath();
+ }
+
+ public static String getTestPath( String basedir,
+ String path )
+ {
+ return getTestFile( basedir, path ).getAbsolutePath();
+ }
+
+ public static String getBasedir()
+ {
+ if ( basedir != null )
+ {
+ return basedir;
+ }
+
+ basedir = System.getProperty( "basedir" );
+
+ if ( basedir == null )
+ {
+ basedir = new File( "" ).getAbsolutePath();
+ }
+
+ return basedir;
+ }
+
+ public String getTestConfiguration()
+ {
+ return getTestConfiguration( getClass() );
+ }
+
+ public static String getTestConfiguration( Class<?> clazz )
+ {
+ String s = clazz.getName().replace( '.', '/' );
+
+ return s.substring( 0, s.indexOf( "$" ) ) + ".xml";
+ }
+}
diff --git a/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java b/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java
index d3b2eaa..13fc06f 100644
--- a/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java
+++ b/maven-core/src/test/java/org/apache/maven/ProjectDependenciesResolverTest.java
@@ -15,9 +15,6 @@ package org.apache.maven;
* the License.
*/
-import static org.hamcrest.Matchers.endsWith;
-import static org.junit.Assert.assertThat;
-
import java.io.File;
import java.util.Collections;
import java.util.List;
@@ -29,6 +26,11 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
import javax.inject.Inject;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.endsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
public class ProjectDependenciesResolverTest
extends AbstractCoreMavenComponentTestCase
@@ -42,6 +44,7 @@ public class ProjectDependenciesResolverTest
}
/*
+ @Test
public void testExclusionsInDependencies()
throws Exception
{
@@ -65,6 +68,7 @@ public class ProjectDependenciesResolverTest
}
*/
+ @Test
public void testSystemScopeDependencies()
throws Exception
{
@@ -79,6 +83,7 @@ public class ProjectDependenciesResolverTest
assertEquals( 1, artifactDependencies.size() );
}
+ @Test
public void testSystemScopeDependencyIsPresentInTheCompileClasspathElements()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
index 2803d8d..180e6ff 100644
--- a/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
+++ b/maven-core/src/test/java/org/apache/maven/artifact/handler/ArtifactHandlerTest.java
@@ -22,12 +22,16 @@ package org.apache.maven.artifact.handler;
import java.io.File;
import java.util.List;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
public class ArtifactHandlerTest
extends PlexusTestCase
{
+ @Test
public void testAptConsistency()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java
index a0588a2..3c532bf 100644
--- a/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/configuration/DefaultBeanConfiguratorTest.java
@@ -27,34 +27,32 @@ import org.apache.maven.configuration.internal.DefaultBeanConfigurator;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
/**
* @author Benjamin Bentmann
*/
public class DefaultBeanConfiguratorTest
- extends TestCase
{
private BeanConfigurator configurator;
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
-
configurator = new DefaultBeanConfigurator();
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
configurator = null;
-
- super.tearDown();
}
private Xpp3Dom toConfig( String xml )
@@ -69,6 +67,7 @@ public class DefaultBeanConfiguratorTest
}
}
+ @Test
public void testMinimal()
throws BeanConfigurationException
{
@@ -84,6 +83,7 @@ public class DefaultBeanConfiguratorTest
assertEquals( new File( "test" ), bean.file );
}
+ @Test
public void testPreAndPostProcessing()
throws BeanConfigurationException
{
@@ -111,6 +111,7 @@ public class DefaultBeanConfiguratorTest
assertEquals( new File( "base/test" ).getAbsoluteFile(), bean.file );
}
+ @Test
public void testChildConfigurationElement()
throws BeanConfigurationException
{
diff --git a/maven-core/src/test/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulatorTest.java b/maven-core/src/test/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulatorTest.java
index bcc5895..a746463 100644
--- a/maven-core/src/test/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulatorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/execution/DefaultMavenExecutionRequestPopulatorTest.java
@@ -9,6 +9,7 @@ import org.apache.maven.settings.Profile;
import org.apache.maven.settings.Repository;
import org.apache.maven.settings.Settings;
import org.eclipse.sisu.launch.InjectedTestCase;
+import org.junit.Test;
/*
* Licensed to the Apache Software Foundation (ASF) under one
@@ -35,6 +36,7 @@ public class DefaultMavenExecutionRequestPopulatorTest
@Inject
MavenExecutionRequestPopulator testee;
+ @Test
public void testPluginRepositoryInjection()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeTest.java b/maven-core/src/test/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeTest.java
index c7db866..589ac87 100644
--- a/maven-core/src/test/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeTest.java
+++ b/maven-core/src/test/java/org/apache/maven/execution/scope/internal/MojoExecutionScopeTest.java
@@ -16,17 +16,19 @@ package org.apache.maven.execution.scope.internal;
import java.util.concurrent.atomic.AtomicInteger;
+import com.google.inject.Key;
import org.apache.maven.execution.MojoExecutionEvent;
import org.apache.maven.execution.scope.WeakMojoExecutionListener;
import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Test;
-import junit.framework.TestCase;
-
-import com.google.inject.Key;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
public class MojoExecutionScopeTest
- extends TestCase
{
+ @Test
public void testNestedEnter()
throws Exception
{
@@ -58,6 +60,7 @@ public class MojoExecutionScopeTest
}
}
+ @Test
public void testMultiKeyInstance()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/graph/DefaultProjectDependencyGraphTest.java b/maven-core/src/test/java/org/apache/maven/graph/DefaultProjectDependencyGraphTest.java
index 6ce201d..621042c 100644
--- a/maven-core/src/test/java/org/apache/maven/graph/DefaultProjectDependencyGraphTest.java
+++ b/maven-core/src/test/java/org/apache/maven/graph/DefaultProjectDependencyGraphTest.java
@@ -14,21 +14,22 @@
*/
package org.apache.maven.graph;
-import junit.framework.TestCase;
+import java.util.Arrays;
+import java.util.List;
+
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.model.Dependency;
import org.apache.maven.project.DuplicateProjectException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.junit.Test;
-import java.util.Arrays;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
/**
* @author Kristian Rosenvold
*/
public class DefaultProjectDependencyGraphTest
- extends TestCase
{
private final MavenProject aProject = createA();
@@ -45,6 +46,7 @@ public class DefaultProjectDependencyGraphTest
private final MavenProject transitiveOnly =
createProject( Arrays.asList( toDependency( depender3 ) ), "depender5" );
+ @Test
public void testGetSortedProjects()
throws DuplicateProjectException, CycleDetectedException
{
@@ -54,6 +56,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender1, sortedProjects.get( 1 ) );
}
+ @Test
public void testVerifyExpectedParentStructure()
throws CycleDetectedException, DuplicateProjectException
{
@@ -66,6 +69,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender3, sortedProjects.get( 3 ) );
}
+ @Test
public void testVerifyThatDownstreamProjectsComeInSortedOrder()
throws CycleDetectedException, DuplicateProjectException
{
@@ -76,6 +80,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender3, downstreamProjects.get( 2 ) );
}
+ @Test
public void testTransitivesInOrder()
throws CycleDetectedException, DuplicateProjectException
{
@@ -89,6 +94,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender2, downstreamProjects.get( 3 ) );
}
+ @Test
public void testNonTransitivesInOrder()
throws CycleDetectedException, DuplicateProjectException
{
@@ -102,6 +108,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender2, downstreamProjects.get( 3 ) );
}
+ @Test
public void testWithTransitiveOnly()
throws CycleDetectedException, DuplicateProjectException
{
@@ -115,6 +122,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender2, downstreamProjects.get( 3 ) );
}
+ @Test
public void testWithMissingTransitiveOnly()
throws CycleDetectedException, DuplicateProjectException
{
@@ -127,6 +135,7 @@ public class DefaultProjectDependencyGraphTest
assertEquals( depender2, downstreamProjects.get( 2 ) );
}
+ @Test
public void testGetUpstreamProjects()
throws CycleDetectedException, DuplicateProjectException
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/DefaultLifecyclesTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/DefaultLifecyclesTest.java
index 28ffeda..1e131ab 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/DefaultLifecyclesTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/DefaultLifecyclesTest.java
@@ -15,25 +15,25 @@ package org.apache.maven.lifecycle;
* the License.
*/
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.arrayWithSize;
-import static org.hamcrest.Matchers.hasSize;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
+import javax.inject.Inject;
+
+import org.apache.maven.PlexusTestCase;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.Before;
+import org.junit.Test;
-import javax.inject.Inject;
-import java.util.Collections;
-import java.util.List;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.arrayWithSize;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.is;
/**
* @author Kristian Rosenvold
@@ -54,7 +54,9 @@ public class DefaultLifecyclesTest
}
@Override
- protected void setUp() throws Exception
+ @Before
+ public void setUp()
+ throws Exception
{
super.setUp();
getContainer();
@@ -69,6 +71,7 @@ public class DefaultLifecyclesTest
binder -> binder.requestInjection( this ) );
}
+ @Test
public void testDefaultLifecycles()
{
final List<Lifecycle> lifecycles = defaultLifeCycles.getLifeCycles();
@@ -76,6 +79,7 @@ public class DefaultLifecyclesTest
assertThat( DefaultLifecycles.STANDARD_LIFECYCLES, arrayWithSize( 4 ) );
}
+ @Test
public void testDefaultLifecycle()
{
final Lifecycle lifecycle = getLifeCycleById( "default" );
@@ -83,6 +87,7 @@ public class DefaultLifecyclesTest
assertThat( lifecycle.getPhases(), hasSize( 23 ) );
}
+ @Test
public void testCleanLifecycle()
{
final Lifecycle lifecycle = getLifeCycleById( "clean" );
@@ -90,6 +95,7 @@ public class DefaultLifecyclesTest
assertThat( lifecycle.getPhases(), hasSize( 3 ) );
}
+ @Test
public void testSiteLifecycle()
{
final Lifecycle lifecycle = getLifeCycleById( "site" );
@@ -97,6 +103,7 @@ public class DefaultLifecyclesTest
assertThat( lifecycle.getPhases(), hasSize( 4 ) );
}
+ @Test
public void testWrapperLifecycle()
{
final Lifecycle lifecycle = getLifeCycleById( "wrapper" );
@@ -104,6 +111,7 @@ public class DefaultLifecyclesTest
assertThat( lifecycle.getPhases(), hasSize( 1 ) );
}
+ @Test
public void testCustomLifecycle()
{
List<Lifecycle> myLifecycles = new ArrayList<>();
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorSubModulesTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorSubModulesTest.java
index dbf242e..c531d17 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorSubModulesTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorSubModulesTest.java
@@ -25,6 +25,11 @@ import org.apache.maven.lifecycle.internal.LifecycleTaskSegmentCalculator;
import org.apache.maven.lifecycle.internal.MojoExecutor;
import javax.inject.Inject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
/**
* Just asserts that it's able to create those components. Handy when CDI container gets a nervous breakdown.
@@ -64,6 +69,7 @@ public class LifecycleExecutorSubModulesTest
return "src/test/projects/lifecycle-executor";
}
+ @Test
public void testCreation()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
index d4a7e9b..0c47e79 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
@@ -15,9 +15,6 @@ package org.apache.maven.lifecycle;
* the License.
*/
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasSize;
-
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
@@ -45,6 +42,16 @@ import org.apache.maven.plugin.MojoNotFoundException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
import javax.inject.Inject;
@@ -72,6 +79,7 @@ public class LifecycleExecutorTest
// Tests which exercise the lifecycle executor when it is dealing with default lifecycle phases.
// -----------------------------------------------------------------------------------------------
+ @Test
public void testCalculationOfBuildPlanWithIndividualTaskWherePluginIsSpecifiedInThePom()
throws Exception
{
@@ -92,6 +100,7 @@ public class LifecycleExecutorTest
assertEquals( "0.1", mojoExecution.getMojoDescriptor().getPluginDescriptor().getVersion() );
}
+ @Test
public void testCalculationOfBuildPlanWithIndividualTaskOfTheCleanLifecycle()
throws Exception
{
@@ -111,6 +120,7 @@ public class LifecycleExecutorTest
assertEquals( "0.1", mojoExecution.getMojoDescriptor().getPluginDescriptor().getVersion() );
}
+ @Test
public void testCalculationOfBuildPlanWithIndividualTaskOfTheCleanCleanGoal()
throws Exception
{
@@ -233,6 +243,7 @@ public class LifecycleExecutorTest
"configuration/models[1]/model" ) );
}
+ @Test
public void testLifecycleQueryingUsingADefaultLifecyclePhase()
throws Exception
{
@@ -263,6 +274,7 @@ public class LifecycleExecutorTest
assertEquals( "jar:jar", executionPlan.get( 7 ).getMojoDescriptor().getFullGoalName() );
}
+ @Test
public void testLifecyclePluginsRetrievalForDefaultLifecycle()
throws Exception
{
@@ -272,6 +284,7 @@ public class LifecycleExecutorTest
assertThat( plugins.toString(), plugins, hasSize( 9 ) );
}
+ @Test
public void testPluginConfigurationCreation()
throws Exception
{
@@ -301,6 +314,7 @@ public class LifecycleExecutorTest
mergedSegment.getTasks() );
}
+ @Test
public void testInvalidGoalName()
throws Exception
{
@@ -328,6 +342,7 @@ public class LifecycleExecutorTest
}
+ @Test
public void testPluginPrefixRetrieval()
throws Exception
{
@@ -340,6 +355,7 @@ public class LifecycleExecutorTest
// Prefixes
+ @Test
public void testFindingPluginPrefixforCleanClean()
throws Exception
{
@@ -349,6 +365,7 @@ public class LifecycleExecutorTest
assertNotNull( plugin );
}
+ @Test
public void testSetupMojoExecution()
throws Exception
{
@@ -371,6 +388,7 @@ public class LifecycleExecutorTest
assertEquals("1.0", execution.getConfiguration().getChild( "version" ).getAttribute( "default-value" ));
}
+ @Test
public void testExecutionListeners()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/MavenExecutionPlanTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/MavenExecutionPlanTest.java
index ffd9f0d..0e455e6 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/MavenExecutionPlanTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/MavenExecutionPlanTest.java
@@ -15,21 +15,24 @@
package org.apache.maven.lifecycle;
-import junit.framework.TestCase;
+import java.util.Set;
import org.apache.maven.lifecycle.internal.ExecutionPlanItem;
import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
import org.apache.maven.model.Plugin;
+import org.junit.Test;
-import java.util.Set;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
/**
* @author Kristian Rosenvold
*/
public class MavenExecutionPlanTest
- extends TestCase
{
+ @Test
public void testFindLastInPhase()
throws Exception
{
@@ -41,6 +44,7 @@ public class MavenExecutionPlanTest
assertNotNull( expected );
}
+ @Test
public void testThreadSafeMojos()
throws Exception
{
@@ -52,6 +56,7 @@ public class MavenExecutionPlanTest
}
+ @Test
public void testFindLastWhenFirst()
throws Exception
{
@@ -62,6 +67,7 @@ public class MavenExecutionPlanTest
assertNull( beerPhase );
}
+ @Test
public void testFindLastInPhaseMisc()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuildListCalculatorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuildListCalculatorTest.java
index a003983..4a5bd24 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuildListCalculatorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuildListCalculatorTest.java
@@ -15,17 +15,20 @@ package org.apache.maven.lifecycle.internal;
* the License.
*/
-import junit.framework.TestCase;
+import java.util.List;
+
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.internal.stub.LifecycleTaskSegmentCalculatorStub;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
+import org.junit.Test;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
public class BuildListCalculatorTest
- extends TestCase
{
+ @Test
public void testCalculateProjectBuilds()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
index b1af3aa..baea294 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/BuilderCommonTest.java
@@ -15,9 +15,7 @@ package org.apache.maven.lifecycle.internal;
* the License.
*/
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
+import java.util.HashSet;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.MavenExecutionPlan;
@@ -27,8 +25,9 @@ import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
import org.codehaus.plexus.logging.Logger;
import org.junit.Test;
-
-import java.util.HashSet;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
/**
* @author Kristian Rosenvold
@@ -78,16 +77,19 @@ public class BuilderCommonTest
+ "you should define versions in pluginManagement section of your pom.xml or parent");
}
+ @Test
public void testHandleBuildError()
throws Exception
{
}
+ @Test
public void testAttachToThread()
throws Exception
{
}
+ @Test
public void testGetKey()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraphTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraphTest.java
index 6118bbe..a29e64d 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraphTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/ConcurrencyDependencyGraphTest.java
@@ -15,6 +15,8 @@ package org.apache.maven.lifecycle.internal;
* the License.
*/
+import java.util.List;
+
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.lifecycle.LifecycleNotFoundException;
@@ -29,10 +31,15 @@ import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
+import org.junit.Test;
-import java.util.List;
-
-import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.*;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.A;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.B;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.C;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.X;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.Y;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.Z;
+import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub.getProjectBuildList;
/**
* @author Kristian Rosenvold
@@ -40,6 +47,7 @@ import static org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStu
public class ConcurrencyDependencyGraphTest
extends junit.framework.TestCase
{
+ @Test
public void testConcurrencyGraphPrimaryVersion()
throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
@@ -70,6 +78,7 @@ public class ConcurrencyDependencyGraphTest
assertEquals( Z, cDescendants.get( 1 ) );
}
+ @Test
public void testConcurrencyGraphDifferentCompletionOrder()
throws InvalidPluginDescriptorException, PluginVersionResolutionException, PluginDescriptorParsingException,
NoPluginFoundForPrefixException, MojoNotFoundException, PluginNotFoundException, PluginResolutionException,
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
index de02428..2cd28b2 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleDependencyResolverTest.java
@@ -32,6 +32,10 @@ import org.apache.maven.execution.MavenSession;
import org.apache.maven.project.MavenProject;
import javax.inject.Inject;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
public class LifecycleDependencyResolverTest extends AbstractCoreMavenComponentTestCase
{
@@ -44,6 +48,15 @@ public class LifecycleDependencyResolverTest extends AbstractCoreMavenComponentT
return null;
}
+ @Before
+ public void setUp()
+ throws Exception
+ {
+ super.setUp();
+ resolver = lookup( LifecycleDependencyResolver.class );
+ }
+
+ @Test
public void testCachedReactorProjectDependencies() throws Exception
{
MavenSession session = createMavenSession( new File( "src/test/projects/lifecycle-dependency-resolver/pom.xml" ), new Properties(), true );
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorTest.java
index 0e1c3c7..373b98b 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleExecutionPlanCalculatorTest.java
@@ -23,6 +23,9 @@ import org.apache.maven.lifecycle.internal.stub.DefaultLifecyclesStub;
import org.apache.maven.lifecycle.internal.stub.PluginPrefixResolverStub;
import org.apache.maven.lifecycle.internal.stub.PluginVersionResolverStub;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
/**
* @author Kristian Rosenvold
@@ -31,6 +34,7 @@ public class LifecycleExecutionPlanCalculatorTest
extends AbstractCoreMavenComponentTestCase
{
+ @Test
public void testCalculateExecutionPlanWithGoalTasks()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImplTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImplTest.java
index 5db316f..0f431b7 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImplTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/LifecycleTaskSegmentCalculatorImplTest.java
@@ -19,19 +19,22 @@ package org.apache.maven.lifecycle.internal;
* under the License.
*/
-import junit.framework.TestCase;
+import java.util.List;
+
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.internal.stub.LifecycleTaskSegmentCalculatorStub;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
+import org.junit.Test;
-import java.util.List;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* @author Kristian Rosenvold
*/
public class LifecycleTaskSegmentCalculatorImplTest
- extends TestCase
{
+ @Test
public void testCalculateProjectBuilds()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/PhaseRecorderTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/PhaseRecorderTest.java
index f3d6422..5c1251c 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/PhaseRecorderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/PhaseRecorderTest.java
@@ -15,20 +15,23 @@ package org.apache.maven.lifecycle.internal;
* the License.
*/
-import junit.framework.TestCase;
+import java.util.List;
import org.apache.maven.lifecycle.MavenExecutionPlan;
import org.apache.maven.lifecycle.internal.stub.LifecycleExecutionPlanCalculatorStub;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
import org.apache.maven.plugin.MojoExecution;
+import org.junit.Test;
-import java.util.List;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
* @author Kristian Rosenvold
*/
-public class PhaseRecorderTest extends TestCase
+public class PhaseRecorderTest
{
+ @Test
public void testObserveExecution() throws Exception {
PhaseRecorder phaseRecorder = new PhaseRecorder( ProjectDependencyGraphStub.A);
MavenExecutionPlan plan = LifecycleExecutionPlanCalculatorStub.getProjectAExceutionPlan();
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraphTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraphTest.java
index b909fb0..5f69410 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraphTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ConcurrencyDependencyGraphTest.java
@@ -14,17 +14,20 @@ package org.apache.maven.lifecycle.internal.builder.multithreaded;
* the License.
*/
-import junit.framework.TestCase;
+import java.util.List;
+import java.util.Set;
+
import org.apache.maven.execution.ProjectDependencyGraph;
import org.apache.maven.lifecycle.internal.ProjectBuildList;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
import org.apache.maven.project.MavenProject;
+import org.junit.Test;
-import java.util.List;
-import java.util.Set;
+import static org.junit.Assert.assertEquals;
-public class ConcurrencyDependencyGraphTest extends TestCase {
+public class ConcurrencyDependencyGraphTest {
+ @Test
public void testGraph() throws Exception {
ProjectBuildList projectBuildList = ProjectDependencyGraphStub.getProjectBuildList(
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxerTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxerTest.java
index 32ce9ba..197ff6b 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxerTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/builder/multithreaded/ThreadOutputMuxerTest.java
@@ -15,14 +15,24 @@ package org.apache.maven.lifecycle.internal.builder.multithreaded;
* the License.
*/
-import junit.framework.TestCase;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CompletionService;
+import java.util.concurrent.ExecutorCompletionService;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleNotFoundException;
import org.apache.maven.lifecycle.LifecyclePhaseNotFoundException;
import org.apache.maven.lifecycle.internal.ProjectBuildList;
import org.apache.maven.lifecycle.internal.ProjectSegment;
-import org.apache.maven.lifecycle.internal.builder.multithreaded.ThreadOutputMuxer;
import org.apache.maven.lifecycle.internal.stub.ProjectDependencyGraphStub;
import org.apache.maven.plugin.InvalidPluginDescriptorException;
import org.apache.maven.plugin.MojoNotFoundException;
@@ -31,25 +41,14 @@ import org.apache.maven.plugin.PluginNotFoundException;
import org.apache.maven.plugin.PluginResolutionException;
import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.junit.Test;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CompletionService;
-import java.util.concurrent.ExecutorCompletionService;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
+import static org.junit.Assert.assertEquals;
/**
* @author Kristian Rosenvold
*/
public class ThreadOutputMuxerTest
- extends TestCase
{
final String paid = "Paid";
@@ -58,6 +57,7 @@ public class ThreadOutputMuxerTest
final String full = "Full";
+ @Test
public void testSingleThreaded()
throws Exception
{
@@ -86,6 +86,7 @@ public class ThreadOutputMuxerTest
assertEquals( ( paid + in + full ).length(), byteArrayOutputStream.size() );
}
+ @Test
public void testMultiThreaded()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStubTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStubTest.java
index 8c60572..ddc20ec 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStubTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/internal/stub/ProjectDependencyGraphStubTest.java
@@ -15,11 +15,13 @@
package org.apache.maven.lifecycle.internal.stub;
-import junit.framework.TestCase;
-import org.apache.maven.project.MavenProject;
-
import java.util.List;
+import org.apache.maven.project.MavenProject;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
/**
* Tests the stub. Yeah, I know.
@@ -28,30 +30,34 @@ import java.util.List;
*/
public class ProjectDependencyGraphStubTest
- extends TestCase
{
+ ProjectDependencyGraphStub stub = new ProjectDependencyGraphStub();
+
+ @Test
public void testADependencies()
{
- ProjectDependencyGraphStub stub = new ProjectDependencyGraphStub();
final List<MavenProject> mavenProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.A, false );
assertEquals( 0, mavenProjects.size() );
}
- public void testBDepenencies( ProjectDependencyGraphStub stub )
+ @Test
+ public void testBDepenencies()
{
final List<MavenProject> bProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.B, false );
assertEquals( 1, bProjects.size() );
assertTrue( bProjects.contains( ProjectDependencyGraphStub.A ) );
}
- public void testCDepenencies( ProjectDependencyGraphStub stub )
+ @Test
+ public void testCDepenencies()
{
final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.C, false );
assertEquals( 1, cProjects.size() );
- assertTrue( cProjects.contains( ProjectDependencyGraphStub.C ) );
+ assertTrue( cProjects.contains( ProjectDependencyGraphStub.A ) );
}
- public void testXDepenencies( ProjectDependencyGraphStub stub )
+ @Test
+ public void testXDepenencies()
{
final List<MavenProject> cProjects = stub.getUpstreamProjects( ProjectDependencyGraphStub.X, false );
assertEquals( 2, cProjects.size() );
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java
index b4b3b3a..524979d 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginManagerTest.java
@@ -32,6 +32,13 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.component.repository.ComponentDescriptor;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
import javax.inject.Inject;
@@ -41,12 +48,12 @@ public class PluginManagerTest
@Inject
private DefaultBuildPluginManager pluginManager;
-
protected String getProjectsDirectory()
{
return "src/test/projects/plugin-manager";
}
+ @Test
public void testPluginLoading()
throws Exception
{
@@ -61,6 +68,7 @@ public class PluginManagerTest
assertNotNull( pluginDescriptor );
}
+ @Test
public void testMojoDescriptorRetrieval()
throws Exception
{
@@ -97,6 +105,7 @@ public class PluginManagerTest
// only deal in concrete terms -- all version finding mumbo jumbo is a customization to base functionality
// the plugin manager provides.
+ @Test
public void testRemoteResourcesPlugin()
throws Exception
{
@@ -150,6 +159,7 @@ public class PluginManagerTest
*/
}
+ @Test
public void testMojoConfigurationIsMergedCorrectly()
throws Exception
{
@@ -160,6 +170,7 @@ public class PluginManagerTest
* is in the Antlr plugin which comes bundled with a version of Antlr but the user often times needs
* to use a specific version. We need to make sure the version that they specify takes precedence.
*/
+ @Test
public void testMojoWhereInternallyStatedDependencyIsOverriddenByProject()
throws Exception
{
@@ -169,6 +180,7 @@ public class PluginManagerTest
* The case where you have a plugin in the current build that you want to be used on projects in
* the current build.
*/
+ @Test
public void testMojoThatIsPresentInTheCurrentBuild()
throws Exception
{
@@ -178,6 +190,7 @@ public class PluginManagerTest
* This is the case where the Mojo wants to execute on every project and then do something at the end
* with the results of each project.
*/
+ @Test
public void testAggregatorMojo()
throws Exception
{
@@ -187,6 +200,7 @@ public class PluginManagerTest
* This is the case where a Mojo needs the lifecycle run to a certain phase before it can do
* anything useful.
*/
+ @Test
public void testMojoThatRequiresExecutionToAGivenPhaseBeforeExecutingItself()
throws Exception
{
@@ -198,6 +212,7 @@ public class PluginManagerTest
// test a build where projects use different versions of the same plugin
+ @Test
public void testThatPluginDependencyThatHasSystemScopeIsResolved()
throws Exception
{
@@ -241,6 +256,7 @@ public class PluginManagerTest
assertEquals( version, pd.getVersion() );
}
+ @Test
public void testPluginRealmCache()
throws Exception
{
@@ -285,6 +301,7 @@ public class PluginManagerTest
}
}
+ @Test
public void testBuildExtensionsPluginLoading()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
index c13d193..14961d1 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExceptionTest.java
@@ -24,8 +24,9 @@ import java.util.Collections;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
/**
* MNG-3131
@@ -34,11 +35,11 @@ import junit.framework.TestCase;
*
*/
public class PluginParameterExceptionTest
- extends TestCase
{
private final String LS = System.lineSeparator();
+ @Test
public void testMissingRequiredStringArrayTypeParameter()
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
@@ -69,6 +70,7 @@ public class PluginParameterExceptionTest
"</configuration>." + LS, exception.buildDiagnosticMessage() );
}
+ @Test
public void testMissingRequiredCollectionTypeParameter()
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
@@ -99,6 +101,7 @@ public class PluginParameterExceptionTest
"</configuration>." + LS, exception.buildDiagnosticMessage() );
}
+ @Test
public void testMissingRequiredMapTypeParameter()
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
@@ -129,6 +132,7 @@ public class PluginParameterExceptionTest
"</configuration>." + LS, exception.buildDiagnosticMessage() );
}
+ @Test
public void testMissingRequiredPropertiesTypeParameter()
{
MojoDescriptor mojoDescriptor = new MojoDescriptor();
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
index e579d69..490d915 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/PluginParameterExpressionEvaluatorTest.java
@@ -46,6 +46,14 @@ import org.codehaus.plexus.MutablePlexusContainer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
import org.codehaus.plexus.util.dag.CycleDetectedException;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
import javax.inject.Inject;
@@ -60,14 +68,7 @@ public class PluginParameterExpressionEvaluatorTest
@Inject
private RepositorySystem factory;
- @Override
- protected void tearDown()
- throws Exception
- {
- factory = null;
- super.tearDown();
- }
-
+ @Test
public void testPluginDescriptorExpressionReference()
throws Exception
{
@@ -84,6 +85,7 @@ public class PluginParameterExpressionEvaluatorTest
result );
}
+ @Test
public void testPluginArtifactsExpressionReference()
throws Exception
{
@@ -109,6 +111,7 @@ public class PluginParameterExpressionEvaluatorTest
assertSame( "dependency artifact is wrong.", depArtifact, depResults.get( 0 ) );
}
+ @Test
public void testPluginArtifactMapExpressionReference()
throws Exception
{
@@ -136,6 +139,7 @@ public class PluginParameterExpressionEvaluatorTest
depResults.get( ArtifactUtils.versionlessKey( depArtifact ) ) );
}
+ @Test
public void testPluginArtifactIdExpressionReference()
throws Exception
{
@@ -152,6 +156,7 @@ public class PluginParameterExpressionEvaluatorTest
result );
}
+ @Test
public void testValueExtractionWithAPomValueContainingAPath()
throws Exception
{
@@ -174,6 +179,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( expected, actual );
}
+ @Test
public void testEscapedVariablePassthrough()
throws Exception
{
@@ -191,6 +197,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( var, value );
}
+ @Test
public void testEscapedVariablePassthroughInLargerExpression()
throws Exception
{
@@ -209,6 +216,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "${var} with version: 1", value );
}
+ @Test
public void testMultipleSubExpressionsInLargerExpression()
throws Exception
{
@@ -227,6 +235,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "test with version: 1", value );
}
+ @Test
public void testMissingPOMPropertyRefInLargerExpression()
throws Exception
{
@@ -241,6 +250,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( expr, value );
}
+ @Test
public void testPOMPropertyExtractionWithMissingProject_WithDotNotation()
throws Exception
{
@@ -262,6 +272,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( checkValue, value );
}
+ @Test
public void testBasedirExtractionWithMissingProject()
throws Exception
{
@@ -272,6 +283,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( System.getProperty( "user.dir" ), value );
}
+ @Test
public void testValueExtractionFromSystemPropertiesWithMissingProject()
throws Exception
{
@@ -291,6 +303,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "value", value );
}
+ @Test
public void testValueExtractionFromSystemPropertiesWithMissingProject_WithDotNotation()
throws Exception
{
@@ -323,6 +336,7 @@ public class PluginParameterExpressionEvaluatorTest
return new MavenSession( container, request, new DefaultMavenExecutionResult(), Collections.<MavenProject>emptyList() );
}
+ @Test
public void testLocalRepositoryExtraction()
throws Exception
{
@@ -333,6 +347,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "local", ( (ArtifactRepository) value ).getId() );
}
+ @Test
public void testTwoExpressions()
throws Exception
{
@@ -351,6 +366,7 @@ public class PluginParameterExpressionEvaluatorTest
assertEquals( "expected-directory" + File.separatorChar + "expected-finalName", value );
}
+ @Test
public void testShouldExtractPluginArtifacts()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java b/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java
index 25aa176..70faa44 100644
--- a/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java
+++ b/maven-core/src/test/java/org/apache/maven/plugin/internal/DefaultLegacySupportTest.java
@@ -18,20 +18,23 @@ package org.apache.maven.plugin.internal;
* under the License.
*/
-import junit.framework.TestCase;
+import java.util.concurrent.CountDownLatch;
+
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
+import org.junit.Test;
-import java.util.concurrent.CountDownLatch;
+import static org.junit.Assert.assertNull;
/**
* @author Kristian Rosenvold
*/
-public class DefaultLegacySupportTest extends TestCase {
+public class DefaultLegacySupportTest {
final CountDownLatch latch = new CountDownLatch(1);
final DefaultLegacySupport defaultLegacySupport = new DefaultLegacySupport();
+ @Test
public void testSetSession() throws Exception {
MavenExecutionRequest mavenExecutionRequest = new DefaultMavenExecutionRequest();
diff --git a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
index 1456ead..18a5812 100644
--- a/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
+++ b/maven-core/src/test/java/org/apache/maven/project/AbstractMavenProjectTestCase.java
@@ -31,8 +31,10 @@ import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
+import org.junit.After;
+import org.junit.Before;
import javax.inject.Inject;
@@ -64,7 +66,8 @@ public abstract class AbstractMavenProjectTestCase
binder -> binder.requestInjection( this ) );
}
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
super.setUp();
@@ -80,8 +83,8 @@ public abstract class AbstractMavenProjectTestCase
}
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
projectBuilder = null;
diff --git a/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
index 1bb66ab..fff4ed5 100644
--- a/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/DefaultMavenProjectBuilderTest.java
@@ -18,8 +18,6 @@ package org.apache.maven.project;
* specific language governing permissions and limitations
* under the License.
*/
-import static org.hamcrest.Matchers.containsString;
-import static org.junit.Assert.assertThat;
import java.io.File;
import java.util.ArrayList;
@@ -27,8 +25,16 @@ import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
import org.codehaus.plexus.util.FileUtils;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
public class DefaultMavenProjectBuilderTest
extends AbstractMavenProjectTestCase
@@ -91,6 +97,7 @@ public class DefaultMavenProjectBuilderTest
* Check that we can build ok from the middle pom of a (parent,child,grandchild) hierarchy
* @throws Exception
*/
+ @Test
public void testBuildFromMiddlePom() throws Exception
{
File f1 = getTestFile( "src/test/resources/projects/grandchild-check/child/pom.xml");
@@ -103,6 +110,7 @@ public class DefaultMavenProjectBuilderTest
getProject( f2 );
}
+ @Test
public void testDuplicatePluginDefinitionsMerged()
throws Exception
{
@@ -114,6 +122,7 @@ public class DefaultMavenProjectBuilderTest
assertEquals( "first", project.getBuildPlugins().get( 0 ).getExecutions().get( 0 ).getId() );
}
+ @Test
public void testFutureModelVersion()
throws Exception
{
@@ -130,6 +139,7 @@ public class DefaultMavenProjectBuilderTest
}
}
+ @Test
public void testPastModelVersion()
throws Exception
{
@@ -148,6 +158,7 @@ public class DefaultMavenProjectBuilderTest
}
}
+ @Test
public void testFutureSchemaModelVersion()
throws Exception
{
@@ -174,6 +185,7 @@ public class DefaultMavenProjectBuilderTest
}
}
+ @Test
public void testBuildStubModelForMissingRemotePom()
throws Exception
{
@@ -211,6 +223,7 @@ public class DefaultMavenProjectBuilderTest
}
}
+ @Test
public void testPartialResultUponBadDependencyDeclaration()
throws Exception
{
@@ -243,6 +256,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildValidParentVersionRangeLocally() throws Exception
{
File f1 = getTestFile( "src/test/resources/projects/parent-version-range-local-valid/child/pom.xml" );
@@ -262,6 +276,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildParentVersionRangeLocallyWithoutChildVersion() throws Exception
{
File f1 =
@@ -284,6 +299,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildParentVersionRangeLocallyWithChildVersionExpression() throws Exception
{
File f1 =
@@ -307,6 +323,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildParentVersionRangeExternally() throws Exception
{
File f1 = getTestFile( "src/test/resources/projects/parent-version-range-external-valid/pom.xml" );
@@ -326,6 +343,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildParentVersionRangeExternallyWithoutChildVersion() throws Exception
{
File f1 =
@@ -349,6 +367,7 @@ public class DefaultMavenProjectBuilderTest
*
* @throws Exception
*/
+ @Test
public void testBuildParentVersionRangeExternallyWithChildVersionExpression() throws Exception
{
File f1 =
diff --git a/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
index 5ac8f61..1d52b41 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ExtensionDescriptorBuilderTest.java
@@ -19,16 +19,20 @@ package org.apache.maven.project;
* under the License.
*/
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
-import junit.framework.TestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
/**
* Tests {@link ExtensionDescriptorBuilder}.
@@ -36,27 +40,22 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ExtensionDescriptorBuilderTest
- extends TestCase
{
private ExtensionDescriptorBuilder builder;
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
-
builder = new ExtensionDescriptorBuilder();
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
builder = null;
-
- super.tearDown();
}
private InputStream toStream( String xml )
@@ -64,6 +63,7 @@ public class ExtensionDescriptorBuilderTest
return new ByteArrayInputStream( xml.getBytes( StandardCharsets.UTF_8 ) );
}
+ @Test
public void testEmptyDescriptor()
throws Exception
{
@@ -78,6 +78,7 @@ public class ExtensionDescriptorBuilderTest
assertThat( ed.getExportedArtifacts(), is( empty() ) );
}
+ @Test
public void testCompleteDescriptor()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java b/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
index 6b4258b..7847093 100644
--- a/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/MavenProjectTest.java
@@ -28,11 +28,19 @@ import org.apache.maven.model.DependencyManagement;
import org.apache.maven.model.Model;
import org.apache.maven.model.Parent;
import org.apache.maven.model.Profile;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
public class MavenProjectTest
extends AbstractMavenProjectTestCase
{
+ @Test
public void testShouldInterpretChildPathAdjustmentBasedOnModulePaths()
throws IOException
{
@@ -59,6 +67,7 @@ public class MavenProjectTest
assertEquals( "..", adjustment );
}
+ @Test
public void testIdentityProtoInheritance()
{
Parent parent = new Parent();
@@ -82,6 +91,7 @@ public class MavenProjectTest
project.getId();
}
+ @Test
public void testEmptyConstructor()
{
MavenProject project = new MavenProject();
@@ -90,6 +100,7 @@ public class MavenProjectTest
+ MavenProject.EMPTY_PROJECT_VERSION, project.getId() );
}
+ @Test
public void testClone()
throws Exception
{
@@ -103,6 +114,7 @@ public class MavenProjectTest
assertTrue( "ManagedVersionMap is not empty", clonedMap.isEmpty() );
}
+ @Test
public void testCloneWithDependencyManagement()
throws Exception
{
@@ -127,6 +139,7 @@ public class MavenProjectTest
clonedMap.containsKey( "maven-test:maven-test-b:jar" ) );
}
+ @Test
public void testGetModulePathAdjustment()
throws IOException
{
@@ -146,6 +159,7 @@ public class MavenProjectTest
assertEquals( "..", pathAdjustment );
}
+ @Test
public void testCloneWithDistributionManagement()
throws Exception
{
@@ -157,6 +171,7 @@ public class MavenProjectTest
assertNotNull( "clonedProject - distributionManagement", clonedProject.getDistributionManagementArtifactRepository() );
}
+ @Test
public void testCloneWithActiveProfile()
throws Exception
{
@@ -177,6 +192,7 @@ public class MavenProjectTest
activeProfilesClone );
}
+ @Test
public void testCloneWithBaseDir()
throws Exception
{
@@ -188,6 +204,7 @@ public class MavenProjectTest
assertEquals( "Base directory is preserved across clone", projectToClone.getBasedir(), clonedProject.getBasedir() );
}
+ @Test
public void testUndefinedOutputDirectory()
throws Exception
{
@@ -198,6 +215,7 @@ public class MavenProjectTest
assertNoNulls( p.getTestClasspathElements() );
}
+ @Test
public void testAddDotFile()
{
MavenProject project = new MavenProject();
diff --git a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
index e953dbc..6562075 100644
--- a/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/PomConstructionTest.java
@@ -27,6 +27,9 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
+import javax.inject.Inject;
+
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
@@ -37,16 +40,23 @@ import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
-
-import javax.inject.Inject;
-
-import static org.hamcrest.Matchers.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.endsWith;
+import static org.hamcrest.Matchers.lessThan;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
public class PomConstructionTest
extends PlexusTestCase
@@ -82,7 +92,8 @@ public class PomConstructionTest
containerConfiguration.setClassPathScanning( PlexusConstants.SCANNING_INDEX );
}
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
getContainer();
@@ -90,8 +101,8 @@ public class PomConstructionTest
new File( getBasedir(), BASE_MIXIN_DIR );
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
projectBuilder = null;
@@ -104,7 +115,7 @@ public class PomConstructionTest
*
* @throws Exception
*/
-
+ @Test
public void testEmptyUrl()
throws Exception
{
@@ -117,6 +128,7 @@ public class PomConstructionTest
* @throws Exception
*/
/* MNG-786*/
+ @Test
public void testProfileModules()
throws Exception
{
@@ -134,6 +146,7 @@ public class PomConstructionTest
*
* @throws Exception
*/
+ @Test
public void testParentInheritance()
throws Exception
{
@@ -141,6 +154,7 @@ public class PomConstructionTest
}
/*MNG-3995*/
+ @Test
public void testExecutionConfigurationJoin()
throws Exception
{
@@ -149,6 +163,7 @@ public class PomConstructionTest
}
/*MNG-3803*/
+ @Test
public void testPluginConfigProperties()
throws Exception
{
@@ -157,6 +172,7 @@ public class PomConstructionTest
}
/*MNG-3900*/
+ @Test
public void testProfilePropertiesInterpolation()
throws Exception
{
@@ -188,6 +204,7 @@ public class PomConstructionTest
}
/*MNG- 4010*/
+ @Test
public void testDuplicateExclusionsDependency()
throws Exception
{
@@ -197,6 +214,7 @@ public class PomConstructionTest
}
/*MNG- 4008*/
+ @Test
public void testMultipleFilters()
throws Exception
{
@@ -220,6 +238,7 @@ public class PomConstructionTest
}
}
+ @Test
public void testValidationErrorUponNonUniqueDependencyManagementKey()
throws Exception
{
@@ -234,6 +253,7 @@ public class PomConstructionTest
}
}
+ @Test
public void testValidationErrorUponNonUniqueDependencyKeyInProfile()
throws Exception
{
@@ -248,6 +268,7 @@ public class PomConstructionTest
}
}
+ @Test
public void testValidationErrorUponNonUniqueDependencyManagementKeyInProfile()
throws Exception
{
@@ -262,7 +283,7 @@ public class PomConstructionTest
}
}
*/
-
+ @Test
public void testDuplicateDependenciesCauseLastDeclarationToBePickedInLenientMode()
throws Exception
{
@@ -272,6 +293,7 @@ public class PomConstructionTest
}
/* MNG-3567*/
+ @Test
public void testParentInterpolation()
throws Exception
{
@@ -295,6 +317,7 @@ public class PomConstructionTest
*/
/* MNG-3567*/
+ @Test
public void testPluginManagementInherited()
throws Exception
{
@@ -303,6 +326,7 @@ public class PomConstructionTest
}
/* MNG-2174*/
+ @Test
public void testPluginManagementDependencies()
throws Exception
{
@@ -313,6 +337,7 @@ public class PomConstructionTest
/* MNG-3877*/
+ @Test
public void testReportingInterpolation()
throws Exception
{
@@ -323,6 +348,7 @@ public class PomConstructionTest
}
+ @Test
public void testPluginOrder()
throws Exception
{
@@ -331,6 +357,7 @@ public class PomConstructionTest
assertEquals( "maven-surefire-plugin", pom.getValue( "build/plugins[2]/artifactId" ) );
}
+ @Test
public void testErroneousJoiningOfDifferentPluginsWithEqualDependencies()
throws Exception
{
@@ -342,6 +369,7 @@ public class PomConstructionTest
}
/** MNG-3821 */
+ @Test
public void testErroneousJoiningOfDifferentPluginsWithEqualExecutionIds()
throws Exception
{
@@ -357,6 +385,7 @@ public class PomConstructionTest
}
/** MNG-3998 */
+ @Test
public void testExecutionConfiguration()
throws Exception
{
@@ -375,8 +404,7 @@ public class PomConstructionTest
PomTestWrapper pom = buildPom( "plugin-config-duplicate/dup" );
}
*/
-
-
+ @Test
public void testSingleConfigurationInheritance()
throws Exception
{
@@ -389,6 +417,7 @@ public class PomConstructionTest
pom.getValue( "build/plugins[1]/executions[1]/configuration[1]/rules[1]/requireJavaVersion[1]/version" ) );
}
+ @Test
public void testConfigWithPluginManagement()
throws Exception
{
@@ -399,6 +428,7 @@ public class PomConstructionTest
}
/** MNG-3965 */
+ @Test
public void testExecutionConfigurationSubcollections()
throws Exception
{
@@ -407,6 +437,7 @@ public class PomConstructionTest
}
/** MNG-3985 */
+ @Test
public void testMultipleRepositories()
throws Exception
{
@@ -415,6 +446,7 @@ public class PomConstructionTest
}
/** MNG-3965 */
+ @Test
public void testMultipleExecutionIds()
throws Exception
{
@@ -423,12 +455,14 @@ public class PomConstructionTest
}
/** MNG-3997 */
+ @Test
public void testConsecutiveEmptyElements()
throws Exception
{
buildPom( "consecutive_empty_elements" );
}
+ @Test
public void testOrderOfGoalsFromPluginExecutionWithoutPluginManagement()
throws Exception
{
@@ -442,6 +476,7 @@ public class PomConstructionTest
}
/* MNG-3886*/
+ @Test
public void testOrderOfGoalsFromPluginExecutionWithPluginManagement()
throws Exception
{
@@ -454,6 +489,7 @@ public class PomConstructionTest
assertEquals( "e", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
}
+ @Test
public void testOrderOfPluginExecutionsWithoutPluginManagement()
throws Exception
{
@@ -467,6 +503,7 @@ public class PomConstructionTest
}
/* MNG-3887 */
+ @Test
public void testOrderOfPluginExecutionsWithPluginManagement()
throws Exception
{
@@ -479,6 +516,7 @@ public class PomConstructionTest
assertEquals( "e", pom.getValue( "build/plugins[1]/executions[5]/id" ) );
}
+ @Test
public void testMergeOfPluginExecutionsWhenChildInheritsPluginVersion()
throws Exception
{
@@ -487,6 +525,7 @@ public class PomConstructionTest
}
/* MNG-3943*/
+ @Test
public void testMergeOfPluginExecutionsWhenChildAndParentUseDifferentPluginVersions()
throws Exception
{
@@ -495,6 +534,7 @@ public class PomConstructionTest
}
+ @Test
public void testInterpolationWithXmlMarkup()
throws Exception
{
@@ -503,6 +543,7 @@ public class PomConstructionTest
}
/* MNG-3925 */
+ @Test
public void testOrderOfMergedPluginExecutionsWithoutPluginManagement()
throws Exception
{
@@ -515,6 +556,7 @@ public class PomConstructionTest
assertEquals( "child-2", pom.getValue( "build/plugins[1]/executions[5]/goals[1]" ) );
}
+ @Test
public void testOrderOfMergedPluginExecutionsWithPluginManagement()
throws Exception
{
@@ -528,6 +570,7 @@ public class PomConstructionTest
}
/* MNG-3984*/
+ @Test
public void testDifferentContainersWithSameId()
throws Exception
{
@@ -537,6 +580,7 @@ public class PomConstructionTest
}
/* MNG-3937*/
+ @Test
public void testOrderOfMergedPluginExecutionGoalsWithoutPluginManagement()
throws Exception
{
@@ -550,6 +594,7 @@ public class PomConstructionTest
assertEquals( "parent-a", pom.getValue( "build/plugins[1]/executions[1]/goals[5]" ) );
}
+ @Test
public void testOrderOfMergedPluginExecutionGoalsWithPluginManagement()
throws Exception
{
@@ -563,6 +608,7 @@ public class PomConstructionTest
}
/*MNG-3938*/
+ @Test
public void testOverridingOfInheritedPluginExecutionsWithoutPluginManagement()
throws Exception
{
@@ -573,6 +619,7 @@ public class PomConstructionTest
}
/* MNG-3938 */
+ @Test
public void testOverridingOfInheritedPluginExecutionsWithPluginManagement()
throws Exception
{
@@ -584,6 +631,7 @@ public class PomConstructionTest
/* MNG-3906*/
+ @Test
public void testOrderOfMergedPluginDependenciesWithoutPluginManagement()
throws Exception
{
@@ -603,6 +651,7 @@ public class PomConstructionTest
assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[5]/version" ) );
}
+ @Test
public void testOrderOfMergedPluginDependenciesWithPluginManagement()
throws Exception
{
@@ -620,6 +669,7 @@ public class PomConstructionTest
assertEquals( "1", pom.getValue( "build/plugins[1]/dependencies[5]/version" ) );
}
+ @Test
public void testInterpolationOfNestedBuildDirectories()
throws Exception
{
@@ -632,6 +682,7 @@ public class PomConstructionTest
new File( (String) pom.getValue( "properties/dir2" ) ) );
}
+ @Test
public void testAppendArtifactIdOfChildToInheritedUrls()
throws Exception
{
@@ -651,6 +702,7 @@ public class PomConstructionTest
}
/* MNG-3846*/
+ @Test
public void testAppendArtifactIdOfParentAndChildToInheritedUrls()
throws Exception
{
@@ -669,7 +721,7 @@ public class PomConstructionTest
assertEquals( "https://parent.url/download", pom.getValue( "distributionManagement/downloadUrl" ) );
}
//*/
-
+ @Test
public void testNonInheritedElementsInSubtreesOverriddenByChild()
throws Exception
{
@@ -692,6 +744,7 @@ public class PomConstructionTest
assertEquals( null, pom.getValue( "distributionManagement/site/name" ) );
}
+ @Test
public void testXmlTextCoalescing()
throws Exception
{
@@ -702,6 +755,7 @@ public class PomConstructionTest
pom.getValue( "properties/prop2" ).toString().trim().replaceAll( "[\n\r]", "" ).length() );
}
+ @Test
public void testFullInterpolationOfNestedExpressions()
throws Exception
{
@@ -713,6 +767,7 @@ public class PomConstructionTest
}
}
+ @Test
public void testInterpolationOfLegacyExpressionsThatDontIncludeTheProjectPrefix()
throws Exception
{
@@ -747,6 +802,7 @@ public class PomConstructionTest
assertThat( pom.getValue( "properties/projectSiteOut" ).toString(), endsWith( "doc" ) );
}
+ @Test
public void testInterpolationWithBasedirAlignedDirectories()
throws Exception
{
@@ -768,6 +824,7 @@ public class PomConstructionTest
}
/* MNG-3944*/
+ @Test
public void testInterpolationOfBasedirInPomWithUnusualName()
throws Exception
{
@@ -777,6 +834,7 @@ public class PomConstructionTest
}
/* MNG-3979 */
+ @Test
public void testJoiningOfContainersWhenChildHasEmptyElements()
throws Exception
{
@@ -784,6 +842,7 @@ public class PomConstructionTest
assertNotNull( pom );
}
+ @Test
public void testOrderOfPluginConfigurationElementsWithoutPluginManagement()
throws Exception
{
@@ -795,6 +854,7 @@ public class PomConstructionTest
}
/* MNG-3827*/
+ @Test
public void testOrderOfPluginConfigurationElementsWithPluginManagement()
throws Exception
{
@@ -805,6 +865,7 @@ public class PomConstructionTest
assertEquals( "four", pom.getValue( "build/plugins[1]/configuration/stringParams/stringParam[4]" ) );
}
+ @Test
public void testOrderOfPluginExecutionConfigurationElementsWithoutPluginManagement()
throws Exception
{
@@ -819,6 +880,7 @@ public class PomConstructionTest
}
/* MNG-3864*/
+ @Test
public void testOrderOfPluginExecutionConfigurationElementsWithPluginManagement()
throws Exception
{
@@ -833,6 +895,7 @@ public class PomConstructionTest
}
/* MNG-3836*/
+ @Test
public void testMergeOfInheritedPluginConfiguration()
throws Exception
{
@@ -852,6 +915,7 @@ public class PomConstructionTest
}
/* MNG-2591 */
+ @Test
public void testAppendOfInheritedPluginConfigurationWithNoProfile()
throws Exception
{
@@ -859,6 +923,7 @@ public class PomConstructionTest
}
/* MNG-2591*/
+ @Test
public void testAppendOfInheritedPluginConfigurationWithActiveProfile()
throws Exception
{
@@ -891,6 +956,7 @@ public class PomConstructionTest
}
/* MNG-4000 */
+ @Test
public void testMultiplePluginExecutionsWithAndWithoutIdsWithoutPluginManagement()
throws Exception
{
@@ -900,6 +966,7 @@ public class PomConstructionTest
assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
}
+ @Test
public void testMultiplePluginExecutionsWithAndWithoutIdsWithPluginManagement()
throws Exception
{
@@ -909,6 +976,7 @@ public class PomConstructionTest
assertEquals( "log-string", pom.getValue( "build/plugins[1]/executions[2]/goals[1]" ) );
}
+ @Test
public void testDependencyOrderWithoutPluginManagement()
throws Exception
{
@@ -920,6 +988,7 @@ public class PomConstructionTest
assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
}
+ @Test
public void testDependencyOrderWithPluginManagement()
throws Exception
{
@@ -931,6 +1000,7 @@ public class PomConstructionTest
assertEquals( "d", pom.getValue( "dependencies[4]/artifactId" ) );
}
+ @Test
public void testBuildDirectoriesUsePlatformSpecificFileSeparator()
throws Exception
{
@@ -947,6 +1017,7 @@ public class PomConstructionTest
}
/* MNG-4008 */
+ @Test
public void testMergedFilterOrder()
throws Exception
{
@@ -963,6 +1034,7 @@ public class PomConstructionTest
}
/** MNG-4027*/
+ @Test
public void testProfileInjectedDependencies()
throws Exception
{
@@ -975,6 +1047,7 @@ public class PomConstructionTest
}
/** IT-0021*/
+ @Test
public void testProfileDependenciesMultipleProfiles()
throws Exception
{
@@ -982,6 +1055,7 @@ public class PomConstructionTest
assertEquals(2, ( (List<?>) pom.getValue( "dependencies" ) ).size() );
}
+ @Test
public void testDependencyInheritance()
throws Exception
{
@@ -991,6 +1065,7 @@ public class PomConstructionTest
}
/** MNG-4034 */
+ @Test
public void testManagedProfileDependency()
throws Exception
{
@@ -1005,6 +1080,7 @@ public class PomConstructionTest
}
/** MNG-4040 */
+ @Test
public void testProfileModuleInheritance()
throws Exception
{
@@ -1013,6 +1089,7 @@ public class PomConstructionTest
}
/** MNG-3621 */
+ @Test
public void testUncPath()
throws Exception
{
@@ -1021,6 +1098,7 @@ public class PomConstructionTest
}
/** MNG-2006 */
+ @Test
public void testUrlAppendWithChildPathAdjustment()
throws Exception
{
@@ -1033,6 +1111,7 @@ public class PomConstructionTest
}
/** MNG-0479 */
+ @Test
public void testRepoInheritance()
throws Exception
{
@@ -1041,6 +1120,7 @@ public class PomConstructionTest
assertEquals( "it0043", pom.getValue( "repositories[1]/name" ) );
}
+ @Test
public void testEmptyScm()
throws Exception
{
@@ -1048,6 +1128,7 @@ public class PomConstructionTest
assertNull( pom.getValue( "scm" ) );
}
+ @Test
public void testPluginConfigurationUsingAttributesWithoutPluginManagement()
throws Exception
{
@@ -1060,6 +1141,7 @@ public class PomConstructionTest
}
/** MNG-4053*/
+ @Test
public void testPluginConfigurationUsingAttributesWithPluginManagement()
throws Exception
{
@@ -1071,6 +1153,7 @@ public class PomConstructionTest
assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@overwrite" ) );
}
+ @Test
public void testPluginConfigurationUsingAttributesWithPluginManagementAndProfile()
throws Exception
{
@@ -1082,6 +1165,7 @@ public class PomConstructionTest
assertEquals( null, pom.getValue( "build/plugins[1]/configuration/domParam/copy/fileset/@overwrite" ) );
}
+ @Test
public void testPomEncoding()
throws Exception
{
@@ -1092,6 +1176,7 @@ public class PomConstructionTest
}
/* MNG-4070 */
+ @Test
public void testXmlWhitespaceHandling()
throws Exception
{
@@ -1100,6 +1185,7 @@ public class PomConstructionTest
}
/* MNG-3760*/
+ @Test
public void testInterpolationOfBaseUri()
throws Exception
{
@@ -1108,6 +1194,7 @@ public class PomConstructionTest
}
/* MNG-6386 */
+ @Test
public void testInterpolationOfRfc3986BaseUri()
throws Exception
{
@@ -1118,6 +1205,7 @@ public class PomConstructionTest
}
/* MNG-3811*/
+ @Test
public void testReportingPluginConfig()
throws Exception
{
@@ -1130,6 +1218,7 @@ public class PomConstructionTest
assertEquals( "true", pom.getValue( "reporting/plugins[1]/configuration/booleanParam" ) );
}
+ @Test
public void testPropertiesNoDuplication()
throws Exception
{
@@ -1138,6 +1227,7 @@ public class PomConstructionTest
assertEquals( "child", pom.getValue( "properties/pomProfile" ) );
}
+ @Test
public void testPomInheritance()
throws Exception
{
@@ -1146,6 +1236,7 @@ public class PomConstructionTest
assertEquals( "jar", pom.getValue( "packaging" ) );
}
+ @Test
public void testCompleteModelWithoutParent()
throws Exception
{
@@ -1154,6 +1245,7 @@ public class PomConstructionTest
testCompleteModel( pom );
}
+ @Test
public void testCompleteModelWithParent()
throws Exception
{
@@ -1369,7 +1461,7 @@ public class PomConstructionTest
}
/* MNG-2309*/
-
+ @Test
public void testProfileInjectionOrder()
throws Exception
{
@@ -1378,6 +1470,7 @@ public class PomConstructionTest
assertEquals( "e", pom.getValue( "properties[1]/pomProperty" ) );
}
+ @Test
public void testPropertiesInheritance()
throws Exception
{
@@ -1388,6 +1481,7 @@ public class PomConstructionTest
}
/* MNG-4102*/
+ @Test
public void testInheritedPropertiesInterpolatedWithValuesFromChildWithoutProfiles()
throws Exception
{
@@ -1398,6 +1492,7 @@ public class PomConstructionTest
}
/* MNG-4102 */
+ @Test
public void testInheritedPropertiesInterpolatedWithValuesFromChildWithActiveProfiles()
throws Exception
{
@@ -1411,6 +1506,7 @@ public class PomConstructionTest
}
/* MNG-3545 */
+ @Test
public void testProfileDefaultActivation()
throws Exception
{
@@ -1421,6 +1517,7 @@ public class PomConstructionTest
}
/* MNG-1995 */
+ @Test
public void testBooleanInterpolation()
throws Exception
{
@@ -1431,6 +1528,7 @@ public class PomConstructionTest
/* MNG-3899 */
+ @Test
public void testBuildExtensionInheritance()
throws Exception
{
@@ -1443,6 +1541,7 @@ public class PomConstructionTest
}
/*MNG-1957*/
+ @Test
public void testJdkActivation()
throws Exception
{
@@ -1457,6 +1556,7 @@ public class PomConstructionTest
}
/* MNG-2174 */
+ @Test
public void testProfilePluginMngDependencies()
throws Exception
{
@@ -1465,6 +1565,7 @@ public class PomConstructionTest
}
/** MNG-4116 */
+ @Test
public void testPercentEncodedUrlsMustNotBeDecoded()
throws Exception
{
@@ -1483,6 +1584,7 @@ public class PomConstructionTest
pom.getValue( "distributionManagement/site/url" ) );
}
+ @Test
public void testPluginManagementInheritance()
throws Exception
{
@@ -1491,6 +1593,7 @@ public class PomConstructionTest
pom.getValue( "build/pluginManagement/plugins[@artifactId='maven-compiler-plugin']/version" ) );
}
+ @Test
public void testProfilePlugins()
throws Exception
{
@@ -1499,6 +1602,7 @@ public class PomConstructionTest
assertEquals( "maven-assembly2-plugin", pom.getValue( "build/plugins[2]/artifactId" ) );
}
+ @Test
public void testPluginInheritanceSimple()
throws Exception
{
@@ -1506,6 +1610,7 @@ public class PomConstructionTest
assertEquals( 2, ( (List<?>) pom.getValue( "build/plugins" ) ).size() );
}
+ @Test
public void testPluginManagementDuplicate()
throws Exception
{
@@ -1513,6 +1618,7 @@ public class PomConstructionTest
assertEquals( 8, ( (List<?>) pom.getValue( "build/pluginManagement/plugins" ) ).size() );
}
+ @Test
public void testDistributionManagement()
throws Exception
{
@@ -1520,6 +1626,7 @@ public class PomConstructionTest
assertEquals( "legacy", pom.getValue( "distributionManagement/repository/layout" ) );
}
+ @Test
public void testDependencyScopeInheritance()
throws Exception
{
@@ -1528,6 +1635,7 @@ public class PomConstructionTest
assertEquals( "compile", scope );
}
+ @Test
public void testDependencyScope()
throws Exception
{
@@ -1541,6 +1649,7 @@ public class PomConstructionTest
buildPom( "dependency-management-with-interpolation/sub" );
}
+ @Test
public void testInterpolationWithSystemProperty()
throws Exception
{
@@ -1551,6 +1660,7 @@ public class PomConstructionTest
}
/* MNG-4129 */
+ @Test
public void testPluginExecutionInheritanceWhenChildDoesNotDeclarePlugin()
throws Exception
{
@@ -1562,6 +1672,7 @@ public class PomConstructionTest
assertEquals( "inherited-execution", executions.get( 0 ).getId() );
}
+ @Test
public void testPluginExecutionInheritanceWhenChildDoesDeclarePluginAsWell()
throws Exception
{
@@ -1574,6 +1685,7 @@ public class PomConstructionTest
}
/* MNG-4193 */
+ @Test
public void testValidationErrorUponNonUniqueArtifactRepositoryId()
throws Exception
{
@@ -1589,6 +1701,7 @@ public class PomConstructionTest
}
/* MNG-4193 */
+ @Test
public void testValidationErrorUponNonUniquePluginRepositoryId()
throws Exception
{
@@ -1604,6 +1717,7 @@ public class PomConstructionTest
}
/* MNG-4193 */
+ @Test
public void testValidationErrorUponNonUniqueArtifactRepositoryIdInProfile()
throws Exception
{
@@ -1619,6 +1733,7 @@ public class PomConstructionTest
}
/* MNG-4193 */
+ @Test
public void testValidationErrorUponNonUniquePluginRepositoryIdInProfile()
throws Exception
{
@@ -1634,6 +1749,7 @@ public class PomConstructionTest
}
/** MNG-3843 */
+ @Test
public void testPrerequisitesAreNotInherited()
throws Exception
{
@@ -1641,6 +1757,7 @@ public class PomConstructionTest
assertSame( null, pom.getValue( "prerequisites" ) );
}
+ @Test
public void testLicensesAreInheritedButNotAggregated()
throws Exception
{
@@ -1650,6 +1767,7 @@ public class PomConstructionTest
assertEquals( "https://child.url/license", pom.getValue( "licenses[1]/url" ) );
}
+ @Test
public void testDevelopersAreInheritedButNotAggregated()
throws Exception
{
@@ -1658,6 +1776,7 @@ public class PomConstructionTest
assertEquals( "child-developer", pom.getValue( "developers[1]/name" ) );
}
+ @Test
public void testContributorsAreInheritedButNotAggregated()
throws Exception
{
@@ -1666,6 +1785,7 @@ public class PomConstructionTest
assertEquals( "child-contributor", pom.getValue( "contributors[1]/name" ) );
}
+ @Test
public void testMailingListsAreInheritedButNotAggregated()
throws Exception
{
@@ -1674,6 +1794,7 @@ public class PomConstructionTest
assertEquals( "child-mailing-list", pom.getValue( "mailingLists[1]/name" ) );
}
+ @Test
public void testPluginInheritanceOrder()
throws Exception
{
@@ -1688,6 +1809,7 @@ public class PomConstructionTest
assertEquals( "maven-it-plugin-configuration", pom.getValue( "reporting/plugins[3]/artifactId" ) );
}
+ @Test
public void testCliPropsDominateProjectPropsDuringInterpolation()
throws Exception
{
@@ -1698,6 +1820,7 @@ public class PomConstructionTest
assertEquals( "PASSED", pom.getValue( "properties/interpolatedProperty" ) );
}
+ @Test
public void testParentPomPackagingMustBePom()
throws Exception
{
@@ -1713,6 +1836,7 @@ public class PomConstructionTest
}
/** MNG-522, MNG-3018 */
+ @Test
public void testManagedPluginConfigurationAppliesToImplicitPluginsIntroducedByPackaging()
throws Exception
{
@@ -1723,6 +1847,7 @@ public class PomConstructionTest
pom.getValue( "build/plugins[@artifactId='maven-it-plugin-log-file']/configuration/logFile" ) );
}
+ @Test
public void testDefaultPluginsExecutionContributedByPackagingExecuteBeforeUserDefinedExecutions()
throws Exception
{
@@ -1738,6 +1863,7 @@ public class PomConstructionTest
assertEquals( "test-2", executions.get( 3 ).getId() );
}
+ @Test
public void testPluginDeclarationsRetainPomOrderAfterInjectionOfDefaultPlugins()
throws Exception
{
@@ -1764,6 +1890,7 @@ public class PomConstructionTest
}
/** MNG-4415 */
+ @Test
public void testPluginOrderAfterMergingWithInheritedPlugins()
throws Exception
{
@@ -1793,6 +1920,7 @@ public class PomConstructionTest
}
/** MNG-4416 */
+ @Test
public void testPluginOrderAfterMergingWithInjectedPlugins()
throws Exception
{
@@ -1821,6 +1949,7 @@ public class PomConstructionTest
assertEquals( actual, expected );
}
+ @Test
public void testProjectArtifactIdIsNotInheritedButMandatory()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
index 74c19a8..025f196 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ProjectBuilderTest.java
@@ -19,14 +19,6 @@ package org.apache.maven.project;
* under the License.
*/
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.Matchers.greaterThan;
-import static org.hamcrest.Matchers.hasKey;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThrows;
-
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -42,6 +34,18 @@ import org.apache.maven.model.building.FileModelSource;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelSource;
import org.apache.maven.shared.utils.io.FileUtils;
+import org.junit.Test;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.greaterThan;
+import static org.hamcrest.Matchers.hasKey;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.assertTrue;
public class ProjectBuilderTest
@@ -53,6 +57,7 @@ public class ProjectBuilderTest
return "src/test/projects/project-builder";
}
+ @Test
public void testSystemScopeDependencyIsPresentInTheCompileClasspathElements()
throws Exception
{
@@ -70,6 +75,7 @@ public class ProjectBuilderTest
project.getCompileClasspathElements();
}
+ @Test
public void testBuildFromModelSource()
throws Exception
{
@@ -84,6 +90,7 @@ public class ProjectBuilderTest
assertNotNull( result.getProject().getParentFile() );
}
+ @Test
public void testVersionlessManagedDependency()
throws Exception
{
@@ -99,6 +106,7 @@ public class ProjectBuilderTest
+ "@ line 9, column 17" ) );
}
+ @Test
public void testResolveDependencies()
throws Exception
{
@@ -120,6 +128,7 @@ public class ProjectBuilderTest
assertEquals( 1, mavenProject.getArtifacts().size() );
}
+ @Test
public void testDontResolveDependencies()
throws Exception
{
@@ -139,6 +148,7 @@ public class ProjectBuilderTest
assertEquals( 0, mavenProject.getArtifacts().size() );
}
+ @Test
public void testReadModifiedPoms() throws Exception {
String initialValue = System.setProperty( DefaultProjectBuilder.DISABLE_GLOBAL_MODEL_CACHE_SYSTEM_PROPERTY, Boolean.toString( true ) );
// TODO a similar test should be created to test the dependency management (basically all usages
@@ -179,6 +189,7 @@ public class ProjectBuilderTest
}
}
+ @Test
public void testReadErroneousMavenProjectContainsReference()
throws Exception
{
@@ -212,6 +223,7 @@ public class ProjectBuilderTest
assertEquals( pomFile, project2.getFile() );
}
+ @Test
public void testReadInvalidPom()
throws Exception
{
@@ -237,6 +249,7 @@ public class ProjectBuilderTest
assertThat( pex.getMessage(), containsString( "expected START_TAG or END_TAG not TEXT" ) );
}
+ @Test
public void testReadParentAndChildWithRegularVersionSetParentFile()
throws Exception
{
@@ -297,6 +310,7 @@ public class ProjectBuilderTest
}
}
+ @Test
public void testBuildProperties()
throws Exception
{
@@ -314,6 +328,7 @@ public class ProjectBuilderTest
assertEquals( 1, project.getResources().size() );
}
+ @Test
public void testPropertyInPluginManagementGroupId()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/project/ProjectModelResolverTest.java b/maven-core/src/test/java/org/apache/maven/project/ProjectModelResolverTest.java
index fb1c642..c83a692 100644
--- a/maven-core/src/test/java/org/apache/maven/project/ProjectModelResolverTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/ProjectModelResolverTest.java
@@ -19,9 +19,6 @@ package org.apache.maven.project;
* under the License.
*/
-import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertThat;
-
import java.io.File;
import java.util.Collections;
import java.util.List;
@@ -36,6 +33,13 @@ import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.impl.RemoteRepositoryManager;
import org.eclipse.aether.repository.RemoteRepository;
+import org.junit.Test;
+
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.fail;
/**
* Test cases for the project {@code ModelResolver} implementation.
@@ -54,6 +58,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
super();
}
+ @Test
public void testResolveParentThrowsUnresolvableModelExceptionWhenNotFound() throws Exception
{
final Parent parent = new Parent();
@@ -73,6 +78,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveParentThrowsUnresolvableModelExceptionWhenNoMatchingVersionFound() throws Exception
{
final Parent parent = new Parent();
@@ -93,6 +99,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveParentThrowsUnresolvableModelExceptionWhenUsingRangesWithoutUpperBound() throws Exception
{
final Parent parent = new Parent();
@@ -113,6 +120,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveParentSuccessfullyResolvesExistingParentWithoutRange() throws Exception
{
final Parent parent = new Parent();
@@ -124,6 +132,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
assertEquals( "1", parent.getVersion() );
}
+ @Test
public void testResolveParentSuccessfullyResolvesExistingParentUsingHighestVersion() throws Exception
{
final Parent parent = new Parent();
@@ -135,6 +144,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
assertEquals( "1", parent.getVersion() );
}
+ @Test
public void testResolveDependencyThrowsUnresolvableModelExceptionWhenNotFound() throws Exception
{
final Dependency dependency = new Dependency();
@@ -154,6 +164,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveDependencyThrowsUnresolvableModelExceptionWhenNoMatchingVersionFound() throws Exception
{
final Dependency dependency = new Dependency();
@@ -174,6 +185,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveDependencyThrowsUnresolvableModelExceptionWhenUsingRangesWithoutUpperBound() throws Exception
{
final Dependency dependency = new Dependency();
@@ -194,6 +206,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
}
}
+ @Test
public void testResolveDependencySuccessfullyResolvesExistingDependencyWithoutRange() throws Exception
{
final Dependency dependency = new Dependency();
@@ -205,6 +218,7 @@ public class ProjectModelResolverTest extends AbstractMavenProjectTestCase
assertEquals( "1", dependency.getVersion() );
}
+ @Test
public void testResolveDependencySuccessfullyResolvesExistingDependencyUsingHighestVersion() throws Exception
{
final Dependency dependency = new Dependency();
diff --git a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java
index c039934..e6d8710 100644
--- a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultMavenMetadataCacheTest.java
@@ -29,32 +29,35 @@ import org.apache.maven.project.artifact.DefaultMavenMetadataCache.CacheKey;
import org.apache.maven.repository.DelegatingLocalArtifactRepository;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.TestRepositorySystem;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotSame;
/**
* @author Igor Fedorenko
*/
public class DefaultMavenMetadataCacheTest
- extends TestCase
{
private RepositorySystem repositorySystem;
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
repositorySystem = new TestRepositorySystem( null, null );
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
repositorySystem = null;
- super.tearDown();
}
+ @Test
public void testCacheKey()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCacheTest.java b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCacheTest.java
index cbe4b35..d02da76 100644
--- a/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCacheTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/artifact/DefaultProjectArtifactsCacheTest.java
@@ -19,29 +19,28 @@ package org.apache.maven.project.artifact;
* under the License.
*/
-import static org.junit.Assert.assertArrayEquals;
-
import java.util.LinkedHashSet;
import java.util.Set;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
-
-public class DefaultProjectArtifactsCacheTest extends TestCase
+import static org.junit.Assert.assertArrayEquals;
+public class DefaultProjectArtifactsCacheTest
{
private ProjectArtifactsCache cache;
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
cache = new DefaultProjectArtifactsCache();
}
+ @Test
public void testProjectDependencyOrder() throws Exception
{
ProjectArtifactsCache.Key project1 = new ProjectArtifactsCache.Key(){};
diff --git a/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java b/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
index beaa149..5b3beac 100644
--- a/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/artifact/MavenMetadataSourceTest.java
@@ -19,10 +19,13 @@ package org.apache.maven.project.artifact;
* under the License.
*/
+import org.apache.maven.PlexusTestCase;
import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.DefaultPlexusContainer;
-import org.codehaus.plexus.PlexusTestCase;
+import org.junit.After;
+import org.junit.Before;
import org.junit.Ignore;
+import org.junit.Test;
import javax.inject.Inject;
import java.util.Collections;
@@ -44,20 +47,23 @@ public class MavenMetadataSourceTest
}
@Override
- protected void setUp() throws Exception
+ @Before
+ public void setUp()
+ throws Exception
{
super.setUp();
getContainer();
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
repositorySystem = null;
super.tearDown();
}
+ @Test
public void testShouldNotCarryExclusionsOverFromDependencyToDependency()
throws Exception
{
@@ -144,6 +150,7 @@ public class MavenMetadataSourceTest
assertEquals( "default scope NOT back-propagated to dependency.", Artifact.SCOPE_COMPILE, dep.getScope() );
}
+ @Test
public void testShouldUseInjectedTestScopeFromDependencyManagement()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java b/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
index 8b6454d..f0c07b3 100644
--- a/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
+++ b/maven-core/src/test/java/org/apache/maven/project/canonical/CanonicalProjectBuilderTest.java
@@ -27,6 +27,10 @@ import org.apache.maven.model.PluginExecution;
import org.apache.maven.project.AbstractMavenProjectTestCase;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* @author Jason van Zyl
@@ -34,6 +38,7 @@ import org.codehaus.plexus.util.xml.Xpp3Dom;
public class CanonicalProjectBuilderTest
extends AbstractMavenProjectTestCase
{
+ @Test
public void testProjectBuilder()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformationTest.java b/maven-core/src/test/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformationTest.java
index 9e5d6ea..a4f61b6 100644
--- a/maven-core/src/test/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformationTest.java
+++ b/maven-core/src/test/java/org/apache/maven/rtinfo/internal/DefaultRuntimeInformationTest.java
@@ -23,7 +23,13 @@ import org.apache.maven.rtinfo.RuntimeInformation;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import javax.inject.Inject;
import java.util.Collections;
@@ -44,12 +50,6 @@ public class DefaultRuntimeInformationTest
}
@Override
- protected void setUp() throws Exception
- {
- super.setUp();
- getContainer();
- }
- @Override
protected synchronized void setupContainer()
{
super.setupContainer();
@@ -58,6 +58,7 @@ public class DefaultRuntimeInformationTest
binder -> binder.requestInjection( this ) );
}
+ @Test
public void testGetMavenVersion()
{
String mavenVersion = rtInfo.getMavenVersion();
@@ -65,6 +66,7 @@ public class DefaultRuntimeInformationTest
assertTrue( mavenVersion.length() > 0 );
}
+ @Test
public void testIsMavenVersion()
{
assertTrue( rtInfo.isMavenVersion( "2.0" ) );
diff --git a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
index 4d66b0f..db75136 100644
--- a/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
+++ b/maven-core/src/test/java/org/apache/maven/settings/PomConstructionWithSettingsTest.java
@@ -19,6 +19,10 @@ package org.apache.maven.settings;
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.model.Profile;
import org.apache.maven.project.DefaultProjectBuilder;
@@ -28,15 +32,19 @@ import org.apache.maven.project.harness.PomTestWrapper;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
+import org.checkerframework.checker.units.qual.A;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.DefaultPlexusContainer;
import org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusTestCase;
+import org.apache.maven.PlexusTestCase;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
import javax.inject.Inject;
import java.io.File;
@@ -44,6 +52,8 @@ import java.io.IOException;
import java.io.Reader;
import java.util.Collections;
+import static org.junit.Assert.assertEquals;
+
public class PomConstructionWithSettingsTest
extends PlexusTestCase
{
@@ -76,22 +86,16 @@ public class PomConstructionWithSettingsTest
binder -> binder.requestInjection( this ) );
}
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
+ super.setUp();
getContainer();
testDirectory = new File( getBasedir(), BASE_POM_DIR );
}
- @Override
- protected void tearDown()
- throws Exception
- {
- projectBuilder = null;
-
- super.tearDown();
- }
-
+ @Test
public void testSettingsNoPom()
throws Exception
{
@@ -102,6 +106,7 @@ public class PomConstructionWithSettingsTest
/**
* MNG-4107
*/
+ @Test
public void testPomAndSettingsInterpolation()
throws Exception
{
@@ -115,6 +120,7 @@ public class PomConstructionWithSettingsTest
/**
* MNG-4107
*/
+ @Test
public void testRepositories()
throws Exception
{
diff --git a/maven-core/src/test/java/org/apache/maven/settings/SettingsUtilsTest.java b/maven-core/src/test/java/org/apache/maven/settings/SettingsUtilsTest.java
index 78818c5..4431a75 100644
--- a/maven-core/src/test/java/org/apache/maven/settings/SettingsUtilsTest.java
+++ b/maven-core/src/test/java/org/apache/maven/settings/SettingsUtilsTest.java
@@ -19,17 +19,20 @@ package org.apache.maven.settings;
* under the License.
*/
-import junit.framework.TestCase;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.Random;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
public class SettingsUtilsTest
- extends TestCase
{
+ @Test
public void testShouldAppendRecessivePluginGroupIds()
{
Settings dominant = new Settings();
@@ -50,6 +53,7 @@ public class SettingsUtilsTest
assertEquals( "org.codehaus.plexus", pluginGroups.get( 2 ) );
}
+ @Test
public void testRoundTripProfiles()
{
Random entropy = new Random();
diff --git a/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java b/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
index c102b11..8da23be 100644
--- a/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
+++ b/maven-core/src/test/java/org/apache/maven/toolchain/RequirementMatcherFactoryTest.java
@@ -19,24 +19,23 @@
package org.apache.maven.toolchain;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
/**
*
* @author mkleint
*/
public class RequirementMatcherFactoryTest
- extends TestCase
{
- public RequirementMatcherFactoryTest( String testName )
- {
- super( testName );
- }
-
/**
* Test of createExactMatcher method, of class RequirementMatcherFactory.
*/
+ @Test
public void testCreateExactMatcher()
{
RequirementMatcher matcher;
@@ -50,6 +49,7 @@ public class RequirementMatcherFactoryTest
/**
* Test of createVersionMatcher method, of class RequirementMatcherFactory.
*/
+ @Test
public void testCreateVersionMatcher()
{
RequirementMatcher matcher;
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java
index 2c82a72..14e6bac 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/CLIManagerDocumentationTest.java
@@ -29,15 +29,13 @@ import java.util.List;
import org.apache.commons.cli.Option;
import org.codehaus.plexus.util.FileUtils;
-
-import junit.framework.TestCase;
+import org.junit.Test;
/**
* Pseudo test to generate documentation fragment about supported CLI options. TODO such documentation generation code
* should not be necessary as unit test but should be run during site generation (Velocity? Doxia macro?)
*/
public class CLIManagerDocumentationTest
- extends TestCase
{
private final static String LS = System.lineSeparator();
@@ -98,6 +96,7 @@ public class CLIManagerDocumentationTest
return sb.toString();
}
+ @Test
public void testOptionsAsHtml()
throws IOException
{
diff --git a/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java b/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
index 65488c7..0d1262c 100644
--- a/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/cli/CLIReportingUtilsTest.java
@@ -19,12 +19,14 @@ package org.apache.maven.cli;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
public class CLIReportingUtilsTest
- extends TestCase
{
+ @Test
public void testFormatDuration()
{
assertEquals( "0.001 s", CLIReportingUtils.formatDuration( 1 ) );
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/ComplexActivationTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/ComplexActivationTest.java
index 9ef31b3..ed384d0 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/ComplexActivationTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/ComplexActivationTest.java
@@ -19,16 +19,19 @@ package org.apache.maven.model.building;
* under the License.
*/
-import junit.framework.TestCase;
-
import java.io.File;
import java.util.Properties;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
/**
* @author Konstantin Perikov
*/
public class ComplexActivationTest
- extends TestCase
{
private File getPom( String name )
@@ -36,6 +39,7 @@ public class ComplexActivationTest
return new File( "src/test/resources/poms/factory/" + name + ".xml" ).getAbsoluteFile();
}
+ @Test
public void testAndConditionInActivation()
throws Exception
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderFactoryTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderFactoryTest.java
index 90b65a4..1f869d0 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderFactoryTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/DefaultModelBuilderFactoryTest.java
@@ -22,14 +22,15 @@ package org.apache.maven.model.building;
import java.io.File;
import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* @author Benjamin Bentmann
*/
public class DefaultModelBuilderFactoryTest
- extends TestCase
{
private File getPom( String name )
@@ -37,6 +38,7 @@ public class DefaultModelBuilderFactoryTest
return new File( "src/test/resources/poms/factory/" + name + ".xml" ).getAbsoluteFile();
}
+ @Test
public void testCompleteWiring()
throws Exception
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
index 996adf8..569cfc9 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileModelSourceTest.java
@@ -18,13 +18,16 @@ package org.apache.maven.model.building;
* specific language governing permissions and limitations
* under the License.
*/
+
import java.io.File;
import java.io.IOException;
+
+import org.apache.commons.lang3.SystemUtils;
+import org.junit.Test;
+
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
-import org.apache.commons.lang3.SystemUtils;
import static org.junit.Assume.assumeTrue;
-import org.junit.Test;
/**
* Test that validate the solution of MNG-6261 issue
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileToRawModelMergerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileToRawModelMergerTest.java
index 9dd3f55..1c8b29b 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/FileToRawModelMergerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/FileToRawModelMergerTest.java
@@ -19,9 +19,6 @@ package org.apache.maven.model.building;
* under the License.
*/
-import static org.hamcrest.Matchers.hasItems;
-import static org.junit.Assert.assertThat;
-
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
@@ -33,6 +30,9 @@ import org.apache.maven.model.building.DefaultModelBuilder.FileToRawModelMerger;
import org.apache.maven.model.merge.ModelMerger;
import org.junit.Test;
+import static org.hamcrest.Matchers.hasItems;
+import static org.junit.Assert.assertThat;
+
public class FileToRawModelMergerTest
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/building/SimpleProblemCollector.java b/maven-model-builder/src/test/java/org/apache/maven/model/building/SimpleProblemCollector.java
index 64e9b38..b311d77 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/building/SimpleProblemCollector.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/building/SimpleProblemCollector.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.apache.maven.model.Model;
-
/**
* A simple model problem collector for testing the model building components.
*
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
index 2b1eed8..777c47d 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/inheritance/DefaultInheritanceAssemblerTest.java
@@ -19,6 +19,17 @@ package org.apache.maven.model.inheritance;
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.function.Consumer;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerConfigurationException;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+
import org.apache.maven.model.Model;
import org.apache.maven.model.building.AbstractModelSourceTransformer;
import org.apache.maven.model.building.SimpleProblemCollector;
@@ -27,27 +38,18 @@ import org.apache.maven.model.io.DefaultModelReader;
import org.apache.maven.model.io.DefaultModelWriter;
import org.apache.maven.model.io.ModelWriter;
import org.apache.maven.xml.sax.filter.AbstractSAXFilter;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
+import org.junit.Before;
+import org.junit.Test;
import org.xmlunit.matchers.CompareMatcher;
-import junit.framework.TestCase;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.function.Consumer;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author Hervé Boutemy
*/
public class DefaultInheritanceAssemblerTest
- extends TestCase
{
private DefaultModelReader reader;
@@ -55,12 +57,10 @@ public class DefaultInheritanceAssemblerTest
private InheritanceAssembler assembler;
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
-
reader = new DefaultModelReader();
reader.setTransformer( new AbstractModelSourceTransformer()
{
@@ -87,6 +87,7 @@ public class DefaultInheritanceAssemblerTest
return reader.read( getPom( name ), null );
}
+ @Test
public void testPluginConfiguration()
throws Exception
{
@@ -98,6 +99,7 @@ public class DefaultInheritanceAssemblerTest
* and child directory == artifactId
* @throws IOException Model read problem
*/
+ @Test
public void testUrls()
throws Exception
{
@@ -108,6 +110,7 @@ public class DefaultInheritanceAssemblerTest
* Flat directory structure: parent & child POMs in sibling directories, child directory == artifactId.
* @throws IOException Model read problem
*/
+ @Test
public void testFlatUrls()
throws IOException
{
@@ -118,6 +121,7 @@ public class DefaultInheritanceAssemblerTest
* MNG-5951 MNG-6059 child.x.y.inherit.append.path="false" test
* @throws Exception
*/
+ @Test
public void testNoAppendUrls()
throws Exception
{
@@ -128,6 +132,7 @@ public class DefaultInheritanceAssemblerTest
* MNG-5951 special case test: inherit with partial override
* @throws Exception
*/
+ @Test
public void testNoAppendUrls2()
throws Exception
{
@@ -138,6 +143,7 @@ public class DefaultInheritanceAssemblerTest
* MNG-5951 special case test: child.x.y.inherit.append.path="true" in child should not reset content
* @throws Exception
*/
+ @Test
public void testNoAppendUrls3()
throws Exception
{
@@ -150,6 +156,7 @@ public class DefaultInheritanceAssemblerTest
* This is why MNG-5000 fix in code is marked as bad practice (uses file names)
* @throws IOException Model read problem
*/
+ @Test
public void testFlatTrickyUrls()
throws IOException
{
@@ -189,6 +196,7 @@ public class DefaultInheritanceAssemblerTest
}
}
+ @Test
public void testWithEmptyUrl()
throws IOException
{
@@ -232,6 +240,7 @@ public class DefaultInheritanceAssemblerTest
assertThat( actual, CompareMatcher.isIdenticalTo( expected ).ignoreComments().ignoreWhitespace() );
}
+ @Test
public void testModulePathNotArtifactId()
throws IOException
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
index 01cac27..d32aa68 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/AbstractModelInterpolatorTest.java
@@ -19,6 +19,15 @@ package org.apache.maven.model.interpolation;
* under the License.
*/
+import java.io.File;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.TimeZone;
+
import org.apache.maven.model.Build;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
@@ -29,20 +38,12 @@ import org.apache.maven.model.Scm;
import org.apache.maven.model.building.DefaultModelBuildingRequest;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.SimpleProblemCollector;
-
import org.junit.Before;
import org.junit.Test;
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.TimeZone;
-
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author jdcasey
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
index 8af32fc..56dc49c 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/MavenBuildTimestampTest.java
@@ -22,11 +22,13 @@ package org.apache.maven.model.interpolation;
import java.util.Date;
import java.util.Properties;
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertTrue;
public class MavenBuildTimestampTest
- extends TestCase
{
+ @Test
public void testMavenBuildTimestampUsesUTC()
{
Properties interpolationProperties = new Properties();
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
index dbb72c4..0d27cae 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/interpolation/StringSearchModelInterpolatorTest.java
@@ -19,6 +19,19 @@ package org.apache.maven.model.interpolation;
* under the License.
*/
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
import org.apache.maven.model.InputLocation;
import org.apache.maven.model.InputSource;
import org.apache.maven.model.Model;
@@ -27,14 +40,6 @@ import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.SimpleProblemCollector;
import org.junit.Test;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.*;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
-
import static org.hamcrest.CoreMatchers.anyOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/merge/MavenModelMergerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/merge/MavenModelMergerTest.java
index c23be0f..906a8b2 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/merge/MavenModelMergerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/merge/MavenModelMergerTest.java
@@ -20,9 +20,6 @@ package org.apache.maven.model.merge;
* under the License.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
import java.util.Collections;
import org.apache.maven.model.Model;
@@ -30,6 +27,9 @@ import org.apache.maven.model.Prerequisites;
import org.apache.maven.model.Profile;
import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
public class MavenModelMergerTest
{
private MavenModelMerger modelMerger = new MavenModelMerger();
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/path/DefaultUrlNormalizerTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/path/DefaultUrlNormalizerTest.java
index 095ff62..76135e2 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/path/DefaultUrlNormalizerTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/path/DefaultUrlNormalizerTest.java
@@ -19,11 +19,11 @@ package org.apache.maven.model.path;
* under the License.
*/
+import org.junit.Test;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import org.junit.Test;
-
/**
* @author Benjamin Bentmann
*/
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/AbstractProfileActivatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/AbstractProfileActivatorTest.java
index 5198d04..8544d2a 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/AbstractProfileActivatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/AbstractProfileActivatorTest.java
@@ -1,7 +1,5 @@
package org.apache.maven.model.profile.activation;
-import java.util.Objects;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -21,14 +19,17 @@ import java.util.Objects;
* under the License.
*/
+import java.util.Objects;
import java.util.Properties;
import org.apache.maven.model.Profile;
import org.apache.maven.model.building.SimpleProblemCollector;
import org.apache.maven.model.profile.DefaultProfileActivationContext;
import org.apache.maven.model.profile.ProfileActivationContext;
+import org.junit.After;
+import org.junit.Before;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
/**
* Provides common services to test {@link ProfileActivator} implementations.
@@ -36,7 +37,6 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public abstract class AbstractProfileActivatorTest<T extends ProfileActivator>
- extends TestCase
{
private Class<T> activatorClass;
@@ -48,22 +48,18 @@ public abstract class AbstractProfileActivatorTest<T extends ProfileActivator>
this.activatorClass = Objects.requireNonNull( activatorClass, "activatorClass cannot be null" );;
}
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
-
activator = activatorClass.getConstructor().newInstance();
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
activator = null;
-
- super.tearDown();
}
protected ProfileActivationContext newContext( final Properties userProperties, final Properties systemProperties )
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivatorTest.java
index 440f120..92ad135 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/JdkVersionProfileActivatorTest.java
@@ -23,6 +23,7 @@ import java.util.Properties;
import org.apache.maven.model.Activation;
import org.apache.maven.model.Profile;
+import org.junit.Test;
/**
* Tests {@link JdkVersionProfileActivator}.
@@ -56,6 +57,7 @@ public class JdkVersionProfileActivatorTest
return props;
}
+ @Test
public void testNullSafe()
throws Exception
{
@@ -68,6 +70,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( false, p, newContext( null, null ) );
}
+ @Test
public void testPrefix()
throws Exception
{
@@ -83,6 +86,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( false, profile, newContext( null, newProperties( "1.5" ) ) );
}
+ @Test
public void testPrefixNegated()
throws Exception
{
@@ -98,6 +102,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( true, profile, newContext( null, newProperties( "1.5" ) ) );
}
+ @Test
public void testVersionRangeInclusiveBounds()
throws Exception
{
@@ -120,6 +125,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09-b03" ) ) );
}
+ @Test
public void testVersionRangeExclusiveBounds()
throws Exception
{
@@ -143,6 +149,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( false, profile, newContext( null, newProperties( "1.6" ) ) );
}
+ @Test
public void testVersionRangeInclusiveLowerBound()
throws Exception
{
@@ -165,6 +172,7 @@ public class JdkVersionProfileActivatorTest
assertActivation( true, profile, newContext( null, newProperties( "1.6.0_09-b03" ) ) );
}
+ @Test
public void testVersionRangeExclusiveUpperBound()
throws Exception
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/PropertyProfileActivatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/PropertyProfileActivatorTest.java
index 73ab967..3bffea2 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/PropertyProfileActivatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/profile/activation/PropertyProfileActivatorTest.java
@@ -24,6 +24,7 @@ import java.util.Properties;
import org.apache.maven.model.Activation;
import org.apache.maven.model.ActivationProperty;
import org.apache.maven.model.Profile;
+import org.junit.Test;
/**
* Tests {@link PropertyProfileActivator}.
@@ -61,6 +62,7 @@ public class PropertyProfileActivatorTest
return props;
}
+ @Test
public void testNullSafe()
throws Exception
{
@@ -73,6 +75,7 @@ public class PropertyProfileActivatorTest
assertActivation( false, p, newContext( null, null ) );
}
+ @Test
public void testWithNameOnly_UserProperty()
throws Exception
{
@@ -85,6 +88,7 @@ public class PropertyProfileActivatorTest
assertActivation( false, profile, newContext( newProperties( "other", "value" ), null ) );
}
+ @Test
public void testWithNameOnly_SystemProperty()
throws Exception
{
@@ -97,6 +101,7 @@ public class PropertyProfileActivatorTest
assertActivation( false, profile, newContext( null, newProperties( "other", "value" ) ) );
}
+ @Test
public void testWithNegatedNameOnly_UserProperty()
throws Exception
{
@@ -109,6 +114,7 @@ public class PropertyProfileActivatorTest
assertActivation( true, profile, newContext( newProperties( "other", "value" ), null ) );
}
+ @Test
public void testWithNegatedNameOnly_SystemProperty()
throws Exception
{
@@ -121,6 +127,7 @@ public class PropertyProfileActivatorTest
assertActivation( true, profile, newContext( null, newProperties( "other", "value" ) ) );
}
+ @Test
public void testWithValue_UserProperty()
throws Exception
{
@@ -133,6 +140,7 @@ public class PropertyProfileActivatorTest
assertActivation( false, profile, newContext( newProperties( "prop", "" ), null ) );
}
+ @Test
public void testWithValue_SystemProperty()
throws Exception
{
@@ -145,6 +153,7 @@ public class PropertyProfileActivatorTest
assertActivation( false, profile, newContext( null, newProperties( "other", "" ) ) );
}
+ @Test
public void testWithNegatedValue_UserProperty()
throws Exception
{
@@ -157,6 +166,7 @@ public class PropertyProfileActivatorTest
assertActivation( true, profile, newContext( newProperties( "prop", "" ), null ) );
}
+ @Test
public void testWithNegatedValue_SystemProperty()
throws Exception
{
@@ -169,6 +179,7 @@ public class PropertyProfileActivatorTest
assertActivation( true, profile, newContext( null, newProperties( "other", "" ) ) );
}
+ @Test
public void testWithValue_UserPropertyDominantOverSystemProperty()
throws Exception
{
diff --git a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
index 7e94234..3e4457c 100644
--- a/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
+++ b/maven-model-builder/src/test/java/org/apache/maven/model/validation/DefaultModelValidatorTest.java
@@ -27,14 +27,18 @@ import org.apache.maven.model.building.DefaultModelBuildingRequest;
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.SimpleProblemCollector;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
*/
public class DefaultModelValidatorTest
- extends TestCase
{
private ModelValidator validator;
@@ -95,22 +99,18 @@ public class DefaultModelValidatorTest
assertTrue( "\"" + substring + "\" was not found in: " + msg, msg.contains( substring ) );
}
- @Override
- protected void setUp()
+ @Before
+ public void setUp()
throws Exception
{
- super.setUp();
-
validator = new DefaultModelValidator();
}
- @Override
- protected void tearDown()
+ @After
+ public void tearDown()
throws Exception
{
this.validator = null;
-
- super.tearDown();
}
private void assertViolations( SimpleProblemCollector result, int fatals, int errors, int warnings )
@@ -120,6 +120,7 @@ public class DefaultModelValidatorTest
assertEquals( String.valueOf( result.getWarnings() ), warnings, result.getWarnings().size() );
}
+ @Test
public void testMissingModelVersion()
throws Exception
{
@@ -130,6 +131,7 @@ public class DefaultModelValidatorTest
assertEquals( "'modelVersion' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testBadModelVersion()
throws Exception
{
@@ -141,6 +143,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getFatals().get( 0 ).contains( "modelVersion" ) );
}
+ @Test
public void testMissingArtifactId()
throws Exception
{
@@ -151,6 +154,7 @@ public class DefaultModelValidatorTest
assertEquals( "'artifactId' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testMissingGroupId()
throws Exception
{
@@ -161,6 +165,7 @@ public class DefaultModelValidatorTest
assertEquals( "'groupId' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testInvalidIds()
throws Exception
{
@@ -174,6 +179,7 @@ public class DefaultModelValidatorTest
result.getErrors().get( 1 ) );
}
+ @Test
public void testMissingType()
throws Exception
{
@@ -184,6 +190,7 @@ public class DefaultModelValidatorTest
assertEquals( "'packaging' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testMissingVersion()
throws Exception
{
@@ -194,6 +201,7 @@ public class DefaultModelValidatorTest
assertEquals( "'version' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testInvalidAggregatorPackaging()
throws Exception
{
@@ -204,6 +212,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "Aggregator projects require 'pom' as packaging." ) );
}
+ @Test
public void testMissingDependencyArtifactId()
throws Exception
{
@@ -214,6 +223,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'dependencies.dependency.artifactId' for groupId:null:jar is missing" ) );
}
+ @Test
public void testMissingDependencyGroupId()
throws Exception
{
@@ -224,6 +234,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'dependencies.dependency.groupId' for null:artifactId:jar is missing" ) );
}
+ @Test
public void testMissingDependencyVersion()
throws Exception
{
@@ -234,6 +245,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'dependencies.dependency.version' for groupId:artifactId:jar is missing" ) );
}
+ @Test
public void testMissingDependencyManagementArtifactId()
throws Exception
{
@@ -244,6 +256,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'dependencyManagement.dependencies.dependency.artifactId' for groupId:null:jar is missing" ) );
}
+ @Test
public void testMissingDependencyManagementGroupId()
throws Exception
{
@@ -254,6 +267,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'dependencyManagement.dependencies.dependency.groupId' for null:artifactId:jar is missing" ) );
}
+ @Test
public void testMissingAll()
throws Exception
{
@@ -270,6 +284,7 @@ public class DefaultModelValidatorTest
// type is inherited from the super pom
}
+ @Test
public void testMissingPluginArtifactId()
throws Exception
{
@@ -280,6 +295,7 @@ public class DefaultModelValidatorTest
assertEquals( "'build.plugins.plugin.artifactId' is missing.", result.getErrors().get( 0 ) );
}
+ @Test
public void testEmptyPluginVersion()
throws Exception
{
@@ -291,6 +307,7 @@ public class DefaultModelValidatorTest
+ " must be a valid version but is ''.", result.getErrors().get( 0 ) );
}
+ @Test
public void testMissingRepositoryId()
throws Exception
{
@@ -308,6 +325,7 @@ public class DefaultModelValidatorTest
assertEquals( "'pluginRepositories.pluginRepository.[null].url' is missing.", result.getErrors().get( 3 ) );
}
+ @Test
public void testMissingResourceDirectory()
throws Exception
{
@@ -320,6 +338,7 @@ public class DefaultModelValidatorTest
assertEquals( "'build.testResources.testResource.directory' is missing.", result.getErrors().get( 1 ) );
}
+ @Test
public void testBadPluginDependencyScope()
throws Exception
{
@@ -334,6 +353,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 2 ).contains( "test:f" ) );
}
+ @Test
public void testBadDependencyScope()
throws Exception
{
@@ -346,6 +366,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getWarnings().get( 1 ).contains( "test:g" ) );
}
+ @Test
public void testBadDependencyManagementScope()
throws Exception
{
@@ -356,6 +377,7 @@ public class DefaultModelValidatorTest
assertContains( result.getWarnings().get( 0 ), "test:g" );
}
+ @Test
public void testBadDependencyVersion()
throws Exception
{
@@ -369,6 +391,7 @@ public class DefaultModelValidatorTest
"'dependencies.dependency.version' for test:c:jar must not contain any of these characters" );
}
+ @Test
public void testDuplicateModule()
throws Exception
{
@@ -379,6 +402,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "child" ) );
}
+ @Test
public void testDuplicateProfileId()
throws Exception
{
@@ -389,6 +413,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "non-unique-id" ) );
}
+ @Test
public void testBadPluginVersion()
throws Exception
{
@@ -406,6 +431,7 @@ public class DefaultModelValidatorTest
"'build.plugins.plugin.version' for test:ifsc must not contain any of these characters" );
}
+ @Test
public void testDistributionManagementStatus()
throws Exception
{
@@ -416,6 +442,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "distributionManagement.status" ) );
}
+ @Test
public void testIncompleteParent()
throws Exception
{
@@ -427,6 +454,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getFatals().get( 2 ).contains( "parent.version" ) );
}
+ @Test
public void testHardCodedSystemPath()
throws Exception
{
@@ -451,6 +479,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testEmptyModule()
throws Exception
{
@@ -461,6 +490,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "'modules.module[0]' has been specified without a path" ) );
}
+ @Test
public void testDuplicatePlugin()
throws Exception
{
@@ -474,6 +504,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getWarnings().get( 3 ).contains( "duplicate declaration of plugin profile:managed-duplicate" ) );
}
+ @Test
public void testDuplicatePluginExecution()
throws Exception
{
@@ -487,6 +518,7 @@ public class DefaultModelValidatorTest
assertContains( result.getErrors().get( 3 ), "duplicate execution with id b" );
}
+ @Test
public void testReservedRepositoryId()
throws Exception
{
@@ -501,6 +533,7 @@ public class DefaultModelValidatorTest
"'distributionManagement.snapshotRepository.id' must not be 'local'" );
}
+ @Test
public void testMissingPluginDependencyGroupId()
throws Exception
{
@@ -511,6 +544,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( ":a:" ) );
}
+ @Test
public void testMissingPluginDependencyArtifactId()
throws Exception
{
@@ -521,6 +555,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "test:" ) );
}
+ @Test
public void testMissingPluginDependencyVersion()
throws Exception
{
@@ -531,6 +566,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "test:a" ) );
}
+ @Test
public void testBadPluginDependencyVersion()
throws Exception
{
@@ -541,6 +577,7 @@ public class DefaultModelValidatorTest
assertTrue( result.getErrors().get( 0 ).contains( "test:b" ) );
}
+ @Test
public void testBadVersion()
throws Exception
{
@@ -551,6 +588,7 @@ public class DefaultModelValidatorTest
assertContains( result.getWarnings().get( 0 ), "'version' must not contain any of these characters" );
}
+ @Test
public void testBadSnapshotVersion()
throws Exception
{
@@ -561,6 +599,7 @@ public class DefaultModelValidatorTest
assertContains( result.getWarnings().get( 0 ), "'version' uses an unsupported snapshot version format" );
}
+ @Test
public void testBadRepositoryId()
throws Exception
{
@@ -578,6 +617,7 @@ public class DefaultModelValidatorTest
"'distributionManagement.snapshotRepository.id' must not contain any of these characters" );
}
+ @Test
public void testBadDependencyExclusionId()
throws Exception
{
@@ -599,6 +639,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testMissingDependencyExclusionId()
throws Exception
{
@@ -612,6 +653,7 @@ public class DefaultModelValidatorTest
"'dependencies.dependency.exclusions.exclusion.artifactId' for gid:aid:jar is missing" );
}
+ @Test
public void testBadImportScopeType()
throws Exception
{
@@ -623,6 +665,7 @@ public class DefaultModelValidatorTest
"'dependencyManagement.dependencies.dependency.type' for test:a:jar must be 'pom'" );
}
+ @Test
public void testBadImportScopeClassifier()
throws Exception
{
@@ -634,6 +677,7 @@ public class DefaultModelValidatorTest
"'dependencyManagement.dependencies.dependency.classifier' for test:a:pom:cls must be empty" );
}
+ @Test
public void testSystemPathRefersToProjectBasedir()
throws Exception
{
@@ -661,6 +705,7 @@ public class DefaultModelValidatorTest
"'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory" );
}
+ @Test
public void testInvalidVersionInPluginManagement()
throws Exception
{
@@ -673,6 +718,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testInvalidGroupIdInPluginManagement()
throws Exception
{
@@ -685,6 +731,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testInvalidArtifactIdInPluginManagement()
throws Exception
{
@@ -697,6 +744,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testInvalidGroupAndArtifactIdInPluginManagement()
throws Exception
{
@@ -712,6 +760,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testMissingReportPluginVersion()
throws Exception
{
@@ -720,6 +769,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testDeprecatedDependencyMetaversionsLatestAndRelease()
throws Exception
{
@@ -733,6 +783,7 @@ public class DefaultModelValidatorTest
"'dependencies.dependency.version' for test:b:jar is either LATEST or RELEASE (both of them are being deprecated)" );
}
+ @Test
public void testSelfReferencingDependencyInRawModel()
throws Exception
{
@@ -745,6 +796,7 @@ public class DefaultModelValidatorTest
}
+ @Test
public void testSelfReferencingDependencyWithClassifierInRawModel() throws Exception
{
SimpleProblemCollector result = validateRaw( "raw-model/self-referencing-classifier.xml" );
@@ -752,6 +804,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testCiFriendlySha1()
throws Exception
{
@@ -759,6 +812,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testCiFriendlyRevision()
throws Exception
{
@@ -766,6 +820,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testCiFriendlyChangeList()
throws Exception
{
@@ -773,6 +828,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testCiFriendlyAllExpressions()
throws Exception
{
@@ -780,6 +836,7 @@ public class DefaultModelValidatorTest
assertViolations( result, 0, 0, 0 );
}
+ @Test
public void testCiFriendlyBad()
throws Exception
{
@@ -788,6 +845,7 @@ public class DefaultModelValidatorTest
assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
}
+ @Test
public void testCiFriendlyBadSha1Plus()
throws Exception
{
@@ -796,6 +854,7 @@ public class DefaultModelValidatorTest
assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
}
+ @Test
public void testCiFriendlyBadSha1Plus2()
throws Exception
{
@@ -804,6 +863,7 @@ public class DefaultModelValidatorTest
assertEquals( "'version' contains an expression but should be a constant.", result.getWarnings().get( 0 ) );
}
+ @Test
public void testParentVersionLATEST()
throws Exception
{
@@ -812,6 +872,7 @@ public class DefaultModelValidatorTest
assertEquals( "'parent.version' is either LATEST or RELEASE (both of them are being deprecated)", result.getWarnings().get( 0 ) );
}
+ @Test
public void testParentVersionRELEASE()
throws Exception
{
diff --git a/maven-model/src/test/java/org/apache/maven/model/ActivationFileTest.java b/maven-model/src/test/java/org/apache/maven/model/ActivationFileTest.java
index f88da58..c95eb0f 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ActivationFileTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ActivationFileTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code ActivationFile}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ActivationFileTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new ActivationFile().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new ActivationFile().equals( null ) );
@@ -42,12 +47,14 @@ public class ActivationFileTest
new ActivationFile().equals( new ActivationFile() );
}
+ @Test
public void testEqualsIdentity()
{
ActivationFile thing = new ActivationFile();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new ActivationFile().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ActivationOSTest.java b/maven-model/src/test/java/org/apache/maven/model/ActivationOSTest.java
index f0d3045..d6d8509 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ActivationOSTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ActivationOSTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code ActivationOS}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ActivationOSTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new ActivationOS().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new ActivationOS().equals( null ) );
@@ -42,12 +47,14 @@ public class ActivationOSTest
new ActivationOS().equals( new ActivationOS() );
}
+ @Test
public void testEqualsIdentity()
{
ActivationOS thing = new ActivationOS();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new ActivationOS().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ActivationPropertyTest.java b/maven-model/src/test/java/org/apache/maven/model/ActivationPropertyTest.java
index 5f5e048..3fae4e0 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ActivationPropertyTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ActivationPropertyTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code ActivationProperty}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ActivationPropertyTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new ActivationProperty().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new ActivationProperty().equals( null ) );
@@ -42,12 +47,14 @@ public class ActivationPropertyTest
new ActivationProperty().equals( new ActivationProperty() );
}
+ @Test
public void testEqualsIdentity()
{
ActivationProperty thing = new ActivationProperty();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new ActivationProperty().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ActivationTest.java b/maven-model/src/test/java/org/apache/maven/model/ActivationTest.java
index f6d0f91..a9d4acd 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ActivationTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ActivationTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Activation}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ActivationTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Activation().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Activation().equals( null ) );
@@ -42,12 +47,14 @@ public class ActivationTest
new Activation().equals( new Activation() );
}
+ @Test
public void testEqualsIdentity()
{
Activation thing = new Activation();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Activation().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/BuildTest.java b/maven-model/src/test/java/org/apache/maven/model/BuildTest.java
index 80a60d5..f16de69 100644
--- a/maven-model/src/test/java/org/apache/maven/model/BuildTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/BuildTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Build}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class BuildTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Build().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Build().equals( null ) );
@@ -42,12 +47,14 @@ public class BuildTest
new Build().equals( new Build() );
}
+ @Test
public void testEqualsIdentity()
{
Build thing = new Build();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Build().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/CiManagementTest.java b/maven-model/src/test/java/org/apache/maven/model/CiManagementTest.java
index 7194c84..8ed000e 100644
--- a/maven-model/src/test/java/org/apache/maven/model/CiManagementTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/CiManagementTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code CiManagement}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class CiManagementTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new CiManagement().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new CiManagement().equals( null ) );
@@ -42,12 +47,14 @@ public class CiManagementTest
new CiManagement().equals( new CiManagement() );
}
+ @Test
public void testEqualsIdentity()
{
CiManagement thing = new CiManagement();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new CiManagement().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ContributorTest.java b/maven-model/src/test/java/org/apache/maven/model/ContributorTest.java
index 491b99a..9171503 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ContributorTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ContributorTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Contributor}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ContributorTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Contributor().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Contributor().equals( null ) );
@@ -42,12 +47,14 @@ public class ContributorTest
new Contributor().equals( new Contributor() );
}
+ @Test
public void testEqualsIdentity()
{
Contributor thing = new Contributor();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Contributor().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/DependencyManagementTest.java b/maven-model/src/test/java/org/apache/maven/model/DependencyManagementTest.java
index 7702c62..70ebd51 100644
--- a/maven-model/src/test/java/org/apache/maven/model/DependencyManagementTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/DependencyManagementTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code DependencyManagement}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class DependencyManagementTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new DependencyManagement().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new DependencyManagement().equals( null ) );
@@ -42,12 +47,14 @@ public class DependencyManagementTest
new DependencyManagement().equals( new DependencyManagement() );
}
+ @Test
public void testEqualsIdentity()
{
DependencyManagement thing = new DependencyManagement();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new DependencyManagement().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/DependencyTest.java b/maven-model/src/test/java/org/apache/maven/model/DependencyTest.java
index ec0a833..4210e09 100644
--- a/maven-model/src/test/java/org/apache/maven/model/DependencyTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/DependencyTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Dependency}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class DependencyTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Dependency().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Dependency().equals( null ) );
@@ -42,12 +47,14 @@ public class DependencyTest
new Dependency().equals( new Dependency() );
}
+ @Test
public void testEqualsIdentity()
{
Dependency thing = new Dependency();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Dependency().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/DeploymentRepositoryTest.java b/maven-model/src/test/java/org/apache/maven/model/DeploymentRepositoryTest.java
index 169ec65..95037f5 100644
--- a/maven-model/src/test/java/org/apache/maven/model/DeploymentRepositoryTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/DeploymentRepositoryTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code DeploymentRepository}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class DeploymentRepositoryTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new DeploymentRepository().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new DeploymentRepository().equals( null ) );
@@ -42,12 +47,14 @@ public class DeploymentRepositoryTest
new DeploymentRepository().equals( new DeploymentRepository() );
}
+ @Test
public void testEqualsIdentity()
{
DeploymentRepository thing = new DeploymentRepository();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new DeploymentRepository().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/DeveloperTest.java b/maven-model/src/test/java/org/apache/maven/model/DeveloperTest.java
index c0dfe56..54c6b73 100644
--- a/maven-model/src/test/java/org/apache/maven/model/DeveloperTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/DeveloperTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Developer}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class DeveloperTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Developer().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Developer().equals( null ) );
@@ -42,12 +47,14 @@ public class DeveloperTest
new Developer().equals( new Developer() );
}
+ @Test
public void testEqualsIdentity()
{
Developer thing = new Developer();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Developer().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/DistributionManagementTest.java b/maven-model/src/test/java/org/apache/maven/model/DistributionManagementTest.java
index 0314d61..91b9395 100644
--- a/maven-model/src/test/java/org/apache/maven/model/DistributionManagementTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/DistributionManagementTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code DistributionManagement}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class DistributionManagementTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new DistributionManagement().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new DistributionManagement().equals( null ) );
@@ -42,12 +47,14 @@ public class DistributionManagementTest
new DistributionManagement().equals( new DistributionManagement() );
}
+ @Test
public void testEqualsIdentity()
{
DistributionManagement thing = new DistributionManagement();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new DistributionManagement().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ExclusionTest.java b/maven-model/src/test/java/org/apache/maven/model/ExclusionTest.java
index 6febace..7aba6c7 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ExclusionTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ExclusionTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Exclusion}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ExclusionTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Exclusion().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Exclusion().equals( null ) );
@@ -42,12 +47,14 @@ public class ExclusionTest
new Exclusion().equals( new Exclusion() );
}
+ @Test
public void testEqualsIdentity()
{
Exclusion thing = new Exclusion();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Exclusion().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ExtensionTest.java b/maven-model/src/test/java/org/apache/maven/model/ExtensionTest.java
index 4b8cd8a..da40b0d 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ExtensionTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ExtensionTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Extension}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ExtensionTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Extension().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Extension().equals( null ) );
@@ -42,12 +47,14 @@ public class ExtensionTest
new Extension().equals( new Extension() );
}
+ @Test
public void testEqualsIdentity()
{
Extension thing = new Extension();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Extension().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/IssueManagementTest.java b/maven-model/src/test/java/org/apache/maven/model/IssueManagementTest.java
index 5e50c15..2ca800d 100644
--- a/maven-model/src/test/java/org/apache/maven/model/IssueManagementTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/IssueManagementTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code IssueManagement}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class IssueManagementTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new IssueManagement().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new IssueManagement().equals( null ) );
@@ -42,12 +47,14 @@ public class IssueManagementTest
new IssueManagement().equals( new IssueManagement() );
}
+ @Test
public void testEqualsIdentity()
{
IssueManagement thing = new IssueManagement();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new IssueManagement().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/LicenseTest.java b/maven-model/src/test/java/org/apache/maven/model/LicenseTest.java
index 179921b..739c139 100644
--- a/maven-model/src/test/java/org/apache/maven/model/LicenseTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/LicenseTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code License}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class LicenseTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new License().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new License().equals( null ) );
@@ -42,12 +47,14 @@ public class LicenseTest
new License().equals( new License() );
}
+ @Test
public void testEqualsIdentity()
{
License thing = new License();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new License().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/MailingListTest.java b/maven-model/src/test/java/org/apache/maven/model/MailingListTest.java
index 6129695..0171ab8 100644
--- a/maven-model/src/test/java/org/apache/maven/model/MailingListTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/MailingListTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code MailingList}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class MailingListTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new MailingList().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new MailingList().equals( null ) );
@@ -42,12 +47,14 @@ public class MailingListTest
new MailingList().equals( new MailingList() );
}
+ @Test
public void testEqualsIdentity()
{
MailingList thing = new MailingList();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new MailingList().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ModelTest.java b/maven-model/src/test/java/org/apache/maven/model/ModelTest.java
index c9ec4da..4910549 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ModelTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ModelTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Model}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ModelTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Model().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Model().equals( null ) );
@@ -42,12 +47,14 @@ public class ModelTest
new Model().equals( new Model() );
}
+ @Test
public void testEqualsIdentity()
{
Model thing = new Model();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Model().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/NotifierTest.java b/maven-model/src/test/java/org/apache/maven/model/NotifierTest.java
index 4e5d068..f0da085 100644
--- a/maven-model/src/test/java/org/apache/maven/model/NotifierTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/NotifierTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Notifier}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class NotifierTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Notifier().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Notifier().equals( null ) );
@@ -42,12 +47,14 @@ public class NotifierTest
new Notifier().equals( new Notifier() );
}
+ @Test
public void testEqualsIdentity()
{
Notifier thing = new Notifier();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Notifier().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/OrganizationTest.java b/maven-model/src/test/java/org/apache/maven/model/OrganizationTest.java
index 48abe77..71f1f3b 100644
--- a/maven-model/src/test/java/org/apache/maven/model/OrganizationTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/OrganizationTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Organization}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class OrganizationTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Organization().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Organization().equals( null ) );
@@ -42,12 +47,14 @@ public class OrganizationTest
new Organization().equals( new Organization() );
}
+ @Test
public void testEqualsIdentity()
{
Organization thing = new Organization();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Organization().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/ParentTest.java b/maven-model/src/test/java/org/apache/maven/model/ParentTest.java
index 78d4567..3007e15 100644
--- a/maven-model/src/test/java/org/apache/maven/model/ParentTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/ParentTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Parent}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class ParentTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Parent().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Parent().equals( null ) );
@@ -42,12 +47,14 @@ public class ParentTest
new Parent().equals( new Parent() );
}
+ @Test
public void testEqualsIdentity()
{
Parent thing = new Parent();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Parent().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PluginConfigurationTest.java b/maven-model/src/test/java/org/apache/maven/model/PluginConfigurationTest.java
index cbb123d..34ea7ad 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PluginConfigurationTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PluginConfigurationTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code PluginConfiguration}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PluginConfigurationTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new PluginConfiguration().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new PluginConfiguration().equals( null ) );
@@ -42,12 +47,14 @@ public class PluginConfigurationTest
new PluginConfiguration().equals( new PluginConfiguration() );
}
+ @Test
public void testEqualsIdentity()
{
PluginConfiguration thing = new PluginConfiguration();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new PluginConfiguration().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PluginContainerTest.java b/maven-model/src/test/java/org/apache/maven/model/PluginContainerTest.java
index 878298c..e9e4f52 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PluginContainerTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PluginContainerTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code PluginContainer}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PluginContainerTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new PluginContainer().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new PluginContainer().equals( null ) );
@@ -42,12 +47,14 @@ public class PluginContainerTest
new PluginContainer().equals( new PluginContainer() );
}
+ @Test
public void testEqualsIdentity()
{
PluginContainer thing = new PluginContainer();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new PluginContainer().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PluginExecutionTest.java b/maven-model/src/test/java/org/apache/maven/model/PluginExecutionTest.java
index e8fff51..4613727 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PluginExecutionTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PluginExecutionTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code PluginExecution}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PluginExecutionTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new PluginExecution().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new PluginExecution().equals( null ) );
@@ -42,12 +47,14 @@ public class PluginExecutionTest
new PluginExecution().equals( new PluginExecution() );
}
+ @Test
public void testEqualsIdentity()
{
PluginExecution thing = new PluginExecution();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new PluginExecution().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PluginManagementTest.java b/maven-model/src/test/java/org/apache/maven/model/PluginManagementTest.java
index 571399f..49af4af 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PluginManagementTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PluginManagementTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code PluginManagement}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PluginManagementTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new PluginManagement().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new PluginManagement().equals( null ) );
@@ -42,12 +47,14 @@ public class PluginManagementTest
new PluginManagement().equals( new PluginManagement() );
}
+ @Test
public void testEqualsIdentity()
{
PluginManagement thing = new PluginManagement();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new PluginManagement().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PluginTest.java b/maven-model/src/test/java/org/apache/maven/model/PluginTest.java
index 582145e..f67abba 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PluginTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PluginTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Plugin}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PluginTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Plugin().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Plugin().equals( null ) );
@@ -42,12 +47,14 @@ public class PluginTest
new Plugin().equals( new Plugin() );
}
+ @Test
public void testEqualsIdentity()
{
Plugin thing = new Plugin();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
assertNotNull( new Plugin().toString() );
diff --git a/maven-model/src/test/java/org/apache/maven/model/PrerequisitesTest.java b/maven-model/src/test/java/org/apache/maven/model/PrerequisitesTest.java
index 727f2c3..c4f7ef5 100644
--- a/maven-model/src/test/java/org/apache/maven/model/PrerequisitesTest.java
+++ b/maven-model/src/test/java/org/apache/maven/model/PrerequisitesTest.java
@@ -19,7 +19,11 @@ package org.apache.maven.model;
* under the License.
*/
-import junit.framework.TestCase;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests {@code Prerequisites}.
@@ -27,14 +31,15 @@ import junit.framework.TestCase;
* @author Benjamin Bentmann
*/
public class PrerequisitesTest
- extends TestCase
{
+ @Test
public void testHashCodeNullSafe()
{
new Prerequisites().hashCode();
}
+ @Test
public void testEqualsNullSafe()
{
assertFalse( new Prerequisites().equals( null ) );
@@ -42,12 +47,14 @@ public class PrerequisitesTest
new Prerequisites().equals( new Prerequisites() );
}
+ @Test
public void testEqualsIdentity()
{
Prerequisites thing = new Prerequisites();
assertTrue( thing.equals( thing ) );
}
+ @Test
public void testToStringNullSafe()
{
... 1392 lines suppressed ...