Implement some #toString() methods

* Implement Developer#toString()
* Implement IssueManagement#toString()
* Implement License#toString()
* Implement Build#toString()
* Implement Organization#toString()
* Implement MailingList#toString()
* Implement Scm#toString()

This closes #923
This commit is contained in:
Piotrek Żygieło 2022-01-17 16:23:28 +01:00 committed by Michael Osipov
parent a6b8a9e9fb
commit 4adaf2abca
8 changed files with 255 additions and 0 deletions

View File

@ -618,6 +618,18 @@
]]>
</code>
</codeSegment>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
@Override
public String toString()
{
return "PluginContainer {}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class>
@ -641,6 +653,22 @@
</association>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "PluginConfiguration {" + super.toString() + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class xdoc.anchorName="profile_build">
<name>BuildBase</name>
@ -715,6 +743,22 @@
</association>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "BuildBase {" + super.toString() + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class>
<name>Build</name>
@ -792,6 +836,22 @@
</association>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Build {" + super.toString() + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>CiManagement</name>
@ -971,6 +1031,22 @@
</association>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Contributor {name=" + name + ", email=" + email + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>Dependency</name>
@ -1179,6 +1255,22 @@
<type>String</type>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Developer {id=" + id + ", " + super.toString() + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>Exclusion</name>
@ -1225,6 +1317,22 @@
<type>String</type>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "IssueManagement {system=" + system + ", url=" + url + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>DistributionManagement</name>
@ -1346,6 +1454,22 @@
<type>String</type>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "License {name=" + name + ", url=" + url + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>MailingList</name>
@ -1421,6 +1545,22 @@
<comment>We could probably have a specific element for a dev mailing list for things like CI,
and maybe even a specific element for the user and scm mailing lists. Then leave the more
lose structure for any other type of mailing list.</comment>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "MailingList {name=" + name + ", archive=" + archive + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>Organization</name>
@ -1440,6 +1580,22 @@
<type>String</type>
</field>
</fields>
<codeSegments>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Organization {name=" + name + ", url=" + url + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class java.clone="deep">
<name>PatternSet</name>
@ -1737,6 +1893,20 @@
]]>
</code>
</codeSegment>
<codeSegment>
<version>4.0.0+</version>
<code>
<![CDATA[
/**
* @see java.lang.Object#toString()
*/
public String toString()
{
return "Scm {connection=" + connection + "}";
}
]]>
</code>
</codeSegment>
</codeSegments>
</class>
<class>

View File

@ -45,4 +45,12 @@ public class BuildTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new Build().toString());
}
public void testToStringNotNonsense() {
Build build = new Build();
String s = build.toString();
assert "Build {BuildBase {PluginConfiguration {PluginContainer {}}}}".equals(s) : s;
}
}

View File

@ -45,4 +45,15 @@ public class DeveloperTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new Developer().toString());
}
public void testToStringNotNonsense() {
Developer dev = new Developer();
dev.setName("Maven Tester");
dev.setEmail("tester@acme.localdomain");
dev.setId("20220118");
String s = dev.toString();
assert "Developer {id=20220118, Contributor {name=Maven Tester, email=tester@acme.localdomain}}".equals(s) : s;
}
}

View File

@ -45,4 +45,14 @@ public class IssueManagementTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new IssueManagement().toString());
}
public void testToStringNotNonsense() {
IssueManagement im = new IssueManagement();
im.setSystem("Velociraptor");
im.setUrl("https://velo.localdomain");
String s = im.toString();
assert "IssueManagement {system=Velociraptor, url=https://velo.localdomain}".equals(s) : s;
}
}

View File

@ -45,4 +45,14 @@ public class LicenseTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new License().toString());
}
public void testToStringNotNonsense() {
License license = new License();
license.setName("Unlicense");
license.setUrl("http://lic.localdomain");
String s = license.toString();
assert "License {name=Unlicense, url=http://lic.localdomain}".equals(s) : s;
}
}

View File

@ -45,4 +45,13 @@ public class MailingListTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new MailingList().toString());
}
public void testToStringNotNonsense() {
MailingList list = new MailingList();
list.setName("modello-dev");
String s = list.toString();
assertEquals("MailingList {name=modello-dev, archive=null}", s);
}
}

View File

@ -45,4 +45,32 @@ public class OrganizationTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new Organization().toString());
}
public void testToStringNotNonsense11() {
Organization org = new Organization();
org.setName("Testing Maven Unit");
org.setUrl("https://maven.localdomain");
assertEquals("Organization {name=Testing Maven Unit, url=https://maven.localdomain}", org.toString());
}
public void testToStringNotNonsense10() {
Organization org = new Organization();
org.setName("Testing Maven Unit");
assertEquals("Organization {name=Testing Maven Unit, url=null}", org.toString());
}
public void testToStringNotNonsense01() {
Organization org = new Organization();
org.setUrl("https://maven.localdomain");
assertEquals("Organization {name=null, url=https://maven.localdomain}", org.toString());
}
public void testToStringNotNonsense00() {
Organization org = new Organization();
assertEquals("Organization {name=null, url=null}", org.toString());
}
}

View File

@ -45,4 +45,13 @@ public class ScmTest extends TestCase {
public void testToStringNullSafe() {
assertNotNull(new Scm().toString());
}
public void testToStringNotNonsense() {
Scm scm = new Scm();
scm.setConnection("scm:git:git://git.localdomain/model");
String s = scm.toString();
assertEquals("Scm {connection=scm:git:git://git.localdomain/model}", s);
}
}