与How to compare recursively ignoring given fields using assertJ?相关
作为一个解决问题的方法,我试图为该字段设置比较器,我不希望比较器进行比较并使其返回0。
assertThat(service.postComment(12,234,comment)).usingComparatorForFields((a,b)->0,"startDate").isEqualToComparingFieldByFieldRecursively(commentReturned);
但是,我仍然得到这个例外。
Path to difference: <startDate>
- expected: <null>
- actual : <2017-04-12 18:28:06.766>
作为旁注 - 我不想比较startDate,因为它使用传统的java.util.Date
检索当前日期,而usingComparatorForFields
也比较毫秒。
怎么样isEqualToComparingFieldByField
工作。我甚至尝试使用isEqualToComparingFieldByFieldRecursively
而不是assertj-core并且错误仍然存在(在相同的情况下。对于需要递归比较的情况,这个失败了。)
这看起来像我看到的bug,你使用的是什么版本的AssertJ?
您可以在qazxswpoi中创建一个问题,并使用简单的测试用例重现错误吗?