AccessVerifyConnectionSpec implements ConnectionSpec { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; AccessVerifyConnectionSpec that = (AccessVerifyConnectionSpec) o; if (accessCode != null ? !accessCode.equals(that.accessCode) : that.accessCode != null) return false; if (division != null ? !division.equals(that.division) : that.division != null) return false; if (verifyCode != null ? !verifyCode.equals(that.verifyCode) : that.verifyCode != null) return false; return true; } AccessVerifyConnectionSpec(String division, final String accessCode, final String verifyCode, String clientAddress, String clientHostName); String getClientAddress(); String getClientHostName(); String getDivision(); String getAccessCode(); String getVerifyCode(); String getCredentials(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static final String DIVISION_CREDENTIALS_DELIMITER; static final String ACCESS_VERIFY_CODE_DELIMITER; }
@Test public void testEquals() { AccessVerifyConnectionSpec av1 = new AccessVerifyConnectionSpec("960", "foo", "bar", "123.45.67.89", "www.example.org"); AccessVerifyConnectionSpec av2 = new AccessVerifyConnectionSpec("960", "foo", "bar", "123.45.67.89", "www.example.org"); AccessVerifyConnectionSpec av3 = new AccessVerifyConnectionSpec("960", "foo", "baz", "123.45.67.89", "www.example.org"); AccessVerifyConnectionSpec av4 = new AccessVerifyConnectionSpec("960", "bar", "foo", "123.45.67.89", "www.example.org"); assertThat(av1, equalTo(av2)); assertThat(av2, equalTo(av1)); assertThat(av3, not(equalTo(av1))); assertThat(av1, not(equalTo(av3))); assertThat(av4, not(equalTo(av1))); assertThat(av1, not(equalTo(av4))); }