XMLUnit 2.3并忽略某些标记

时间:2016-11-25 15:43:16

标签: java xml groovy xmlunit-2

我在soapUi(Groovy)中比较两个xml,我想忽略一些标签(不只是一个)

我在下面尝试了这个解决方案,但没有工作:

def ExpectedString = 'Expected Xml'
def ResponseString ='XML SoapResponse to compare'

Diff diff = DiffBuilder.compare(ExpectedString)
           .withTest(ResponseString)
           .ignoreComments()
           .ignoreWhitespace()
           .checkForSimilar()
           .withNodeFilter{node -> !node.getNodeName().equals('somerandomstuff')}
           .withNodeMatcher(new DefaultNodeMatcher(new ByNameAndTextRecSelector(),
ElementSelectors.byNameAndText))
           .build()

我的代码出了什么问题? 我收到这个错误:

No signature of method: org.xmlunit.builder.DiffBuilder.withNodeFilter() 
is applicable for argument types: (Script4$_run_closure2) values: 
[Script4$_run_closure2@2ea2e326] Possible solutions: 
withNodeFilter(org.xmlunit.util.Predicate)

谢谢!

0 个答案:

没有答案