Artifact { @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(groupId); sb.append(":"); sb.append(artifactId); sb.append(":"); sb.append(version); if (!(classifier == null || "".equals(classifier.trim()))){ sb.append(":"); sb.append(classifier); } if (!(type == null || "".equals(type.trim()))){ sb.append(":"); sb.append(type); } if (!(extension == null || "".equals(extension.trim()))){ sb.append(":"); sb.append(extension); } sb.append(":"); sb.append(origin); return sb.toString(); } protected  Artifact(); String getArtifactId(); void setArtifactId(final String artifactId); String getGroupId(); void setGroupId(final String groupId); String getVersion(); void setVersion(final String version); String getType(); void setType(final String type); String getSha256(); void setSha256(String sha256); boolean isPromoted(); void setPromoted(final boolean promoted); String getClassifier(); void setClassifier(final String classifier); List<String> getLicenses(); void setLicenses(final List<String> licenses); void addLicense(final String licenseName); String getSize(); void setSize(final String size); String getDownloadUrl(); void setDownloadUrl(final String downloadUrl); String getExtension(); void setExtension(final String extension); String getProvider(); void setProvider(final String provider); String getOrigin(); void setOrigin(final String origin); Date getCreatedDateTime(); void setCreatedDateTime(Date createdDateTime); Date getUpdatedDateTime(); void setUpdatedDateTime(Date updatedDateTime); @JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnore String getGavc(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); String getDescription(); void setDescription(String description); boolean isDoNotUse(); void setDoNotUse(boolean doNotUse);  }
@Test public void testArtifactToString(){ Artifact artifact = DataModelFactory.createArtifact("com.my.company", "test", "1.0.0-SNAPSHOT", "lin64", "jar", "jar"); assertEquals("com.my.company:test:1.0.0-SNAPSHOT:lin64:jar:jar:maven", artifact.toString()); }