### Question:
ObjectIdQuery extends IndirectQuery { @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof ObjectIdQuery)) { return false; } ObjectIdQuery query = (ObjectIdQuery) object; return Util.nullSafeEquals(objectId, query.getObjectId()); } @SuppressWarnings("unused") private  ObjectIdQuery();  ObjectIdQuery(ObjectId objectID);  ObjectIdQuery(ObjectId objectId, boolean fetchingDataRows, int cachePolicy); @Override QueryMetadata getMetaData(final EntityResolver resolver); ObjectId getObjectId(); int getCachePolicy(); boolean isFetchMandatory(); boolean isFetchAllowed(); boolean isFetchingDataRows(); @Override String toString(); @Override boolean equals(Object object); @Override int hashCode(); static final int CACHE; static final int CACHE_REFRESH; static final int CACHE_NOREFRESH; }### Answer:
@Test public void testEquals() throws Exception { ObjectIdQuery q1 = new ObjectIdQuery(ObjectId.of("abc", "a", 1)); ObjectIdQuery q2 = new ObjectIdQuery(ObjectId.of("abc", "a", 1)); ObjectIdQuery q3 = new ObjectIdQuery(ObjectId.of("abc", "a", 3)); ObjectIdQuery q4 = new ObjectIdQuery(ObjectId.of("123", "a", 1)); assertTrue(q1.equals(q2)); assertEquals(q1.hashCode(), q2.hashCode()); assertFalse(q1.equals(q3)); assertFalse(q1.hashCode() == q3.hashCode()); assertFalse(q1.equals(q4)); assertFalse(q1.hashCode() == q4.hashCode()); }