mirror of https://github.com/apache/maven.git
Don't print null values in DefaultArtifact.toString
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@373073 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e46a983a42
commit
016c8e31b5
|
@ -273,8 +273,11 @@ public class DefaultArtifact
|
|||
public String toString()
|
||||
{
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append( getGroupId() );
|
||||
sb.append( ":" );
|
||||
if ( getGroupId() != null )
|
||||
{
|
||||
sb.append( getGroupId() );
|
||||
sb.append( ":" );
|
||||
}
|
||||
appendArtifactTypeClassifierString( sb );
|
||||
sb.append( ":" );
|
||||
if ( version != null || baseVersion != null )
|
||||
|
@ -285,8 +288,11 @@ public class DefaultArtifact
|
|||
{
|
||||
sb.append( versionRange.toString() );
|
||||
}
|
||||
sb.append( ":" );
|
||||
sb.append( scope );
|
||||
if ( scope != null )
|
||||
{
|
||||
sb.append( ":" );
|
||||
sb.append( scope );
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -75,22 +75,19 @@ public class DefaultArtifactTest
|
|||
public void testToStringNullGroupId()
|
||||
{
|
||||
artifact.setGroupId( null );
|
||||
assertEquals( null + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact
|
||||
.toString() );
|
||||
assertEquals( artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact.toString() );
|
||||
}
|
||||
|
||||
public void testToStringNullClassifier()
|
||||
{
|
||||
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler );
|
||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact
|
||||
.toString() );
|
||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact.toString() );
|
||||
}
|
||||
|
||||
public void testToStringNullScope()
|
||||
{
|
||||
artifact.setScope( null );
|
||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + null, artifact
|
||||
.toString() );
|
||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version, artifact.toString() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue