@Test public void equalsTest() { Tag tag1 = new Tag(KEY, VALUE); Tag tag2 = new Tag(KEY, VALUE); Tag tag3 = new Tag(KEY, KEY); Tag tag4 = new Tag(VALUE, VALUE); TestUtils.equalsTest(tag1, tag2); Assert.assertNotEquals(tag1, tag3); Assert.assertNotEquals(tag1, tag4); Assert.assertNotEquals(tag3, tag1); Assert.assertNotEquals(tag4, tag3); Assert.assertNotEquals(tag1, new Object()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (this.key == null) { if (other.key != null) { return false; } } else if (!this.key.equals(other.key)) { return false; } else if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; }
Tag implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (this.key == null) { if (other.key != null) { return false; } } else if (!this.key.equals(other.key)) { return false; } else if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; } }
Tag implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (this.key == null) { if (other.key != null) { return false; } } else if (!this.key.equals(other.key)) { return false; } else if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; } Tag(String tag);  Tag(String key, String value); private  Tag(String tag, int splitPosition); }
Tag implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (this.key == null) { if (other.key != null) { return false; } } else if (!this.key.equals(other.key)) { return false; } else if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; } Tag(String tag);  Tag(String key, String value); private  Tag(String tag, int splitPosition); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
Tag implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof Tag)) { return false; } Tag other = (Tag) obj; if (this.key == null) { if (other.key != null) { return false; } } else if (!this.key.equals(other.key)) { return false; } else if (this.value == null) { if (other.value != null) { return false; } } else if (!this.value.equals(other.value)) { return false; } return true; } Tag(String tag);  Tag(String key, String value); private  Tag(String tag, int splitPosition); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final String key; final String value; }