DomainInfo { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (!(obj instanceof DomainInfo)) { return false; } final DomainInfo other = (DomainInfo) obj; return Objects.equals(this.domain, other.domain) && Objects.equals(this.domainVersion, other.domainVersion); } DomainInfo(final String domain, final String domainVersion); String getDomain(); String getDomainVersion(); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void testEqualsReturnsTrueForSameObjects() { final DomainInfo thisDomainInfo = DOMAIN_INFO_DISTRIBUTION_AUTOMATION; final DomainInfo otherDomainInfo = DOMAIN_INFO_DISTRIBUTION_AUTOMATION; final boolean actual = thisDomainInfo.equals(otherDomainInfo); assertThat(actual).isTrue(); }
@Test public void testEqualsReturnsTrueForObjectsWithSameValues() { final DomainInfo thisDomainInfo = new DomainInfo(DOMAIN_DISTRIBUTION_AUTOMATION, DOMAIN_VERSION); final DomainInfo otherDomainInfo = new DomainInfo(DOMAIN_DISTRIBUTION_AUTOMATION, DOMAIN_VERSION); final boolean actual = thisDomainInfo.equals(otherDomainInfo); assertThat(actual).isTrue(); }
@Test public void testEqualsReturnsFalseForObjectsWithDifferentDomainValues() { final DomainInfo thisDomainInfo = new DomainInfo(DOMAIN_DISTRIBUTION_AUTOMATION, DOMAIN_VERSION); final DomainInfo otherDomainInfo = new DomainInfo(DOMAIN_PUBLIC_LIGHTING, DOMAIN_VERSION); final boolean actual = thisDomainInfo.equals(otherDomainInfo); assertThat(actual).isFalse(); }
@Test public void testEqualsReturnsFalseForObjectsWithDifferentDomainVersionValues() { final DomainInfo thisDomainInfo = new DomainInfo(DOMAIN_DISTRIBUTION_AUTOMATION, "1.0"); final DomainInfo otherDomainInfo = new DomainInfo(DOMAIN_DISTRIBUTION_AUTOMATION, "2.0"); final boolean actual = thisDomainInfo.equals(otherDomainInfo); assertThat(actual).isFalse(); }