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()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
sb.append( getGroupId() );
|
if ( getGroupId() != null )
|
||||||
sb.append( ":" );
|
{
|
||||||
|
sb.append( getGroupId() );
|
||||||
|
sb.append( ":" );
|
||||||
|
}
|
||||||
appendArtifactTypeClassifierString( sb );
|
appendArtifactTypeClassifierString( sb );
|
||||||
sb.append( ":" );
|
sb.append( ":" );
|
||||||
if ( version != null || baseVersion != null )
|
if ( version != null || baseVersion != null )
|
||||||
|
@ -285,8 +288,11 @@ public class DefaultArtifact
|
||||||
{
|
{
|
||||||
sb.append( versionRange.toString() );
|
sb.append( versionRange.toString() );
|
||||||
}
|
}
|
||||||
sb.append( ":" );
|
if ( scope != null )
|
||||||
sb.append( scope );
|
{
|
||||||
|
sb.append( ":" );
|
||||||
|
sb.append( scope );
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,22 +75,19 @@ public class DefaultArtifactTest
|
||||||
public void testToStringNullGroupId()
|
public void testToStringNullGroupId()
|
||||||
{
|
{
|
||||||
artifact.setGroupId( null );
|
artifact.setGroupId( null );
|
||||||
assertEquals( null + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact
|
assertEquals( artifactId + ":" + type + ":" + classifier + ":" + version + ":" + scope, artifact.toString() );
|
||||||
.toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToStringNullClassifier()
|
public void testToStringNullClassifier()
|
||||||
{
|
{
|
||||||
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler );
|
artifact = new DefaultArtifact( groupId, artifactId, versionRange, scope, type, null, artifactHandler );
|
||||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact
|
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + version + ":" + scope, artifact.toString() );
|
||||||
.toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testToStringNullScope()
|
public void testToStringNullScope()
|
||||||
{
|
{
|
||||||
artifact.setScope( null );
|
artifact.setScope( null );
|
||||||
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version + ":" + null, artifact
|
assertEquals( groupId + ":" + artifactId + ":" + type + ":" + classifier + ":" + version, artifact.toString() );
|
||||||
.toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue