Dependency implements Serializable { @Override public String toString() { StringBuilder builder = new StringBuilder(128); builder.append(id); builder.append(":"); builder.append(versionRange); if (framework != null) { builder.append(":"); builder.append(framework.name()); } return builder.toString(); }  static Dependency parseString(String dependencyString); String getId(); void setId(String id); VersionRange getVersionRange(); @XmlAttribute(name = "version") String getVersionRangeString(); void setVersionRangeString(String versionRangeString); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); public VersionRange versionRange; public Framework framework; }
@Test public void testToString() throws Exception { Dependency dependency = new Dependency(); dependency.setId("PACKAGE_ID"); dependency.versionRange = VersionRange.parse("1.2.3"); assertThat(dependency.toString()).as("toString - identifier and version concatenation").isEqualTo("PACKAGE_ID:1.2.3"); }