我在这里做错了什么?
@Override
public int hashCode()
{
HashCodeBuilder hashCodeBuilder = new HashCodeBuilder();
hashCodeBuilder.append(this.getId()).append(this.getDocFamilyUuid())
.append(this.getCorrelationId());
return hashCodeBuilder.hashCode();
}
这就是我在 groovy 中创建对象的方式。这些字段被设置为静态常量
DocInfo docInfo = new DocInfo(id:DOC_ID, correlationId: CORRELATION_ID, docFamilyUuid: DOC_FAMILY_UUID)
我试图断言
assert docInfo.hashCode() ==
new DocInfo([id:DOC_ID,
correlationId: CORRELATION_ID,
docFamilyUuid:DOC_FAMILY_UUID]).hashCode()