我已经成功地使用JSONAssert来比较以下两个json响应:
JSONAssert.assertEquals(response2.getResponseBodyContent(), response1.getResponseBodyContent(), JSONCompareMode.LENIENT)我现在需要忽略如下所述的某些属性:
Ignore specific nodes/attributes while comparing two JSONs我的新声明是:
JSONAssert.assertEquals(response2, getResponseBodyContent(), new CustomComparator(JSONCompareMode.LENIENT, new Customization("EffectiveEpochDate", (o1, o2) -> true)));我得到了以下错误:
java.lang.Error: Unresolved compilation problems:
Groovy:expecting ')', found ',' @ line 51, column 154.
Groovy:expecting ')', found '->' @ line 51, column 160.
Groovy:expecting ')', found '->' @ line 51, column 160.
Groovy:expecting '}', found '->' @ line 51, column 160.
Groovy:expecting '}', found '->' @ line 51, column 160.我正在使用一个名为Katalon的测试工具,它支持java/groovy。如有任何意见,将不胜感激。谢谢
发布于 2019-11-15 19:27:39
您所引用的代码使用Java语法(在Groovy2.5之前肯定不支持这种语法)。你必须通过关闭而不是。例如转弯
(o1, o2) -> true转入:
{a, b -> true}https://stackoverflow.com/questions/58882691
复制相似问题