BasicTag implements Tag { @Override public boolean equals(Object o) { if (this == o) { return true; } else if (o instanceof Tag) { Tag t = (Tag) o; return key.equals(t.getKey()) && value.equals(t.getValue()); } else { return false; } } BasicTag(String key, String value); String getKey(); String getValue(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static BasicTag parseTag(String tagString); @Override String tagString();  }
@Test public void testEquals() throws Exception { BasicTag localTag = new BasicTag(TEST_KEY, TEST_VALUE); BasicTag notEqualTag = new BasicTag(TEST_KEY, "goo"); assertTrue(testTag != localTag); assertTrue(testTag.equals(localTag)); assertTrue(testTag.getKey().equals(TEST_KEY)); assertTrue(testTag.getValue().equals(TEST_VALUE)); assertTrue(!testTag.equals(notEqualTag)); }