### Question:
CompoundObjectId extends BaseObjectId { @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof CompoundObjectId)) { return false; } return id.equals(((CompoundObjectId)object).id); } CompoundObjectId(Map<String, Object> id); @Override Object get(String attributeName); @Override Object get(); @Override int size(); @Override String toString(); @Override boolean equals(Object object); @Override int hashCode(); static String mapToString(Map<String, Object> m);  }### Answer:
@Test public void testEquals() { assertTrue(new CompoundObjectId(new HashMap<>()).equals(new CompoundObjectId(new HashMap<>()))); Map<String, Object> ids1 = new HashMap<>(); ids1.put("id1", new Integer(1)); ids1.put("id2", "2"); CompoundObjectId objectId1 = new CompoundObjectId(ids1); assertTrue(objectId1.equals(objectId1)); CompoundObjectId objectId2 = new CompoundObjectId(ids1); assertTrue(objectId1.equals(objectId2)); Map<String, Object> ids3 = new HashMap<>(); ids3.put("id1", new Integer(1)); ids3.put("id2", "2"); CompoundObjectId objectId3 = new CompoundObjectId(ids3); assertTrue(objectId1.equals(objectId3)); }
@Test public void testNotEquals() { Map<String, Object> ids1 = new HashMap<>(); ids1.put("id1", new Integer(1)); ids1.put("id2", "2"); CompoundObjectId objectId1 = new CompoundObjectId(ids1); assertFalse(objectId1.equals(new String("2"))); assertFalse(objectId1.equals(new CompoundObjectId(new HashMap<>()))); Map<String, Object> ids2 = new HashMap<>(); ids2.put("id1", new Integer(-1)); ids2.put("id2", "2"); CompoundObjectId objectId2 = new CompoundObjectId(ids2); assertFalse(objectId1.equals(objectId2)); }