@Test public void testEquals() { LinkState linkState1 = new LinkState(0, 0); LinkState linkState2 = new LinkState(0, 0, null); Assert.assertFalse(linkState1.equals(null)); Assert.assertTrue(linkState1.equals(linkState1)); Assert.assertFalse(linkState1.equals("")); Assert.assertTrue(linkState1.equals(linkState2)); }
@Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } LinkState rhs = (LinkState) object; return new EqualsBuilder() .append(getResponseCode(), rhs.getResponseCode()) .append(getLastCheckedTime(), rhs.getLastCheckedTime()) .append(getContextData(), rhs.getContextData()) .isEquals(); }
LinkState { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } LinkState rhs = (LinkState) object; return new EqualsBuilder() .append(getResponseCode(), rhs.getResponseCode()) .append(getLastCheckedTime(), rhs.getLastCheckedTime()) .append(getContextData(), rhs.getContextData()) .isEquals(); } }
LinkState { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } LinkState rhs = (LinkState) object; return new EqualsBuilder() .append(getResponseCode(), rhs.getResponseCode()) .append(getLastCheckedTime(), rhs.getLastCheckedTime()) .append(getContextData(), rhs.getContextData()) .isEquals(); } LinkState(int responseCode, long lastCheckedTime, Map<String, Object> contextData);  LinkState(int responseCode, long lastCheckedTime); }
LinkState { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } LinkState rhs = (LinkState) object; return new EqualsBuilder() .append(getResponseCode(), rhs.getResponseCode()) .append(getLastCheckedTime(), rhs.getLastCheckedTime()) .append(getContextData(), rhs.getContextData()) .isEquals(); } LinkState(int responseCode, long lastCheckedTime, Map<String, Object> contextData);  LinkState(int responseCode, long lastCheckedTime); long getLastCheckedTime(); int getResponseCode(); Map<String, Object> getContextData(); @Override boolean equals(Object object); @Override int hashCode(); }
LinkState { @Override public boolean equals(Object object) { if (object == null) { return false; } if (object == this) { return true; } if (object.getClass() != getClass()) { return false; } LinkState rhs = (LinkState) object; return new EqualsBuilder() .append(getResponseCode(), rhs.getResponseCode()) .append(getLastCheckedTime(), rhs.getLastCheckedTime()) .append(getContextData(), rhs.getContextData()) .isEquals(); } LinkState(int responseCode, long lastCheckedTime, Map<String, Object> contextData);  LinkState(int responseCode, long lastCheckedTime); long getLastCheckedTime(); int getResponseCode(); Map<String, Object> getContextData(); @Override boolean equals(Object object); @Override int hashCode();  }