maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rfscho...@apache.org
Subject svn commit: r1757908 - in /maven/plugin-tools/trunk: maven-script/maven-script-ant/pom.xml maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java pom.xml
Date Fri, 26 Aug 2016 19:30:10 GMT
Author: rfscholte
Date: Fri Aug 26 19:30:10 2016
New Revision: 1757908

URL: http://svn.apache.org/viewvc?rev=1757908&view=rev
Log:
Upgrade EasyMock and migrate tests

Modified:
    maven/plugin-tools/trunk/maven-script/maven-script-ant/pom.xml
    maven/plugin-tools/trunk/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
    maven/plugin-tools/trunk/pom.xml

Modified: maven/plugin-tools/trunk/maven-script/maven-script-ant/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-script/maven-script-ant/pom.xml?rev=1757908&r1=1757907&r2=1757908&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-script/maven-script-ant/pom.xml (original)
+++ maven/plugin-tools/trunk/maven-script/maven-script-ant/pom.xml Fri Aug 26 19:30:10 2016
@@ -68,7 +68,7 @@ under the License.
       <artifactId>maven-core</artifactId>
     </dependency>
     <dependency>
-      <groupId>easymock</groupId>
+      <groupId>org.easymock</groupId>
       <artifactId>easymock</artifactId>
       <scope>test</scope>
     </dependency>

Modified: maven/plugin-tools/trunk/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java?rev=1757908&r1=1757907&r2=1757908&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
(original)
+++ maven/plugin-tools/trunk/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
Fri Aug 26 19:30:10 2016
@@ -18,6 +18,23 @@ package org.apache.maven.script.ant;
  * specific language governing permissions and limitations
  * under the License.
  */
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
@@ -43,20 +60,6 @@ import org.codehaus.plexus.logging.Logge
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.StringUtils;
-import org.easymock.MockControl;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.PrintStream;
-import java.io.Reader;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 import junit.framework.TestCase;
 
@@ -160,8 +163,9 @@ public class AntMojoWrapperTest
 
         wrapper.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
 
-        MockControl artifactCtl = null;
-        MockControl pathTranslatorCtl = null;
+        Artifact artifact = createMock( Artifact.class );
+        PathTranslator pt = createMock( PathTranslator.class );
+
         if ( includeImplied )
         {
             File pluginXmlFile = new File( StringUtils.replace( resource.getPath(), "%20",
" " ) );
@@ -175,29 +179,12 @@ public class AntMojoWrapperTest
             archiver.addFile( pluginXmlFile, pluginXml );
             archiver.createArchive();
 
-            artifactCtl = MockControl.createControl( Artifact.class );
-            Artifact artifact = (Artifact) artifactCtl.getMock();
-
-            artifact.getFile();
-            artifactCtl.setReturnValue( jarFile, MockControl.ZERO_OR_MORE );
-
-            artifact.getGroupId();
-            artifactCtl.setReturnValue( "groupId", MockControl.ZERO_OR_MORE );
-
-            artifact.getArtifactId();
-            artifactCtl.setReturnValue( "artifactId", MockControl.ZERO_OR_MORE );
-
-            artifact.getVersion();
-            artifactCtl.setReturnValue( "1", MockControl.ZERO_OR_MORE );
-
-            artifact.getId();
-            artifactCtl.setReturnValue( "groupId:artifactId:jar:1", MockControl.ZERO_OR_MORE
);
-
-            artifact.getClassifier();
-            artifactCtl.setReturnValue( null, MockControl.ZERO_OR_MORE );
-
-            pathTranslatorCtl = MockControl.createControl( PathTranslator.class );
-            PathTranslator pt = (PathTranslator) pathTranslatorCtl.getMock();
+            expect( artifact.getFile() ).andReturn( jarFile ).anyTimes();
+            expect( artifact.getGroupId() ).andReturn( "groupId" ).anyTimes();
+            expect( artifact.getArtifactId() ).andReturn( "artifactId" ).anyTimes();
+            expect( artifact.getVersion() ).andReturn( "1" ).anyTimes();
+            expect( artifact.getId() ).andReturn( "groupId:artifactId:jar:1" ).anyTimes();
+            expect( artifact.getClassifier() ).andReturn( null ).anyTimes();
 
             Model model = new Model();
 
@@ -209,8 +196,7 @@ public class AntMojoWrapperTest
             MavenProject project = new MavenProject( model );
             project.setFile( new File( "pom.xml" ).getAbsoluteFile() );
 
-            artifactCtl.replay();
-            pathTranslatorCtl.replay();
+            replay( artifact, pt );
 
             pd.setPluginArtifact( artifact );
             pd.setArtifacts( Collections.singletonList( artifact ) );
@@ -248,8 +234,7 @@ public class AntMojoWrapperTest
 
         if ( includeImplied )
         {
-            artifactCtl.verify();
-            pathTranslatorCtl.verify();
+            verify( artifact, pt );
         }
 
         List<String> messages = new ArrayList<String>();

Modified: maven/plugin-tools/trunk/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/pom.xml?rev=1757908&r1=1757907&r2=1757908&view=diff
==============================================================================
--- maven/plugin-tools/trunk/pom.xml (original)
+++ maven/plugin-tools/trunk/pom.xml Fri Aug 26 19:30:10 2016
@@ -235,9 +235,9 @@
         <scope>test</scope>
       </dependency>
       <dependency>
-        <groupId>easymock</groupId>
+        <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>
-        <version>1.2_Java1.3</version>
+        <version>3.4</version>
         <scope>test</scope>
       </dependency>
     </dependencies>



Mime
View raw message