maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r769976 - /maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java
Date Wed, 29 Apr 2009 22:42:15 GMT
Author: jdcasey
Date: Wed Apr 29 22:42:15 2009
New Revision: 769976

URL: http://svn.apache.org/viewvc?rev=769976&view=rev
Log:
[MNG-2365] Adding unit test from patch, to verify test vs. compile classpath ordering.

Modified:
    maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java

Modified: maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java?rev=769976&r1=769975&r2=769976&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java
(original)
+++ maven/components/branches/maven-2.2.x/maven-project/src/test/java/org/apache/maven/project/MavenProjectTest.java
Wed Apr 29 22:42:15 2009
@@ -24,6 +24,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
 import org.apache.maven.artifact.versioning.ManagedVersionMap;
 import org.apache.maven.model.DependencyManagement;
 import org.apache.maven.model.Model;
@@ -33,6 +34,22 @@
     extends AbstractMavenProjectTestCase
 {
 
+    public void testTestClasspathOrdering()
+        throws DependencyResolutionRequiredException
+    {
+        Model model = new Model();
+
+        MavenProject project = new MavenProject( model );
+        project.getBuild().setOutputDirectory( "main" );
+        project.getBuild().setTestOutputDirectory( "test" );
+
+        List testClasspath = project.getTestClasspathElements();
+
+        // test-classes should be before main-classes, see MNG-3118
+        assertEquals( "test", new File( (String) testClasspath.get( 0 ) ).getName() );
+        assertEquals( "main", new File( (String) testClasspath.get( 1 ) ).getName() );
+    }
+
     public void testShouldInterpretChildPathAdjustmentBasedOnModulePaths()
         throws IOException
     {
@@ -46,7 +63,9 @@
 
         MavenProject childProject = new MavenProject( childModel );
 
-        File childFile = new File( System.getProperty( "java.io.tmpdir" ), "maven-project-tests"
+ System.currentTimeMillis() + "/child/pom.xml" );
+        File childFile =
+            new File( System.getProperty( "java.io.tmpdir" ), "maven-project-tests" + System.currentTimeMillis()
+                + "/child/pom.xml" );
 
         childProject.setFile( childFile );
 
@@ -85,7 +104,7 @@
         MavenProject project = new MavenProject();
 
         assertEquals( MavenProject.EMPTY_PROJECT_GROUP_ID + ":" + MavenProject.EMPTY_PROJECT_ARTIFACT_ID
+ ":jar:"
-                        + MavenProject.EMPTY_PROJECT_VERSION, project.getId() );
+            + MavenProject.EMPTY_PROJECT_VERSION, project.getId() );
     }
 
     public void testClone()
@@ -97,8 +116,8 @@
         MavenProject clonedProject = (MavenProject) projectToClone.clone();
         assertEquals( "maven-core", clonedProject.getArtifactId() );
         Map clonedMap = clonedProject.getManagedVersionMap();
-        assertNotNull("ManagedVersionMap not copied", clonedMap);
-        assertTrue("ManagedVersionMap is not empty", clonedMap.isEmpty());
+        assertNotNull( "ManagedVersionMap not copied", clonedMap );
+        assertTrue( "ManagedVersionMap is not empty", clonedMap.isEmpty() );
     }
 
     public void testCloneWithDependencyManagement()
@@ -107,22 +126,23 @@
         File f = getFileForClasspathResource( "dependencyManagement-pom.xml" );
         MavenProject projectToClone = getProjectWithDependencies( f );
         DependencyManagement dep = projectToClone.getDependencyManagement();
-        assertNotNull("No dependencyManagement", dep);
+        assertNotNull( "No dependencyManagement", dep );
         List list = dep.getDependencies();
-        assertNotNull("No dependencies", list);
-        assertTrue("Empty dependency list", !list.isEmpty());
+        assertNotNull( "No dependencies", list );
+        assertTrue( "Empty dependency list", !list.isEmpty() );
 
         Map map = projectToClone.getManagedVersionMap();
-        assertNotNull("No ManagedVersionMap", map);
-        assertTrue("ManagedVersionMap is empty", !map.isEmpty());
+        assertNotNull( "No ManagedVersionMap", map );
+        assertTrue( "ManagedVersionMap is empty", !map.isEmpty() );
 
         MavenProject clonedProject = (MavenProject) projectToClone.clone();
         assertEquals( "maven-core", clonedProject.getArtifactId() );
         Map clonedMap = clonedProject.getManagedVersionMap();
-        assertNotNull("ManagedVersionMap not copied", clonedMap);
-        assertTrue("ManagedVersionMap is empty", !clonedMap.isEmpty());
-        assertTrue("Not a ManagedVersionMap", clonedMap instanceof ManagedVersionMap);
-        assertTrue("ManagedVersionMap does not contain test key", clonedMap.containsKey("maven-test:maven-test-b:jar"));
+        assertNotNull( "ManagedVersionMap not copied", clonedMap );
+        assertTrue( "ManagedVersionMap is empty", !clonedMap.isEmpty() );
+        assertTrue( "Not a ManagedVersionMap", clonedMap instanceof ManagedVersionMap );
+        assertTrue( "ManagedVersionMap does not contain test key",
+                    clonedMap.containsKey( "maven-test:maven-test-b:jar" ) );
     }
 
     public void testGetModulePathAdjustment()
@@ -143,14 +163,16 @@
 
         assertEquals( "..", pathAdjustment );
     }
-    
-    public void testCloneWithDistributionManagement() throws Exception
+
+    public void testCloneWithDistributionManagement()
+        throws Exception
     {
-        
+
         File f = getFileForClasspathResource( "distributionManagement-pom.xml" );
         MavenProject projectToClone = getProject( f );
 
         MavenProject clonedProject = (MavenProject) projectToClone.clone();
-        assertNotNull( "clonedProject - distributionManagement", clonedProject.getDistributionManagementArtifactRepository()
);
+        assertNotNull( "clonedProject - distributionManagement",
+                       clonedProject.getDistributionManagementArtifactRepository() );
     }
 }



Mime
View raw message