Contributor { @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Contributor {\n"); sb.append(" id: ").append(getId()).append("\n"); sb.append(" organizationId: ").append(getOrganizationId()).append("\n"); sb.append(" name: ").append(name).append("\n"); sb.append(" url: ").append(url).append("\n"); sb.append(" organizationalCommitsCount: ").append(organizationalCommitsCount).append("\n"); sb.append(" personalCommitsCount: ").append(personalCommitsCount).append("\n"); sb.append(" personalProjectsCount: ").append(personalProjectsCount).append("\n"); sb.append(" organizationalProjectsCount: ").append(organizationalProjectsCount).append("\n"); sb.append(" organizationName: ").append(organizationName).append("\n"); sb.append(" snapshotDate: ").append(getSnapshotDate()).append("\n"); sb.append("}\n"); return sb.toString(); } Contributor();  Contributor(long id, long organizationId, Date snapshotDate); ContributorKey getKey(); @ApiModelProperty(value = "the GitHub User ID of the Contributor. Part of the primary key. See official GitHub REST API guide.") @JsonProperty("id") long getId(); @ApiModelProperty(value = "the GitHub ID of the organization. Part of the primary key. See official GitHub REST API guide.") @JsonProperty("organizationId") long getOrganizationId(); @ApiModelProperty(value = "Name of contributor") @JsonProperty("name") String getName(); void setName(String name); @ApiModelProperty(value = "URL of contributor") @JsonProperty("url") String getUrl(); void setUrl(String url); @ApiModelProperty(value = "Count of organizational commits.") @JsonProperty("organizationalCommitsCount") Integer getOrganizationalCommitsCount(); void setOrganizationalCommitsCount(Integer organizationalCommitsCount); @ApiModelProperty(value = "Count of personal commits.") @JsonProperty("personalCommitsCount") Integer getPersonalCommitsCount(); void setPersonalCommitsCount(Integer personalCommitsCount); @ApiModelProperty(value = "Count of personal projects of contributor.") @JsonProperty("personalProjectsCount") Integer getPersonalProjectsCount(); void setPersonalProjectsCount(Integer personalProjectsCount); @ApiModelProperty(value = "Count of organization projects of contributor.") @JsonProperty("organizationalProjectsCount") Integer getOrganizationalProjectsCount(); void setOrganizationalProjectsCount(Integer organizationalProjectsCount); @ApiModelProperty(value = "Organization of the Contributor.") @JsonProperty("organizationName") String getOrganizationName(); void setOrganizationName(String organizationName); @ApiModelProperty(value = "Contributor snapshot date. Part of the primary key.") @JsonProperty("snapshotDate") Date getSnapshotDate(); String getLoginId(); @Override String toString();  }
@Test public void testToString_containsKey() throws Exception { Date date = new Date(); Contributor contributor = new Contributor(123456789, 987654321, date); String str = contributor.toString(); assertThat(str, stringContainsInOrder(asList("id", ":", "123456789"))); assertThat(str, stringContainsInOrder(asList("organizationId", ":", "987654321"))); assertThat(str, stringContainsInOrder(asList("snapshotDate", ":", "" + date))); }