MetadataElement implements NameValuePair, Cloneable { @Override public boolean equals(Object obj) { if (obj instanceof MetadataElement) { if (((MetadataElement) obj).getKey().equals(getKey())) { return true; } } return false; } MetadataElement();  MetadataElement(KeyValuePair kp);  MetadataElement(String key, String value); @Override void setKey(String key); @Override String getKey(); @Override void setValue(String value); @Override String getValue(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); @Override Object clone();  }
@Test public void testEquals() { assertTrue(me1.equals(me2)); assertTrue(me1.equals(me3)); assertTrue(!me1.equals(me4)); assertFalse(me1.equals(new Object())); }