You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2019/10/03 18:25:39 UTC

[maven-plugin-tools] branch MPLUGIN-355 created (now 5d0f4b2)

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

slachiewicz pushed a change to branch MPLUGIN-355
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git.


      at 5d0f4b2  [MPLUGIN-355] Upgrade to JUnit 4.12

This branch includes the following new commits:

     new 5d0f4b2  [MPLUGIN-355] Upgrade to JUnit 4.12

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-plugin-tools] 01/01: [MPLUGIN-355] Upgrade to JUnit 4.12

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MPLUGIN-355
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit 5d0f4b2735c7bfa07fd06e4c21c6aadc1428a2b2
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Thu Oct 3 19:56:50 2019 +0200

    [MPLUGIN-355] Upgrade to JUnit 4.12
    
    And improve code use Java 7 syntax
---
 .../annotation-with-inheritance-from-deps/pom.xml  |  2 +-
 .../it/annotation-with-inheritance-reactor/pom.xml |  2 +-
 .../annotations/TestAnnotationsReader.java         |  4 +-
 .../plugin/scanner/DefaultMojoScannerTest.java     | 23 ++++++----
 .../apache/maven/tools/plugin/util/TestUtils.java  |  6 ++-
 .../javadoc/JavaMojoDescriptorExtractorTest.java   | 22 ++++++----
 .../ant/AntMojoDescriptorExtractorTest.java        | 49 ++++++++++------------
 .../extractor/model/PluginMetadataParserTest.java  | 18 ++++----
 .../maven/script/ant/AntMojoWrapperTest.java       | 21 +++++-----
 pom.xml                                            |  2 +-
 10 files changed, 84 insertions(+), 65 deletions(-)

diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/pom.xml b/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/pom.xml
index 09816e8..792836c 100644
--- a/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/pom.xml
+++ b/maven-plugin-plugin/src/it/annotation-with-inheritance-from-deps/pom.xml
@@ -61,7 +61,7 @@ under the License.
       <!-- dependency of  org.apache.maven.plugin-tools:maven-plugin-tools-annotations:@project.version@:jar:tests -->
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.12</version>
     </dependency>
     
     <dependency>
diff --git a/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/pom.xml b/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/pom.xml
index 6ccd25b..ad37af0 100644
--- a/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/pom.xml
+++ b/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/pom.xml
@@ -54,7 +54,7 @@ under the License.
       <!-- dependency of  org.apache.maven.plugin-tools:maven-plugin-tools-annotations:@project.version@:jar:tests -->
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.12</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.plugin-tools</groupId>
diff --git a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java
index be625d6..b7702df 100644
--- a/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java
+++ b/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/extractor/annotations/TestAnnotationsReader.java
@@ -67,8 +67,8 @@ public class TestAnnotationsReader
         Mojo mojo = mojoAnnotatedClass.getMojo();
 
         assertEquals( "foo", mojo.name() );
-        assertEquals( true, mojo.threadSafe() );
-        assertEquals( false, mojo.aggregator() );
+        assertTrue( mojo.threadSafe() );
+        assertFalse( mojo.aggregator() );
         assertEquals( LifecyclePhase.COMPILE, mojo.defaultPhase() );
 
         Execute execute = mojoAnnotatedClass.getExecute();
diff --git a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
index 7e281cc..eeb1031 100644
--- a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
+++ b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/scanner/DefaultMojoScannerTest.java
@@ -19,7 +19,6 @@ package org.apache.maven.tools.plugin.scanner;
  * under the License.
  */
 
-import junit.framework.TestCase;
 import org.apache.maven.model.Build;
 import org.apache.maven.model.Model;
 import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
@@ -29,6 +28,8 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
 import org.apache.maven.tools.plugin.extractor.ExtractionException;
 import org.apache.maven.tools.plugin.extractor.MojoDescriptorExtractor;
+import org.junit.Before;
+import org.junit.Test;
 
 import java.io.File;
 import java.util.Arrays;
@@ -40,11 +41,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 /**
  * @author jdcasey
  */
 public class DefaultMojoScannerTest
-    extends TestCase
 {
     private Map<String, MojoDescriptorExtractor> extractors;
 
@@ -56,8 +60,8 @@ public class DefaultMojoScannerTest
 
     private MavenProject project;
 
-    protected void setUp()
-        throws Exception
+    @Before
+    public void setUp()
     {
         extractors = new HashMap<>();
         extractors.put( "one", new ScannerTestExtractor( "one" ) );
@@ -76,6 +80,7 @@ public class DefaultMojoScannerTest
         project.setFile( new File( "." ) );
     }
 
+    @Test
     public void testUnspecifiedExtractors()
         throws Exception
     {
@@ -86,6 +91,7 @@ public class DefaultMojoScannerTest
         checkResult( pluginDescriptor, extractors.keySet() );
     }
 
+    @Test
     public void testSpecifiedExtractors()
         throws Exception
     {
@@ -100,9 +106,10 @@ public class DefaultMojoScannerTest
         scanner.setActiveExtractors( activeExtractors );
         scanner.populatePluginDescriptor( new DefaultPluginToolsRequest( project, pluginDescriptor ) );
 
-        checkResult( pluginDescriptor, Arrays.asList( new String[]{"one", "three"} ) );
+        checkResult( pluginDescriptor, Arrays.asList( "one", "three" ) );
     }
 
+    @Test
     public void testAllExtractorsThroughNull()
         throws Exception
     {
@@ -114,6 +121,7 @@ public class DefaultMojoScannerTest
         checkResult( pluginDescriptor, extractors.keySet() );
     }
 
+    @Test
     public void testNoExtractorsThroughEmptySet()
         throws Exception
     {
@@ -133,6 +141,7 @@ public class DefaultMojoScannerTest
         checkResult( pluginDescriptor, Collections.<String>emptySet() );
     }
 
+    @Test
     public void testUnknownExtractor()
         throws Exception
     {
@@ -189,10 +198,10 @@ public class DefaultMojoScannerTest
         {
             assertEquals( pluginDescriptor, desc.getPluginDescriptor() );
             assertTrue( "Unexpected goal in PluginDescriptor: " + desc.getGoal(),
-                        remainingGoals.remove( desc.getGoal() ) );
+                    remainingGoals.remove( desc.getGoal() ) );
         }
 
-        assertTrue( "Expected goals missing from PluginDescriptor: " + remainingGoals, remainingGoals.size() == 0 );
+        assertEquals( "Expected goals missing from PluginDescriptor: " + remainingGoals, 0, remainingGoals.size() );
     }
 
 }
\ No newline at end of file
diff --git a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
index 925caa8..b96d871 100644
--- a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
+++ b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/util/TestUtils.java
@@ -19,19 +19,21 @@ package org.apache.maven.tools.plugin.util;
  * under the License.
  */
 
-import junit.framework.TestCase;
+import org.junit.Test;
 
 import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.net.URLDecoder;
 
+import static org.junit.Assert.assertEquals;
+
 /**
  * @author jdcasey
  */
 public class TestUtils
-    extends TestCase
 {
 
+    @Test
     public void testDirnameFunction_METATEST() throws UnsupportedEncodingException
     {
         String classname = getClass().getName().replace( '.', '/' ) + ".class";
diff --git a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java
index 6989cd7..3f3001f 100644
--- a/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java
+++ b/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/javadoc/JavaMojoDescriptorExtractorTest.java
@@ -34,7 +34,6 @@ import org.apache.maven.project.MavenProject;
 import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
 import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
 import org.apache.maven.tools.plugin.PluginToolsRequest;
-import org.apache.maven.tools.plugin.extractor.javadoc.JavaJavadocMojoDescriptorExtractor;
 import org.apache.maven.tools.plugin.generator.Generator;
 import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
 import org.apache.maven.tools.plugin.util.PluginUtils;
@@ -43,21 +42,23 @@ import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.codehaus.plexus.util.FileUtils;
 
-import junit.framework.TestCase;
-
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Before;
+import org.junit.Test;
 import org.w3c.dom.Document;
 
+import static org.junit.Assert.*;
+
 /**
  * @author jdcasey
  */
 public class JavaMojoDescriptorExtractorTest
-    extends TestCase
 {
     private File root;
 
-    protected void setUp()
+    @Before
+    public void setUp()
     {
         File sourceFile = fileOf( "dir-flag.txt" );
         root = sourceFile.getParentFile();
@@ -159,7 +160,6 @@ public class JavaMojoDescriptorExtractorTest
     /**
      * extract plugin descriptor for test resources directory and check against plugin-expected.xml
      */
-    @SuppressWarnings( "unchecked" )
     protected List<MojoDescriptor> extract( String directory )
         throws Exception
     {
@@ -170,6 +170,7 @@ public class JavaMojoDescriptorExtractorTest
         return descriptor.getMojos();
     }
 
+    @Test
     public void testShouldFindTwoMojoDescriptorsInTestSourceDirectory()
         throws Exception
     {
@@ -178,6 +179,7 @@ public class JavaMojoDescriptorExtractorTest
         assertEquals( "Extracted mojos", 2, results.size() );
     }
 
+    @Test
     public void testShouldPropagateImplementationParameter()
         throws Exception
     {
@@ -187,7 +189,7 @@ public class JavaMojoDescriptorExtractorTest
 
         MojoDescriptor mojoDescriptor = results.get( 0 );
 
-        @SuppressWarnings( "unchecked" ) List<Parameter> parameters = mojoDescriptor.getParameters();
+        List<Parameter> parameters = mojoDescriptor.getParameters();
 
         assertEquals( 1, parameters.size() );
 
@@ -196,6 +198,7 @@ public class JavaMojoDescriptorExtractorTest
         assertEquals( "Implementation parameter", "source2.sub.MyBla", parameter.getImplementation() );
     }
 
+    @Test
     public void testMaven30Parameters()
         throws Exception
     {
@@ -213,6 +216,7 @@ public class JavaMojoDescriptorExtractorTest
      *
      * @throws Exception
      */
+    @Test
     public void testAnnotationInPlugin()
         throws Exception
     {
@@ -225,6 +229,7 @@ public class JavaMojoDescriptorExtractorTest
      * Check that the mojo descriptor extractor will successfully parse sources with Java 1.5 language features like
      * generics.
      */
+    @Test
     public void testJava15SyntaxParsing()
         throws Exception
     {
@@ -233,6 +238,7 @@ public class JavaMojoDescriptorExtractorTest
         assertEquals( 1, results.size() );
     }
 
+    @Test
     public void testSingleTypeImportWithFullyQualifiedClassName()
         throws Exception
     {
@@ -241,6 +247,7 @@ public class JavaMojoDescriptorExtractorTest
         assertEquals( 1, results.size() );
     }
 
+    @Test
     public void testMethodReferenceInEnumConstructor()
         throws Exception
     {
@@ -249,6 +256,7 @@ public class JavaMojoDescriptorExtractorTest
         assertNull( results );
     }
 
+    @Test
     public void testEnumWithRegexPattern()
         throws Exception
     {
diff --git a/maven-script/maven-plugin-tools-ant/src/test/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractorTest.java b/maven-script/maven-plugin-tools-ant/src/test/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractorTest.java
index 70c7820..43d8d92 100644
--- a/maven-script/maven-plugin-tools-ant/src/test/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractorTest.java
+++ b/maven-script/maven-plugin-tools-ant/src/test/java/org/apache/maven/tools/plugin/extractor/ant/AntMojoDescriptorExtractorTest.java
@@ -22,13 +22,12 @@ package org.apache.maven.tools.plugin.extractor.ant;
 import java.io.File;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.file.Paths;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import junit.framework.TestCase;
 import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
@@ -39,15 +38,18 @@ import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
 import org.apache.maven.tools.plugin.PluginToolsRequest;
 import org.apache.maven.tools.plugin.extractor.ExtractionException;
 import org.codehaus.plexus.component.repository.ComponentRequirement;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 public class AntMojoDescriptorExtractorTest
-    extends TestCase
 {
     
+    @Test
     public void testBasicMojoExtraction_CheckInjectedParametersAndRequirements()
         throws InvalidPluginDescriptorException, ExtractionException
     {
-        Map scriptMap = buildTestMap( "basic" );
+        Map<String, Set<File>> scriptMap = buildTestMap( "basic" );
         
         PluginDescriptor pd = new PluginDescriptor();
         
@@ -58,53 +60,49 @@ public class AntMojoDescriptorExtractorTest
         
         PluginToolsRequest request = new DefaultPluginToolsRequest( new MavenProject(), pd );
         
-        List metadata = new AntMojoDescriptorExtractor().extractMojoDescriptorsFromMetadata( scriptMap, request );
+        List<MojoDescriptor> metadata = new AntMojoDescriptorExtractor().extractMojoDescriptorsFromMetadata( scriptMap, request );
         
         assertEquals( 2, metadata.size() );
-        
-        for ( Iterator it = metadata.iterator(); it.hasNext(); )
+
+        for ( MojoDescriptor desc : metadata )
         {
-            MojoDescriptor desc = (MojoDescriptor) it.next();
-            
             if ( "test".equals( desc.getGoal() ) )
             {
-                assertTrue( desc.getImplementation().indexOf( ":" ) < 0 );
+                assertFalse( desc.getImplementation().contains( ":" ) );
             }
             else if ( "test2".equals( desc.getGoal() ) )
             {
                 assertTrue( desc.getImplementation().endsWith( ":test2" ) );
             }
-            
-            List params = desc.getParameters();
-            Map paramMap = new HashMap();
-            for ( Iterator paramIterator = params.iterator(); paramIterator.hasNext(); )
+
+            List<Parameter> params = desc.getParameters();
+            Map<String, Parameter> paramMap = new HashMap<>();
+            for (Parameter param : params)
             {
-                Parameter param = (Parameter) paramIterator.next();
                 paramMap.put( param.getName(), param );
             }
-            
+
             assertNotNull( "Mojo descriptor: " + desc.getGoal() + " is missing 'basedir' parameter.", paramMap.get( "basedir" ) );
             assertNotNull( "Mojo descriptor: " + desc.getGoal() + " is missing 'messageLevel' parameter.", paramMap.get( "messageLevel" ) );
             assertNotNull( "Mojo descriptor: " + desc.getGoal() + " is missing 'project' parameter.", paramMap.get( "project" ) );
             assertNotNull( "Mojo descriptor: " + desc.getGoal() + " is missing 'session' parameter.", paramMap.get( "session" ) );
             assertNotNull( "Mojo descriptor: " + desc.getGoal() + " is missing 'mojoExecution' parameter.", paramMap.get( "mojoExecution" ) );
-            
-            List components = desc.getRequirements();
+
+            List<ComponentRequirement> components = desc.getRequirements();
 
             assertNotNull( components );
             assertEquals( 1, components.size() );
-            
-            ComponentRequirement req = (ComponentRequirement) components.get( 0 );
+
+            ComponentRequirement req = components.get( 0 );
             assertEquals( "Mojo descriptor: " + desc.getGoal() + " is missing 'PathTranslator' component requirement.", PathTranslator.class.getName(), req.getRole() );
         }
     }
 
-    private Map buildTestMap( String resourceDirName )
+    private Map<String, Set<File>> buildTestMap( String resourceDirName )
     {
         try
         {
-            Map result = new HashMap();
-
+            Map<String, Set<File>> result = new HashMap<>();
             ClassLoader cloader = Thread.currentThread().getContextClassLoader();
             URL mojosXmlUrl = cloader.getResource( resourceDirName + "/test.mojos.xml" );
 
@@ -113,11 +111,10 @@ public class AntMojoDescriptorExtractorTest
                 fail( "No classpath resource named: '" + resourceDirName + "/test.mojos.xml' could be found." );
             }
 
-            // TODO As of JDK 7, replace with Paths.get( resource.toURI() ).toFile()
-            File mojosXml = new File( mojosXmlUrl.toURI() );
+            File mojosXml = Paths.get( mojosXmlUrl.toURI() ).toFile();
             File dir = mojosXml.getParentFile();
 
-            Set scripts = new HashSet();
+            Set<File> scripts = new HashSet<>();
             String[] listing = dir.list();
             for ( int i = 0; listing != null && i < listing.length; i++ )
             {
diff --git a/maven-script/maven-plugin-tools-model/src/test/java/org/apache/maven/tools/plugin/extractor/model/PluginMetadataParserTest.java b/maven-script/maven-plugin-tools-model/src/test/java/org/apache/maven/tools/plugin/extractor/model/PluginMetadataParserTest.java
index 944d7d4..30c23e8 100644
--- a/maven-script/maven-plugin-tools-model/src/test/java/org/apache/maven/tools/plugin/extractor/model/PluginMetadataParserTest.java
+++ b/maven-script/maven-plugin-tools-model/src/test/java/org/apache/maven/tools/plugin/extractor/model/PluginMetadataParserTest.java
@@ -22,27 +22,31 @@ package org.apache.maven.tools.plugin.extractor.model;
 import java.io.File;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.file.Paths;
 import java.util.Set;
-import junit.framework.TestCase;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 public class PluginMetadataParserTest
-    extends TestCase
 {
     
+    @Test
     public void testBasicDeclarationWithoutCall()
         throws PluginMetadataParseException
     {
         File metadataFile = getMetadataFile( "test.mojos.xml" );
         Set<MojoDescriptor> descriptors = new PluginMetadataParser().parseMojoDescriptors( metadataFile );
         
-        assertEquals( 1, descriptors.size() );
+        assertEquals(1, descriptors.size());
         
         MojoDescriptor desc = descriptors.iterator().next();
-        assertTrue( desc.getImplementation().indexOf( ":" ) < 0 );
-        assertEquals( "test", desc.getGoal() );
+        assertFalse( desc.getImplementation().contains(":") );
+        assertEquals("test", desc.getGoal());
     }
     
+    @Test
     public void testBasicDeclarationWithCall()
         throws PluginMetadataParseException
     {
@@ -65,9 +69,7 @@ public class PluginMetadataParserTest
             {
                 fail( "Cannot find classpath resource: '" + name + "'." );
             }
-
-            // TODO As of JDK 7, replace with Paths.get( resource.toURI() ).toFile()
-            return new File( resource.toURI() );
+            return Paths.get( resource.toURI() ).toFile();
         }
         catch ( final URISyntaxException e )
         {
diff --git a/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java b/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
index 6d833a9..560db10 100644
--- a/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
+++ b/maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java
@@ -27,12 +27,12 @@ import java.io.PrintStream;
 import java.io.Reader;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import junit.framework.TestCase;
 import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Build;
@@ -55,16 +55,18 @@ import org.codehaus.plexus.component.repository.ComponentRequirement;
 import org.codehaus.plexus.configuration.PlexusConfigurationException;
 import org.codehaus.plexus.logging.Logger;
 import org.codehaus.plexus.logging.console.ConsoleLogger;
-import org.codehaus.plexus.util.IOUtil;
+import org.junit.Test;
+
 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 static org.junit.Assert.fail;
 
 public class AntMojoWrapperTest
-    extends TestCase
 {
 
+    @Test
     public void test2xStylePlugin()
         throws PlexusConfigurationException, IOException, ComponentInstantiationException, MojoExecutionException,
         ComponentConfigurationException, ArchiverException, URISyntaxException
@@ -85,6 +87,7 @@ public class AntMojoWrapperTest
         assertPresence( messages, "path-is-missing", false );
     }
 
+    @Test
     public void test20StylePlugin()
         throws PlexusConfigurationException, IOException, ComponentInstantiationException, MojoExecutionException,
         ComponentConfigurationException, ArchiverException, URISyntaxException
@@ -144,7 +147,7 @@ public class AntMojoWrapperTest
             pd = new PluginDescriptorBuilder().build( reader, pluginXml );
         }
 
-        Map<String, Object> config = new HashMap<String, Object>();
+        Map<String, Object> config = new HashMap<>();
         config.put( "basedir", new File( "." ).getAbsoluteFile() );
         config.put( "messageLevel", "info" );
 
@@ -160,8 +163,7 @@ public class AntMojoWrapperTest
 
         if ( includeImplied )
         {
-            // TODO As of JDK 7, replace with Paths.get( resource.toURI() ).toFile()
-            File pluginXmlFile = new File( resource.toURI() );
+            File pluginXmlFile = Paths.get( resource.toURI() ).toFile();
 
             File jarFile = File.createTempFile( "AntMojoWrapperTest.", ".test.jar" );
             jarFile.deleteOnExit();
@@ -230,7 +232,7 @@ public class AntMojoWrapperTest
             verify( artifact, pt );
         }
 
-        List<String> messages = new ArrayList<String>();
+        List<String> messages = new ArrayList<>();
         if ( !tbl.messages.isEmpty() )
         {
             messages.addAll( tbl.messages );
@@ -244,7 +246,7 @@ public class AntMojoWrapperTest
     private static final class TestBuildListener
         implements BuildListener
     {
-        private List<String> messages = new ArrayList<String>();
+        private List<String> messages = new ArrayList<>();
 
         public void buildFinished( BuildEvent arg0 )
         {
@@ -274,6 +276,5 @@ public class AntMojoWrapperTest
         public void taskStarted( BuildEvent arg0 )
         {
         }
-    };
-
+    }
 }
diff --git a/pom.xml b/pom.xml
index 870bfb3..f600288 100644
--- a/pom.xml
+++ b/pom.xml
@@ -241,7 +241,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.2</version>
+      <version>4.12</version>
       <scope>test</scope>
     </dependency>
     <dependency>