[maven-common-artifact-filters] branch master updated: Replace EasyMock with Mockito

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-common-artifact-filters] branch master updated: Replace EasyMock with Mockito

rfscholte
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-common-artifact-filters.git


The following commit(s) were added to refs/heads/master by this push:
     new c1ca007  Replace EasyMock with Mockito
c1ca007 is described below

commit c1ca007f2016dfaf76b82b4d36be53d60e032b22
Author: rfscholte <[hidden email]>
AuthorDate: Sat May 23 16:13:57 2020 +0200

    Replace EasyMock with Mockito
---
 pom.xml                                            |   6 +-
 .../filter/AbstractPatternArtifactFilterTest.java  | 402 ++++++++-------------
 .../artifact/filter/ScopeArtifactFilterTest.java   |  52 +--
 3 files changed, 189 insertions(+), 271 deletions(-)

diff --git a/pom.xml b/pom.xml
index db01b25..29baadb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -138,9 +138,9 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymock</artifactId>
-      <version>3.2</version>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <version>2.28.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/AbstractPatternArtifactFilterTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/AbstractPatternArtifactFilterTest.java
index 2e25c03..4972a1b 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/AbstractPatternArtifactFilterTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/AbstractPatternArtifactFilterTest.java
@@ -19,20 +19,21 @@ package org.apache.maven.shared.artifact.filter;
  * under the License.
  */
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import junit.framework.TestCase;
-
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-
-import static org.easymock.EasyMock.*;
+import org.junit.Test;
 
 public abstract class AbstractPatternArtifactFilterTest
-    extends TestCase
 {
 
     protected abstract ArtifactFilter createFilter( List<String> patterns );
@@ -41,6 +42,7 @@ public abstract class AbstractPatternArtifactFilterTest
 
     protected abstract boolean isInclusionExpected();
 
+    @Test
     public void testShouldTriggerBothPatternsWithWildcards()
     {
         final String groupId1 = "group";
@@ -49,10 +51,17 @@ public abstract class AbstractPatternArtifactFilterTest
         final String groupId2 = "group2";
         final String artifactId2 = "artifact2";
 
-        final ArtifactMockAndControl mac1 = new ArtifactMockAndControl( groupId1, artifactId1 );
-        final ArtifactMockAndControl mac2 = new ArtifactMockAndControl( groupId2, artifactId2 );
-
-        replay( mac1.getMock(), mac2.getMock() );
+        Artifact artifact1 = mock( Artifact.class );
+        when( artifact1.getDependencyConflictId() ).thenReturn( groupId1 + ":" + artifactId1 + ":jar" );
+        when( artifact1.getGroupId() ).thenReturn( groupId1 );
+        when( artifact1.getArtifactId() ).thenReturn( artifactId1 );
+        when( artifact1.getId() ).thenReturn( groupId1 + ":" + artifactId1 + ":jar:version" );
+        
+        Artifact artifact2 = mock( Artifact.class );
+        when( artifact2.getDependencyConflictId() ).thenReturn( groupId2 + ":" + artifactId2 + ":jar" );
+        when( artifact2.getGroupId() ).thenReturn( groupId2 );
+        when( artifact2.getArtifactId() ).thenReturn( artifactId2 );
+        when( artifact2.getId() ).thenReturn( groupId2 + ":" + artifactId2 + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
         patterns.add( groupId1 + ":" + artifactId1 + ":*" );
@@ -62,18 +71,17 @@ public abstract class AbstractPatternArtifactFilterTest
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac1.artifact ) );
-            assertFalse( filter.include( mac2.artifact ) );
+            assertFalse( filter.include( artifact1 ) );
+            assertFalse( filter.include( artifact2 ) );
         }
         else
         {
-            assertTrue( filter.include( mac1.artifact ) );
-            assertTrue( filter.include( mac2.artifact ) );
+            assertTrue( filter.include( artifact1 ) );
+            assertTrue( filter.include( artifact2 ) );
         }
-
-        verify( mac1.getMock(), mac2.getMock() );
     }
 
+    @Test
     public void testShouldTriggerBothPatternsWithNonColonWildcards()
     {
         final String groupId1 = "group";
@@ -82,10 +90,17 @@ public abstract class AbstractPatternArtifactFilterTest
         final String groupId2 = "group2";
         final String artifactId2 = "artifact2";
 
-        final ArtifactMockAndControl mac1 = new ArtifactMockAndControl( groupId1, artifactId1 );
-        final ArtifactMockAndControl mac2 = new ArtifactMockAndControl( groupId2, artifactId2 );
+        Artifact artifact1 = mock( Artifact.class );
+        when( artifact1.getDependencyConflictId() ).thenReturn( groupId1 + ":" + artifactId1 + ":jar" );
+        when( artifact1.getGroupId() ).thenReturn( groupId1 );
+        when( artifact1.getArtifactId() ).thenReturn( artifactId1 );
+        when( artifact1.getId() ).thenReturn( groupId1 + ":" + artifactId1 + ":jar:version" );
 
-        replay( mac1.getMock(), mac2.getMock() );
+        Artifact artifact2 = mock( Artifact.class );
+        when( artifact2.getDependencyConflictId() ).thenReturn( groupId2 + ":" + artifactId2 + ":jar" );
+        when( artifact2.getGroupId() ).thenReturn( groupId2 );
+        when( artifact2.getArtifactId() ).thenReturn( artifactId2 );
+        when( artifact2.getId() ).thenReturn( groupId2 + ":" + artifactId2 + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
         patterns.add( groupId1 + "*" );
@@ -95,74 +110,77 @@ public abstract class AbstractPatternArtifactFilterTest
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac1.artifact ) );
-            assertFalse( filter.include( mac2.artifact ) );
+            assertFalse( filter.include( artifact1 ) );
+            assertFalse( filter.include( artifact2 ) );
         }
         else
         {
-            assertTrue( filter.include( mac1.artifact ) );
-            assertTrue( filter.include( mac2.artifact ) );
+            assertTrue( filter.include( artifact1 ) );
+            assertTrue( filter.include( artifact2 ) );
         }
-
-        verify( mac1.getMock(), mac2.getMock() );
     }
 
+    @Test
     public void testShouldIncludeDirectlyMatchedArtifactByGroupIdArtifactId()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final ArtifactFilter filter = createFilter( Collections.singletonList( groupId + ":" + artifactId ) );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final ArtifactFilter filter = createFilter( Collections.singletonList( groupId + ":" + artifactId + ":jar" ) );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldNotIncludeWhenGroupIdDiffers()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
-        replay( mac.getMock() );
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "otherGroup:" + artifactId + ":jar" );
         patterns.add( "otherGroup:" + artifactId );
 
@@ -170,27 +188,27 @@ public abstract class AbstractPatternArtifactFilterTest
 
         if ( !isInclusionExpected() )
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
         else
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldNotIncludeWhenArtifactIdDiffers()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( groupId + "otherArtifact:jar" );
         patterns.add( groupId + "otherArtifact" );
 
@@ -198,27 +216,27 @@ public abstract class AbstractPatternArtifactFilterTest
 
         if ( !isInclusionExpected() )
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
         else
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldNotIncludeWhenBothIdElementsDiffer()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "otherGroup:otherArtifact:jar" );
         patterns.add( "otherGroup:otherArtifact" );
 
@@ -226,16 +244,15 @@ public abstract class AbstractPatternArtifactFilterTest
 
         if ( !isInclusionExpected() )
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
         else
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeWhenPatternMatchesDependencyTrailAndTransitivityIsEnabled()
     {
         final String groupId = "group";
@@ -247,24 +264,26 @@ public abstract class AbstractPatternArtifactFilterTest
         final List<String> depTrail = Arrays.asList( new String[] { rootDepTrailItem, depTrailItem + ":jar:1.0" } );
         final List<String> patterns = Collections.singletonList( depTrailItem );
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId, depTrail );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
+        when( artifact.getDependencyTrail() ).thenReturn( depTrail );
 
         final ArtifactFilter filter = createFilter( patterns, true );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testIncludeWhenPatternMatchesDepTrailWithTransitivityUsingNonColonWildcard()
     {
         final String groupId = "group";
@@ -276,159 +295,164 @@ public abstract class AbstractPatternArtifactFilterTest
         final List<String> depTrail = Arrays.asList( new String[] { rootDepTrailItem, depTrailItem + ":jar:1.0" } );
         final List<String> patterns = Collections.singletonList( "otherGroup*" );
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId, depTrail );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
+        when( artifact.getDependencyTrail() ).thenReturn( depTrail );
 
         final ArtifactFilter filter = createFilter( patterns, true );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldNotIncludeWhenNegativeMatch()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "!group:artifact:jar" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
         else
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeWhenWildcardMatchesInsideSequence()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "group:*:jar" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeWhenWildcardMatchesOutsideSequence()
     {
         final String groupId = "group";
         final String artifactId = "artifact";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
+        Artifact artifact = mock( Artifact.class );
 
-        replay( mac.getMock() );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "*:artifact:*" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeWhenWildcardMatchesMiddleOfArtifactId()
     {
         final String groupId = "group";
         final String artifactId = "some-artifact-id";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
+        Artifact artifact = mock( Artifact.class );
 
-        replay( mac.getMock() );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "group:some-*-id" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeWhenWildcardCoversPartOfGroupIdAndEverythingElse()
     {
         final String groupId = "some.group.id";
         final String artifactId = "some-artifact-id";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
+        Artifact artifact = mock( Artifact.class );
 
-        replay( mac.getMock() );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "some.group*" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
 
+    @Test
     public void testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent()
     {
         final String groupId = "group";
@@ -438,165 +462,59 @@ public abstract class AbstractPatternArtifactFilterTest
         final String otherArtifact = "otherArtifact";
         final String otherType = "ejb";
 
-        final String depTrailItem = otherGroup + ":" + otherArtifact + ":" + otherType + ":version";
-        final List<String> depTrail = Collections.singletonList( depTrailItem );
         final List<String> patterns = Collections.singletonList( "*:jar:*" );
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId, "jar", depTrail );
-        final ArtifactMockAndControl otherMac =
-            new ArtifactMockAndControl( otherGroup, otherArtifact, otherType, Collections.<String> emptyList() );
-
-        replay( mac.getMock(), otherMac.getMock() );
+        Artifact artifact1 = mock( Artifact.class );
+        when( artifact1.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact1.getGroupId() ).thenReturn( groupId );
+        when( artifact1.getArtifactId() ).thenReturn( artifactId );
+        when( artifact1.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
+        
+        Artifact artifact2 = mock( Artifact.class );
+        when( artifact2.getDependencyConflictId() ).thenReturn( otherGroup + ":" + otherArtifact + ":" + otherType );
+        when( artifact2.getGroupId() ).thenReturn( otherGroup );
+        when( artifact2.getArtifactId() ).thenReturn( otherArtifact );
+        when( artifact2.getId() ).thenReturn( otherGroup + ":" + otherArtifact + ":" + otherType + ":version" );
+        when( artifact2.getDependencyTrail() ).thenReturn( Collections.<String> emptyList() );
 
         final ArtifactFilter filter = createFilter( patterns, true );
 
         if ( !isInclusionExpected() )
         {
-            assertTrue( filter.include( otherMac.artifact ) );
-            assertFalse( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact2 ) );
+            assertFalse( filter.include( artifact1 ) );
         }
         else
         {
-            assertFalse( filter.include( otherMac.artifact ) );
-            assertTrue( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact2 ) );
+            assertTrue( filter.include( artifact1 ) );
         }
-
-        verify( mac.getMock(), otherMac.getMock() );
     }
     
+    @Test
     public void testShouldIncludeJarsWithAndWithoutClassifier()
     {
         final String groupId = "com.mycompany.myproject";
         final String artifactId = "some-artifact-id";
 
-        final ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId );
-
-        replay( mac.getMock() );
+        Artifact artifact = mock( Artifact.class );
+        when( artifact.getDependencyConflictId() ).thenReturn( groupId + ":" + artifactId + ":jar" );
+        when( artifact.getGroupId() ).thenReturn( groupId );
+        when( artifact.getArtifactId() ).thenReturn( artifactId );
+        when( artifact.getId() ).thenReturn( groupId + ":" + artifactId + ":jar:version" );
 
         final List<String> patterns = new ArrayList<String>();
-
         patterns.add( "com.mycompany.*:*:jar:*:*" );
 
         final ArtifactFilter filter = createFilter( patterns );
 
         if ( !isInclusionExpected() )
         {
-            assertFalse( filter.include( mac.artifact ) );
+            assertFalse( filter.include( artifact ) );
         }
         else
         {
-            assertTrue( filter.include( mac.artifact ) );
+            assertTrue( filter.include( artifact ) );
         }
-
-        verify( mac.getMock() );
     }
-
-    // FIXME: Not sure what this is even trying to test.
-    // public void testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild(
-    // boolean reverse )
-    // {
-    // String groupId = "group";
-    // String artifactId = "artifact";
-    //
-    // String otherGroup = "otherGroup";
-    // String otherArtifact = "otherArtifact";
-    // String otherType = "ejb";
-    //
-    // String depTrailItem = otherGroup + ":" + otherArtifact + ":" + otherType + ":version";
-    // List depTrail = Collections.singletonList( depTrailItem );
-    // List patterns = Collections.singletonList( "!*:ejb:*" );
-    //
-    // ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId, "jar", depTrail );
-    // ArtifactMockAndControl otherMac = new ArtifactMockAndControl( otherGroup, otherArtifact, otherType, null );
-    //
-    // mockManager.replayAll();
-    //
-    // ArtifactFilter filter = createFilter( patterns, true );
-    //
-    // if ( isInclusionExpected() )
-    // {
-    // assertTrue( filter.include( otherMac.artifact ) );
-    // assertFalse( filter.include( mac.artifact ) );
-    // }
-    // else
-    // {
-    // assertFalse( filter.include( otherMac.artifact ) );
-    // assertFalse( filter.include( mac.artifact ) );
-    // }
-    //
-    // mockManager.verifyAll();
-    // }
-
-    private final class ArtifactMockAndControl
-    {
-        Artifact artifact;
-
-        String groupId;
-
-        String artifactId;
-
-        String version;
-
-        List<String> dependencyTrail;
-
-        String type;
-
-        ArtifactMockAndControl( final String groupId, final String artifactId, final List<String> depTrail )
-        {
-            this( groupId, artifactId, "jar", depTrail );
-        }
-
-        ArtifactMockAndControl( final String groupId, final String artifactId, final String type,
-                                final List<String> dependencyTrail )
-        {
-            this.groupId = groupId;
-            this.artifactId = artifactId;
-            this.dependencyTrail = dependencyTrail;
-            this.type = type;
-
-            artifact = createNiceMock( Artifact.class );
-
-            enableGetDependencyConflictId();
-            enableGetGroupIdArtifactIdAndVersion();
-            enableGetId();
-
-            if ( dependencyTrail != null )
-            {
-                enableGetDependencyTrail();
-            }
-        }
-
-        ArtifactMockAndControl( final String groupId, final String artifactId )
-        {
-            this( groupId, artifactId, "jar", null );
-        }
-
-        Artifact getMock()
-        {
-            return artifact;
-        }
-
-        void enableGetId()
-        {
-            expect( artifact.getId() ).andReturn( groupId + ":" + artifactId + ":" + type + ":version" ).anyTimes();
-        }
-
-        void enableGetDependencyTrail()
-        {
-            expect( artifact.getDependencyTrail() ).andReturn( dependencyTrail ).anyTimes();
-        }
-
-        void enableGetDependencyConflictId()
-        {
-            expect( artifact.getDependencyConflictId() ).andReturn( groupId + ":" + artifactId + ":" + type ).atLeastOnce();
-        }
-
-        void enableGetGroupIdArtifactIdAndVersion()
-        {
-            expect( artifact.getGroupId() ).andReturn( groupId ).atLeastOnce();
-            expect( artifact.getArtifactId() ).andReturn( artifactId ).atLeastOnce();
-            expect( artifact.getVersion() ).andReturn( version ).anyTimes();
-        }
-    }
-
 }
diff --git a/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java b/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java
index bebef16..3086cff 100644
--- a/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java
+++ b/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java
@@ -19,21 +19,21 @@ package org.apache.maven.shared.artifact.filter;
  * 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 junit.framework.TestCase;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
 import org.apache.maven.artifact.versioning.VersionRange;
 import org.apache.maven.plugin.testing.ArtifactStubFactory;
+import org.junit.Test;
 
 public class ScopeArtifactFilterTest
-    extends TestCase
 {
     
+    @Test
     public void testExcludedArtifactWithRangeShouldNotCauseNPE()
         throws Exception
     {
@@ -46,6 +46,7 @@ public class ScopeArtifactFilterTest
         assertFalse( filter.include( excluded ) );
     }
 
+    @Test
     public void testNullScopeDisabled()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -54,6 +55,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_TestScope()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -67,6 +69,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_CompileScope()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -80,6 +83,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_RuntimeScope()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -93,6 +97,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_ProvidedScope()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -106,6 +111,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_SystemScope()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -119,6 +125,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_ProvidedAndRuntimeScopes()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -133,6 +140,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrained_IncludeOnlyScopesThatWereEnabled_SystemAndRuntimeScopes()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -147,6 +155,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, null );
     }
 
+    @Test
     public void testFineGrainedWithImplications_CompileScopeShouldIncludeOnlyArtifactsWithNullSystemProvidedOrCompileScopes()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -161,6 +170,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( filter, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testFineGrainedWithImplications_RuntimeScopeShouldIncludeOnlyArtifactsWithNullRuntimeOrCompileScopes()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -175,6 +185,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( filter, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testFineGrainedWithImplications_TestScopeShouldIncludeAllScopes()
     {
         ScopeArtifactFilter filter = new ScopeArtifactFilter();
@@ -189,6 +200,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( filter, Artifact.SCOPE_TEST );
     }
     
+    @Test
     public void testScopesShouldIncludeArtifactWithSameScope()
     {
         verifyIncluded( Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
@@ -199,6 +211,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( (String) null, null );
     }
 
+    @Test
     public void testCompileScopeShouldIncludeOnlyArtifactsWithNullSystemProvidedOrCompileScopes()
     {
         String scope = Artifact.SCOPE_COMPILE;
@@ -212,6 +225,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( scope, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testRuntimeScopeShouldIncludeOnlyArtifactsWithNullRuntimeOrCompileScopes()
     {
         String scope = Artifact.SCOPE_RUNTIME;
@@ -225,6 +239,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( scope, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testTestScopeShouldIncludeAllScopes()
     {
         String scope = Artifact.SCOPE_TEST;
@@ -238,6 +253,7 @@ public class ScopeArtifactFilterTest
         verifyIncluded( scope, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testProvidedScopeShouldIncludeOnlyArtifactsWithNullOrProvidedScopes()
     {
         String scope = Artifact.SCOPE_PROVIDED;
@@ -252,6 +268,7 @@ public class ScopeArtifactFilterTest
         verifyExcluded( scope, Artifact.SCOPE_TEST );
     }
 
+    @Test
     public void testSystemScopeShouldIncludeOnlyArtifactsWithNullOrSystemScopes()
     {
         String scope = Artifact.SCOPE_SYSTEM;
@@ -270,59 +287,42 @@ public class ScopeArtifactFilterTest
     {
         Artifact artifact = createMockArtifact( artifactScope );
 
-        replay( artifact );
-
         ArtifactFilter filter = new ScopeArtifactFilter( filterScope );
 
         assertTrue( "Artifact scope: " + artifactScope + " NOT included using filter scope: " + filterScope, filter
             .include( artifact ) );
-
-        verify( artifact );
     }
 
     private void verifyExcluded( String filterScope, String artifactScope )
     {
         Artifact artifact = createMockArtifact( artifactScope );
         
-        replay( artifact );
-
         ArtifactFilter filter = new ScopeArtifactFilter( filterScope );
 
         assertFalse( "Artifact scope: " + artifactScope + " NOT excluded using filter scope: " + filterScope, filter
             .include( artifact ) );
-
-        verify( artifact );
     }
 
     private void verifyIncluded( ScopeArtifactFilter filter, String artifactScope )
     {
         Artifact artifact = createMockArtifact( artifactScope );
-                
-        replay( artifact );
 
         assertTrue( "Artifact scope: " + artifactScope + " SHOULD BE included", filter.include( artifact ) );
-
-        verify( artifact );
     }
 
     private void verifyExcluded( ScopeArtifactFilter filter, String artifactScope )
     {
         Artifact artifact = createMockArtifact( artifactScope );
-                
-        replay( artifact );
 
         assertFalse( "Artifact scope: " + artifactScope + " SHOULD BE excluded", filter.include( artifact ) );
-
-        verify( artifact );
     }
 
     private Artifact createMockArtifact( String scope )
     {
-        Artifact artifact = createMock( Artifact.class );
+        Artifact artifact = mock( Artifact.class );
 
-        expect( artifact.getScope() ).andReturn( scope ).anyTimes();
-        expect( artifact.getId() ).andReturn( "group:artifact:type:version" ).anyTimes();
-        expect( artifact.getVersionRange() ).andReturn( null ).anyTimes();
+        when( artifact.getScope() ).thenReturn( scope );
+        when( artifact.getId() ).thenReturn( "group:artifact:type:version" );
 
         return artifact;
     }