continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From batkin...@apache.org
Subject svn commit: r1659078 - in /continuum/trunk/continuum-commons: pom.xml src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
Date Wed, 11 Feb 2015 21:27:11 GMT
Author: batkinson
Date: Wed Feb 11 21:27:11 2015
New Revision: 1659078

URL: http://svn.apache.org/r1659078
Log:
Migrated continuum-commons from jmock to mockito.

Modified:
    continuum/trunk/continuum-commons/pom.xml
    continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java

Modified: continuum/trunk/continuum-commons/pom.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/pom.xml?rev=1659078&r1=1659077&r2=1659078&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/pom.xml (original)
+++ continuum/trunk/continuum-commons/pom.xml Wed Feb 11 21:27:11 2015
@@ -74,32 +74,8 @@
       <scope>runtime</scope>
     </dependency>
     <dependency>
-      <groupId>org.jmock</groupId>
-      <artifactId>jmock-junit3</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <!-- dependency of jmock3 -->
-    <dependency>
-      <groupId>cglib</groupId>
-      <artifactId>cglib-nodep</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <!-- dependency of jmock3 -->
-    <dependency>
-      <groupId>org.objenesis</groupId>
-      <artifactId>objenesis</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.jmock</groupId>
-      <artifactId>jmock</artifactId>
-      <version>2.4.0</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>jmock</groupId>
-      <artifactId>jmock</artifactId>
-      <scope>test</scope>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-all</artifactId>
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>

Modified: continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java?rev=1659078&r1=1659077&r2=1659078&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
(original)
+++ continuum/trunk/continuum-commons/src/test/java/org/apache/maven/continuum/utils/DefaultWorkingDirectoryServiceTest.java
Wed Feb 11 21:27:11 2015
@@ -22,14 +22,13 @@ package org.apache.maven.continuum.utils
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.project.Project;
 import org.codehaus.plexus.spring.PlexusInSpringTestCase;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit3.JUnit3Mockery;
 
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
 
+import static org.mockito.Mockito.*;
+
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
  */
@@ -38,21 +37,21 @@ public class DefaultWorkingDirectoryServ
 {
     private DefaultWorkingDirectoryService workingDirectoryService;
 
-    private Mockery context;
-
     private ConfigurationService configurationService;
 
+    private File baseWorkingDirectory;
+
     public void setUp()
         throws Exception
     {
         super.setUp();
 
-        context = new JUnit3Mockery();
+        configurationService = mock( ConfigurationService.class );
 
-        configurationService = context.mock( ConfigurationService.class );
+        baseWorkingDirectory = new File( getBasedir(), "target" + File.separator + "working-directory"
);
+        when( configurationService.getWorkingDirectory() ).thenReturn( baseWorkingDirectory
);
 
         workingDirectoryService = (DefaultWorkingDirectoryService) lookup( WorkingDirectoryService.class
);
-
         workingDirectoryService.setConfigurationService( configurationService );
     }
 
@@ -74,28 +73,14 @@ public class DefaultWorkingDirectoryServ
         throws Exception
     {
         List<Project> projects = new ArrayList<Project>();
-
         Project project = createProject( 7, "org.apache.continuum", "module-a", "1.0-SNAPSHOT",
                                          "scm:local:src/test-projects:flat-multi-module/module-a",
true );
-
         projects.add( project );
-
         projects.add( createProject( 8, "org.apache.continuum", "module-b", "1.0-SNAPSHOT",
                                      "scm:local:src/test-projects:flat-multi-module/module-b",
true ) );
-
         projects.add( createProject( 6, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
                                      "scm:local:src/test-projects:flat-multi-module/parent-project",
true ) );
 
-        final File baseWorkingDirectory = new File( getBasedir(), "target" + File.separatorChar
+ "working-directory" );
-
-        context.checking( new Expectations()
-        {
-            {
-                exactly( 2 ).of( configurationService ).getWorkingDirectory();
-                will( returnValue( baseWorkingDirectory ) );
-            }
-        } );
-
         File projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project,
                                                                                     "scm:local:src/test-projects:flat-multi-module",
                                                                                     projects
);
@@ -116,28 +101,14 @@ public class DefaultWorkingDirectoryServ
         throws Exception
     {
         List<Project> projects = new ArrayList<Project>();
-
         Project project = createProject( 10, "org.apache.continuum", "module-a", "1.0-SNAPSHOT",
                                          "scm:local:src/test-projects:regular-multi-module/module-a",
true );
-
         projects.add( project );
-
         projects.add( createProject( 11, "org.apache.continuum", "module-b", "1.0-SNAPSHOT",
                                      "scm:local:src/test-projects:regular-multi-module/module-b",
true ) );
-
         projects.add( createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
                                      "scm:local:src/test-projects:regular-multi-module/",
true ) );
 
-        final File baseWorkingDirectory = new File( getBasedir(), "target" + File.separator
+ "working-directory" );
-
-        context.checking( new Expectations()
-        {
-            {
-                exactly( 2 ).of( configurationService ).getWorkingDirectory();
-                will( returnValue( baseWorkingDirectory ) );
-            }
-        } );
-
         File projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project,
                                                                                     "scm:local:src/test-projects:regular-multi-module",
                                                                                     projects
);
@@ -159,14 +130,6 @@ public class DefaultWorkingDirectoryServ
         project = createProject( 9, "org.apache.continuum", "parent-project", "1.0-SNAPSHOT",
                                  "scm:local:src/test-projects:regular-multi-module", true
);
 
-        context.checking( new Expectations()
-        {
-            {
-                one( configurationService ).getWorkingDirectory();
-                will( returnValue( baseWorkingDirectory ) );
-            }
-        } );
-
         projectWorkingDirectory = workingDirectoryService.getWorkingDirectory( project,
                                                                                "scm:local:src/test-projects:regular-multi-module",
                                                                                projects );



Mime
View raw message