### Question:
DefaultQueryMetadata implements QueryMetadata, Cloneable { @Override public boolean equals(Object o) { if (o instanceof QueryMetadata) { QueryMetadata q = (QueryMetadata) o; return q.getFlags().equals(flags) && q.getGroupBy().equals(groupBy) && Objects.equal(q.getHaving(), having) && q.isDistinct() == distinct && q.isUnique() == unique && q.getJoins().equals(getJoins()) && q.getModifiers().equals(modifiers) && q.getOrderBy().equals(orderBy) && q.getParams().equals(params) && Objects.equal(q.getProjection(), projection) && Objects.equal(q.getWhere(), where); } else { return false; } } DefaultQueryMetadata(); DefaultQueryMetadata noValidate(); @Override void addFlag(QueryFlag flag); @Override void addJoinFlag(JoinFlag flag); @Override void addGroupBy(Expression<?> o); @Override void addHaving(Predicate e); @Override void addJoin(JoinType joinType, Expression<?> expr); @Override void addJoinCondition(Predicate o); @Override void addOrderBy(OrderSpecifier<?> o); @Override void setProjection(Expression<?> o); @Override void addWhere(Predicate e); @Override void clearOrderBy(); @Override void clearWhere(); @Override QueryMetadata clone(); @Override List<Expression<?>> getGroupBy(); @Override Predicate getHaving(); @Override List<JoinExpression> getJoins(); @Override QueryModifiers getModifiers(); @Override Map<ParamExpression<?>,Object> getParams(); @Override List<OrderSpecifier<?>> getOrderBy(); @Override Expression<?> getProjection(); @Override Predicate getWhere(); @Override boolean isDistinct(); @Override boolean isUnique(); @Override void reset(); @Override void setDistinct(boolean distinct); @Override void setLimit(Long limit); @Override void setModifiers(QueryModifiers restriction); @Override void setOffset(Long offset); @Override void setUnique(boolean unique); @Override void setParam(ParamExpression<T> param, T value); @Override Set<QueryFlag> getFlags(); @Override boolean hasFlag(QueryFlag flag); @Override void removeFlag(QueryFlag flag); @Override void setValidate(boolean v); void setValidatingVisitor(ValidatingVisitor visitor); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void equals() { metadata.addJoin(JoinType.DEFAULT, str); metadata.addGroupBy(str); metadata.addHaving(str.isNotNull()); metadata.addJoin(JoinType.DEFAULT, str2); QueryModifiers modifiers = new QueryModifiers(1L,2L); metadata.setModifiers(modifiers); metadata.addOrderBy(str.asc()); metadata.setProjection(str.append("abc")); metadata.addWhere(str.eq("b")); metadata.addWhere(str.isNotEmpty()); QueryMetadata metadata2 = new DefaultQueryMetadata(); assertFalse(metadata.equals(metadata2)); metadata2.addJoin(JoinType.DEFAULT, str); assertFalse(metadata.equals(metadata2)); metadata2.addGroupBy(str); assertFalse(metadata.equals(metadata2)); metadata2.addHaving(str.isNotNull()); assertFalse(metadata.equals(metadata2)); metadata2.addJoin(JoinType.DEFAULT, str2); assertFalse(metadata.equals(metadata2)); metadata2.setModifiers(modifiers); assertFalse(metadata.equals(metadata2)); metadata2.addOrderBy(str.asc()); assertFalse(metadata.equals(metadata2)); metadata2.setProjection(str.append("abc")); assertFalse(metadata.equals(metadata2)); metadata2.addWhere(str.eq("b")); metadata2.addWhere(str.isNotEmpty()); assertTrue(metadata.equals(metadata2)); }