You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/07/07 12:49:04 UTC

svn commit: r1358538 - /maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java

Author: rfscholte
Date: Sat Jul  7 10:49:04 2012
New Revision: 1358538

URL: http://svn.apache.org/viewvc?rev=1358538&view=rev
Log:
Another coverage test

Modified:
    maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java

Modified: maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java
URL: http://svn.apache.org/viewvc/maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java?rev=1358538&r1=1358537&r2=1358538&view=diff
==============================================================================
--- maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java (original)
+++ maven/release/trunk/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/MapVersionsPhaseTest.java Sat Jul  7 10:49:04 2012
@@ -1146,6 +1146,58 @@ public class MapVersionsPhaseTest
         // verify
         verify( mockPrompter ).prompt( startsWith( "What is the branch version for" ), eq( "1.2-SNAPSHOT" ) );
     }
+    
+    public void testExecuteReleaseBranchCreation_UpdateBranchVersions_MapBranch()
+        throws Exception
+    {
+        // prepare
+        MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.ROLE, "test-map-branch-versions" );
+
+        List<MavenProject> reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) );
+
+        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
+        releaseDescriptor.setBranchCreation( true );
+        releaseDescriptor.setUpdateBranchVersions( true );
+
+        // test
+        phase.execute( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );
+
+        // verify
+        /*
+         * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision."
+         * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep
+         * '1.2' instead of '1.3-SNAPSHOT' until further investigation.
+         */
+        assertEquals( "Check release versions", Collections.singletonMap( "groupId:artifactId", "1.2" ),
+                      releaseDescriptor.getReleaseVersions() );
+        assertNull( "Check development versions", releaseDescriptor.getDevelopmentVersions().get( "groupId:artifactId" ) );
+    }
+
+    public void testSimulateReleaseBranchCreation_UpdateBranchVersions_MapBranch()
+        throws Exception
+    {
+        // prepare
+        MapVersionsPhase phase = (MapVersionsPhase) lookup( ReleasePhase.ROLE, "test-map-branch-versions" );
+
+        List<MavenProject> reactorProjects = Collections.singletonList( createProject( "artifactId", "1.2" ) );
+
+        ReleaseDescriptor releaseDescriptor = new ReleaseDescriptor();
+        releaseDescriptor.setBranchCreation( true );
+        releaseDescriptor.setUpdateBranchVersions( true );
+
+        // test
+        phase.simulate( releaseDescriptor, new DefaultReleaseEnvironment(), reactorProjects );
+
+        // verify
+        /*
+         * "By default, the POM in the new branch keeps the same version as the local working copy, and the local POM is incremented to the next revision."
+         * This is true for trunk, but when branching from a tag I would expect the next SNAPSHOT version. For now keep
+         * '1.2' instead of '1.3-SNAPSHOT' until further investigation.
+         */
+        assertEquals( "Check release versions", Collections.singletonMap( "groupId:artifactId", "1.2" ),
+                      releaseDescriptor.getReleaseVersions() );
+        assertNull( "Check development versions", releaseDescriptor.getDevelopmentVersions().get( "groupId:artifactId" ) );
+    }
 
     public void testExecuteSnapshotBranchCreation_UpdateWorkingCopyVersions_MapDevelopment()
         throws Exception