You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/04/17 15:55:46 UTC
svn commit: r1791693 - in
/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency:
analyze/TestAnalyzeDuplicateMojo.java fromConfiguration/TestCopyMojo.java
Author: hboutemy
Date: Mon Apr 17 15:55:45 2017
New Revision: 1791693
URL: http://svn.apache.org/viewvc?rev=1791693&view=rev
Log:
fixed formatting
Modified:
maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java?rev=1791693&r1=1791692&r2=1791693&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/analyze/TestAnalyzeDuplicateMojo.java Mon Apr 17 15:55:45 2017
@@ -45,9 +45,9 @@ public class TestAnalyzeDuplicateMojo
mojo.setLog( log );
mojo.execute();
- assertTrue(log.getContent().contains("List of duplicate dependencies defined in <dependencies/> in "
- + "your pom.xml"));
- assertTrue(log.getContent().contains("junit:junit:jar"));
+ assertTrue( log.getContent().contains( "List of duplicate dependencies defined in <dependencies/> in "
+ + "your pom.xml" ) );
+ assertTrue( log.getContent().contains( "junit:junit:jar" ) );
}
public void testDuplicate2()
@@ -61,9 +61,9 @@ public class TestAnalyzeDuplicateMojo
mojo.setLog( log );
mojo.execute();
- assertTrue(log.getContent().contains("List of duplicate dependencies defined in <dependencyManagement/> in "
- + "your pom.xml"));
- assertTrue(log.getContent().contains("junit:junit:jar"));
+ assertTrue( log.getContent().contains( "List of duplicate dependencies defined in <dependencyManagement/> in "
+ + "your pom.xml" ) );
+ assertTrue( log.getContent().contains( "junit:junit:jar" ) );
}
class DuplicateLog
@@ -190,7 +190,7 @@ public class TestAnalyzeDuplicateMojo
private void print( String prefix, CharSequence content )
{
- sb.append("[").append(prefix).append("] ").append(content.toString()).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( content.toString() ).append( "\n" );
}
private void print( String prefix, Throwable error )
@@ -200,7 +200,7 @@ public class TestAnalyzeDuplicateMojo
error.printStackTrace( pWriter );
- sb.append("[").append(prefix).append("] ").append(sWriter.toString()).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( sWriter.toString() ).append( "\n" );
}
private void print( String prefix, CharSequence content, Throwable error )
@@ -210,8 +210,8 @@ public class TestAnalyzeDuplicateMojo
error.printStackTrace( pWriter );
- sb.append("[").append(prefix).append("] ").append(content.toString()).append( "\n\n" )
- .append( sWriter.toString() ).append( "\n" );
+ sb.append( "[" ).append( prefix ).append( "] " ).append( content.toString() ).append( "\n\n" );
+ sb.append( sWriter.toString() ).append( "\n" );
}
protected String getContent()
Modified: maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java?rev=1791693&r1=1791692&r2=1791693&view=diff
==============================================================================
--- maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java (original)
+++ maven/plugins/trunk/maven-dependency-plugin/src/test/java/org/apache/maven/plugins/dependency/fromConfiguration/TestCopyMojo.java Mon Apr 17 15:55:45 2017
@@ -72,41 +72,46 @@ public class TestCopyMojo
public ArtifactItem getSingleArtifactItem( boolean removeVersion, boolean useBaseVersion )
throws MojoExecutionException
{
- List<ArtifactItem> list = mojo.getProcessedArtifactItems(new ProcessArtifactItemsRequest( removeVersion, false, useBaseVersion, false ));
+ List<ArtifactItem> list =
+ mojo.getProcessedArtifactItems( new ProcessArtifactItemsRequest( removeVersion, false, useBaseVersion,
+ false ) );
return list.get( 0 );
}
- public void testSetArtifactWithoutPackaging() throws Exception
+ public void testSetArtifactWithoutPackaging()
+ throws Exception
+ {
+ mojo.setArtifact( "a:b:c" );
+ ArtifactItem item = mojo.getArtifactItems().get( 0 );
+ assertEquals( "a", item.getGroupId() );
+ assertEquals( "b", item.getArtifactId() );
+ assertEquals( "c", item.getVersion() );
+ assertEquals( "jar", item.getType() );
+ assertNull( item.getClassifier() );
+ }
+
+ public void testSetArtifactWithoutClassifier()
+ throws Exception
+ {
+ mojo.setArtifact( "a:b:c:d" );
+ ArtifactItem item = mojo.getArtifactItems().get( 0 );
+ assertEquals( "a", item.getGroupId() );
+ assertEquals( "b", item.getArtifactId() );
+ assertEquals( "c", item.getVersion() );
+ assertEquals( "d", item.getType() );
+ assertNull( item.getClassifier() );
+ }
+
+ public void testSetArtifact()
+ throws Exception
{
- mojo.setArtifact("a:b:c");
- ArtifactItem item = mojo.getArtifactItems().get(0);
- assertEquals("a", item.getGroupId());
- assertEquals("b", item.getArtifactId());
- assertEquals("c", item.getVersion());
- assertEquals("jar", item.getType());
- assertNull(item.getClassifier());
- }
-
- public void testSetArtifactWithoutClassifier() throws Exception
- {
- mojo.setArtifact("a:b:c:d");
- ArtifactItem item = mojo.getArtifactItems().get(0);
- assertEquals("a", item.getGroupId());
- assertEquals("b", item.getArtifactId());
- assertEquals("c", item.getVersion());
- assertEquals("d", item.getType());
- assertNull(item.getClassifier());
- }
-
- public void testSetArtifact() throws Exception
- {
- mojo.setArtifact("a:b:c:d:e");
- ArtifactItem item = mojo.getArtifactItems().get(0);
- assertEquals("a", item.getGroupId());
- assertEquals("b", item.getArtifactId());
- assertEquals("c", item.getVersion());
- assertEquals("d", item.getType());
- assertEquals("e", item.getClassifier());
+ mojo.setArtifact( "a:b:c:d:e" );
+ ArtifactItem item = mojo.getArtifactItems().get( 0 );
+ assertEquals( "a", item.getGroupId() );
+ assertEquals( "b", item.getArtifactId() );
+ assertEquals( "c", item.getVersion() );
+ assertEquals( "d", item.getType() );
+ assertEquals( "e", item.getClassifier() );
}
public void testGetArtifactItems()
@@ -254,22 +259,23 @@ public class TestCopyMojo
}
public void testCopyStripClassifierSetInMojo()
- throws Exception
- {
- List<ArtifactItem> list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
-
- ArtifactItem item = list.get( 0 );
- item.setOutputDirectory( new File( mojo.getOutputDirectory(), "testOverride" ) );
- mojo.setStripClassifier( true );
+ throws Exception
+ {
+ List<ArtifactItem> list = stubFactory.getArtifactItems( stubFactory.getClassifiedArtifacts() );
- mojo.setArtifactItems( createArtifactItemArtifacts( list ) );
+ ArtifactItem item = list.get( 0 );
+ item.setOutputDirectory( new File( mojo.getOutputDirectory(), "testOverride" ) );
+ mojo.setStripClassifier( true );
- mojo.execute();
- assertEquals( DependencyUtil.getFormattedFileName( item.getArtifact(), false, false, false, true ), item.getDestFileName() );
+ mojo.setArtifactItems( createArtifactItemArtifacts( list ) );
+
+ mojo.execute();
+ assertEquals( DependencyUtil.getFormattedFileName( item.getArtifact(), false, false, false, true ),
+ item.getDestFileName() );
+
+ assertFilesExist( list, true );
+ }
- assertFilesExist( list, true );
- }
-
public void testNonClassifierStrip()
throws Exception
{
@@ -771,7 +777,9 @@ public class TestCopyMojo
}
- private List<Dependency> createDependencyArtifacts( List<Dependency> items ) throws IOException {
+ private List<Dependency> createDependencyArtifacts( List<Dependency> items )
+ throws IOException
+ {
stubFactory.setCreateFiles( true );
for ( Dependency item : items )
{
@@ -793,7 +801,8 @@ public class TestCopyMojo
return items;
}
- private ArtifactItem createArtifact( ArtifactItem item ) throws IOException
+ private ArtifactItem createArtifact( ArtifactItem item )
+ throws IOException
{
stubFactory.setCreateFiles( true );