diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java index 7296c01..c38e852 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/AbstractMojoTestCase.java @@ -21,7 +21,6 @@ import java.io.BufferedReader; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.Reader; @@ -29,6 +28,7 @@ import java.lang.reflect.Field; import java.net.MalformedURLException; import java.net.URL; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -162,6 +162,7 @@ protected void setUp() artifact.setFile( getPluginArtifactFile() ); pluginDescriptor.setPluginArtifact( artifact ); + //noinspection ArraysAsListWithZeroOrOneArgument pluginDescriptor.setArtifacts( Arrays.asList( artifact ) ); for ( ComponentDescriptor desc : pluginDescriptor.getComponents() ) @@ -237,7 +238,7 @@ else if ( "jar".equalsIgnoreCase( resource.getProtocol() ) ) protected InputStream getPublicDescriptorStream() throws Exception { - return new FileInputStream( new File( getPluginDescriptorPath() ) ); + return Files.newInputStream( new File( getPluginDescriptorPath() ).toPath() ); } protected String getPluginDescriptorPath() @@ -258,7 +259,7 @@ protected void setupContainer() { List modules = new ArrayList<>(); addGuiceModules( modules ); - container = new DefaultPlexusContainer( cc, modules.toArray( new Module[modules.size()] ) ); + container = new DefaultPlexusContainer( cc, modules.toArray( new Module[0] ) ); } catch ( PlexusContainerException e ) { @@ -270,6 +271,7 @@ protected void setupContainer() /** * @since 3.0.0 */ + @SuppressWarnings( "EmptyMethod" ) protected void addGuiceModules( List modules ) { // no custom guice modules by default @@ -277,15 +279,11 @@ protected void addGuiceModules( List modules ) protected ContainerConfiguration setupContainerConfiguration() { - ClassWorld classWorld = new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ); - - ContainerConfiguration cc = new DefaultContainerConfiguration() - .setClassWorld( classWorld ) + return new DefaultContainerConfiguration() + .setClassWorld( new ClassWorld( "plexus.core", Thread.currentThread().getContextClassLoader() ) ) .setClassPathScanning( PlexusConstants.SCANNING_INDEX ) .setAutoWiring( true ) - .setName( "maven" ); - - return cc; + .setName( "maven" ); } @Override @@ -498,6 +496,7 @@ protected MavenSession newMavenSession( MavenProject project ) MavenSession session = new MavenSession( container, MavenRepositorySystemUtils.newSession(), request, result ); session.setCurrentProject( project ); + //noinspection ArraysAsListWithZeroOrOneArgument session.setProjects( Arrays.asList( project ) ); return session; } diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java index 73bc8ee..618d36f 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ArtifactStubFactory.java @@ -316,7 +316,7 @@ public void createUnpackableFile( Artifact artifact, File destFile ) WarArchiver war = (WarArchiver) archiver; // the use of this is counter-intuitive: // http://jira.codehaus.org/browse/PLX-286 - war.setIgnoreWebxml( false ); + war.setExpectWebXml( false ); } archiver.createArchive(); } @@ -549,7 +549,7 @@ public static void setVariableValueToObject( Object object, String variable, Obj */ public static String getFormattedFileName( Artifact artifact, boolean removeVersion ) { - String destFileName = null; + String destFileName; // if there is a file and we aren't stripping the version, just get the // name directly @@ -560,7 +560,7 @@ public static String getFormattedFileName( Artifact artifact, boolean removeVers else // if offline { - String versionString = null; + String versionString; if ( !removeVersion ) { versionString = "-" + artifact.getVersion(); diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java index c54ba97..2fef3db 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/MojoRule.java @@ -87,7 +87,8 @@ protected void before() throws Throwable /** * May be overridden in the implementation to do stuff after the current test was run. */ - protected void after() + @SuppressWarnings( "EmptyMethod" ) + protected void after() { } diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java index 5192d4b..36af4aa 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/ResolverExpressionEvaluatorStub.java @@ -75,7 +75,7 @@ public Object evaluate( String expr ) } // Was not an expression - if ( expression.indexOf( "$$" ) > -1 ) + if ( expression.contains( "$$" ) ) { return expression.replaceAll( "\\$\\$", "\\$" ); } diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/resources/TestResources.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/resources/TestResources.java index d28591e..b183c3e 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/resources/TestResources.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/resources/TestResources.java @@ -21,6 +21,7 @@ import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.Collection; import java.util.Set; import java.util.TreeSet; @@ -116,11 +117,7 @@ public static void assertDirectoryContents( File dir, String... expectedPaths ) scanner.addDefaultExcludes(); scanner.scan(); - Set actual = new TreeSet<>(); - for ( String path : scanner.getIncludedFiles() ) - { - actual.add( path ); - } + Set actual = new TreeSet<>( Arrays.asList( scanner.getIncludedFiles() ) ); for ( String path : scanner.getIncludedDirectories() ) { if ( path.length() > 0 ) @@ -132,10 +129,7 @@ public static void assertDirectoryContents( File dir, String... expectedPaths ) Set expected = new TreeSet<>(); if ( expectedPaths != null ) { - for ( String path : expectedPaths ) - { - expected.add( path ); - } + expected.addAll( Arrays.asList( expectedPaths ) ); } // compare textual representation to make diff easier to understand diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java index 63f15c5..33b7dba 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/ArtifactStub.java @@ -185,14 +185,7 @@ public String getId() @Override public String getDependencyConflictId() { - StringBuffer buffer = new StringBuffer(); - - buffer.append( getGroupId() ); - buffer.append( ":" ).append( getArtifactId() ); - buffer.append( ":" ).append( getType() ); - buffer.append( ":" ).append( getClassifier() ); - - return buffer.toString(); + return getGroupId() + ":" + getArtifactId() + ":" + getType() + ":" + getClassifier(); } /** @@ -200,6 +193,7 @@ public String getDependencyConflictId() * * @see org.apache.maven.artifact.Artifact#addMetadata(org.apache.maven.artifact.metadata.ArtifactMetadata) */ + @SuppressWarnings( "deprecation" ) @Override public void addMetadata( ArtifactMetadata artifactMetadata ) { @@ -210,6 +204,7 @@ public void addMetadata( ArtifactMetadata artifactMetadata ) * @return null. * @see org.apache.maven.artifact.Artifact#getMetadataList() */ + @SuppressWarnings( "deprecation" ) @Override public Collection getMetadataList() { @@ -549,6 +544,7 @@ public boolean isFromAuthoritativeRepository() return true; } + @SuppressWarnings( "EmptyMethod" ) public void setFromAuthoritativeRepository( boolean fromAuthoritativeRepository ) { // nothing diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java index aacb6e7..4b81e85 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/MavenProjectStub.java @@ -69,6 +69,7 @@ * * @author jesse */ +@SuppressWarnings( "FieldCanBeLocal" ) public class MavenProjectStub extends MavenProject { @@ -282,19 +283,14 @@ public void setRemoteArtifactRepositories( List list ) @Override public List getRemoteArtifactRepositories() { - return Collections.emptyList(); + return Collections.emptyList(); } /** {@inheritDoc} */ @Override public boolean hasParent() { - if ( parent != null ) - { - return true; - } - - return false; + return parent != null; } /** {@inheritDoc} */ @@ -337,7 +333,7 @@ public void setDependencies( List list ) @Override public List getDependencies() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -960,7 +956,7 @@ public void setMailingLists( List list ) @Override public List getMailingLists() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -993,7 +989,7 @@ public void setDevelopers( List list ) @Override public List getDevelopers() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1026,7 +1022,7 @@ public void setContributors( List list ) @Override public List getContributors() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1062,7 +1058,7 @@ public Build getBuild() @Override public List getResources() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1073,7 +1069,7 @@ public List getResources() @Override public List getTestResources() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1164,7 +1160,7 @@ public void setArtifacts( Set set ) @Override public Set getArtifacts() { - return Collections.emptySet(); + return Collections.emptySet(); } /** @@ -1175,7 +1171,7 @@ public Set getArtifacts() @Override public Map getArtifactMap() { - return Collections.emptyMap(); + return Collections.emptyMap(); } /** @@ -1197,7 +1193,7 @@ public void setPluginArtifacts( Set set ) @Override public Set getPluginArtifacts() { - return Collections.emptySet(); + return Collections.emptySet(); } /** @@ -1208,7 +1204,7 @@ public Set getPluginArtifacts() @Override public Map getPluginArtifactMap() { - return Collections.emptyMap(); + return Collections.emptyMap(); } /** @@ -1230,7 +1226,7 @@ public void setReportArtifacts( Set set ) @Override public Set getReportArtifacts() { - return Collections.emptySet(); + return Collections.emptySet(); } /** @@ -1241,7 +1237,7 @@ public Set getReportArtifacts() @Override public Map getReportArtifactMap() { - return Collections.emptyMap(); + return Collections.emptyMap(); } /** @@ -1263,7 +1259,7 @@ public void setExtensionArtifacts( Set set ) @Override public Set getExtensionArtifacts() { - return Collections.emptySet(); + return Collections.emptySet(); } /** @@ -1274,7 +1270,7 @@ public Set getExtensionArtifacts() @Override public Map getExtensionArtifactMap() { - return Collections.emptyMap(); + return Collections.emptyMap(); } /** @@ -1307,7 +1303,7 @@ public Artifact getParentArtifact() @Override public List getRepositories() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1318,7 +1314,7 @@ public List getRepositories() @Override public List getReportPlugins() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1329,7 +1325,7 @@ public List getReportPlugins() @Override public List getBuildPlugins() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1340,7 +1336,7 @@ public List getBuildPlugins() @Override public List getModules() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1357,6 +1353,7 @@ public PluginManagement getPluginManagement() /** * By default, do nothing. */ + @SuppressWarnings( "EmptyMethod" ) public void addPlugin( Plugin plugin ) { // nop @@ -1367,6 +1364,7 @@ public void addPlugin( Plugin plugin ) * * @param plugin */ + @SuppressWarnings( "EmptyMethod" ) public void injectPluginManagementInfo( Plugin plugin ) { // nop @@ -1419,7 +1417,7 @@ public ArtifactRepository getDistributionManagementArtifactRepository() @Override public List getPluginRepositories() { - return Collections.emptyList(); + return Collections.emptyList(); } /** {@inheritDoc} */ @@ -1575,7 +1573,7 @@ public Model getOriginalModel() @Override public List getBuildExtensions() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1587,7 +1585,7 @@ public List getBuildExtensions() public Set createArtifacts( ArtifactFactory artifactFactory, String string, ArtifactFilter artifactFilter ) { - return Collections.emptySet(); + return Collections.emptySet(); } /** @@ -1631,7 +1629,7 @@ public Properties getProperties() @Override public List getFilters() { - return Collections.emptyList(); + return Collections.emptyList(); } /** @@ -1642,7 +1640,7 @@ public List getFilters() @Override public Map getProjectReferences() { - return Collections.emptyMap(); + return Collections.emptyMap(); } /** {@inheritDoc} */ diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java index 0d63904..65995c8 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactRepository.java @@ -37,7 +37,7 @@ public class StubArtifactRepository implements ArtifactRepository { - private String baseDir = null; + private final String baseDir; /** * Default constructor diff --git a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java index b9ea73a..f950b58 100644 --- a/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java +++ b/maven-plugin-testing-harness/src/main/java/org/apache/maven/plugin/testing/stubs/StubArtifactResolver.java @@ -45,11 +45,11 @@ public class StubArtifactResolver implements ArtifactResolver { - private boolean throwArtifactResolutionException; + private final boolean throwArtifactResolutionException; - private boolean throwArtifactNotFoundException; + private final boolean throwArtifactNotFoundException; - private ArtifactStubFactory factory; + private final ArtifactStubFactory factory; /** * Default constructor diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java index 75d7836..dfbd8ab 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ArtifactStubFactoryTest.java @@ -35,7 +35,7 @@ public void testVersionChecks() throws IOException assertFalse(factory.getSnapshotArtifact().isRelease()); } - public void testCreateFiles() throws IOException + public void testCreateFiles() { ArtifactStubFactory factory = new ArtifactStubFactory(); assertFalse(factory.isCreateFiles()); diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java index 2d4faa0..5f1f802 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorMojo.java @@ -22,7 +22,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; import org.codehaus.plexus.util.StringUtils; /** @@ -40,7 +39,7 @@ public class ExpressionEvaluatorMojo /** {@inheritDoc} */ @Override public void execute() - throws MojoExecutionException, MojoFailureException + throws MojoExecutionException { if ( StringUtils.isEmpty( basedir ) ) { diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java index 3939bd2..e4666d5 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/ExpressionEvaluatorTest.java @@ -32,7 +32,6 @@ public class ExpressionEvaluatorTest extends AbstractMojoTestCase { - private Xpp3Dom pomDom; private PlexusConfiguration pluginConfiguration; @@ -43,24 +42,22 @@ protected void setUp() { super.setUp(); - StringBuffer pom = new StringBuffer(); + String pom = "" + "\n" + + " " + "\n" + + " " + "\n" + + " " + "\n" + + " maven-test-mojo" + "\n" + + " " + "\n" + + " ${basedir}" + "\n" + + " ${basedir}/workDirectory" + "\n" + + " ${localRepository}" + "\n" + + " " + "\n" + + " " + "\n" + + " " + "\n" + + " " + "\n" + + "" + "\n"; - pom.append( "" ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " maven-test-mojo" ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " ${basedir}" ).append( "\n" ); - pom.append( " ${basedir}/workDirectory" ).append( "\n" ); - pom.append( " ${localRepository}" ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( " " ).append( "\n" ); - pom.append( "" ).append( "\n" ); - - pomDom = Xpp3DomBuilder.build( new StringReader( pom.toString() ) ); + Xpp3Dom pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); pluginConfiguration = extractPluginConfiguration( "maven-test-mojo", pomDom ); } diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java index d5f3075..8a11b8e 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoRuleTest.java @@ -40,18 +40,14 @@ public class MojoRuleTest private boolean beforeWasCalled = false; @Rule - public MojoRule rule = new MojoRule() { + public final MojoRule rule = new MojoRule() { @Override - protected void before() throws Throwable + protected void before() { beforeWasCalled = true; } }; - - private String pom; - - private Xpp3Dom pomDom; private PlexusConfiguration pluginConfiguration; @@ -61,8 +57,7 @@ public void setUp() throws Exception { - pom = - "" + + String pom = "" + "" + "" + "" + @@ -76,17 +71,15 @@ public void setUp() "" + ""; - pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); + Xpp3Dom pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); pluginConfiguration = rule.extractPluginConfiguration( "maven-simple-plugin", pomDom ); } /** - * @throws Exception if any */ @Test public void testPluginConfigurationExtraction() - throws Exception { assertEquals( "valueOne", pluginConfiguration.getChild( "keyOne" ).getValue() ); @@ -163,14 +156,12 @@ public void testSettingMojoVariables() @Test @WithoutMojo public void testNoRuleWrapper() - throws Exception { assertFalse( "before executed although WithMojo annotation was added", beforeWasCalled ); } @Test public void testWithRuleWrapper() - throws Exception { assertTrue( "before executed because WithMojo annotation was not added", beforeWasCalled ); } diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java index c0364f3..6858175 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/MojoTestCaseTest.java @@ -32,9 +32,6 @@ public class MojoTestCaseTest extends AbstractMojoTestCase { - private String pom; - - private Xpp3Dom pomDom; private PlexusConfiguration pluginConfiguration; @@ -45,8 +42,7 @@ protected void setUp() { super.setUp(); - pom = - "" + + String pom = "" + "" + "" + "" + @@ -60,16 +56,14 @@ protected void setUp() "" + ""; - pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); + Xpp3Dom pomDom = Xpp3DomBuilder.build( new StringReader( pom ) ); pluginConfiguration = extractPluginConfiguration( "maven-simple-plugin", pomDom ); } /** - * @throws Exception if any */ public void testPluginConfigurationExtraction() - throws Exception { assertEquals( "valueOne", pluginConfiguration.getChild( "keyOne" ).getValue() ); diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java index c4f32be..3fb57c0 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/PluginArtifactFileTest.java @@ -30,7 +30,6 @@ public class PluginArtifactFileTest private static final String FS = System.getProperty( "file.separator" ); public void testArtifact() - throws Exception { MojoExecution execution = newMojoExecution( "parameters" ); // TODO dedicated test mojo diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java index 85ea293..3d1bd10 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/SimpleMojo.java @@ -20,7 +20,6 @@ */ import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; /** * @author Jason van Zyl @@ -44,7 +43,6 @@ public String getKeyTwo() @Override public void execute() - throws MojoExecutionException { } } diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java index 4d782df..25135ac 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/TestSilentLog.java @@ -31,7 +31,7 @@ public class TestSilentLog public void testLog() { Log log = new SilentLog(); - String text = new String( "Text" ); + String text = "Text"; Throwable e = new RuntimeException(); log.debug( text ); log.debug( text, e ); @@ -54,7 +54,7 @@ public void testLog() public void testLogger() { Logger log = new SilentLog(); - String text = new String( "Text" ); + String text = "Text"; Throwable e = new RuntimeException(); log.debug( text ); diff --git a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java index c7a78e3..36c4b65 100644 --- a/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java +++ b/maven-plugin-testing-harness/src/test/java/org/apache/maven/plugin/testing/resources/TestResourcesTest.java @@ -23,7 +23,7 @@ public class TestResourcesTest { - public TestResources resources = new TestResources(); + public final TestResources resources = new TestResources(); @Test( expected = IllegalStateException.class ) public void testNoRuleAnnotation() diff --git a/pom.xml b/pom.xml index e2fa417..93851b2 100644 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ under the License. 2.22.2 3.2.5 plugin-testing-archives/LATEST - 7 + 8 2020-04-07T21:04:00Z