From: SourceForge.net <no...@so...> - 2009-11-19 14:55:13
|
Feature Requests item #2900491, was opened at 2009-11-19 14:55 Message generated for change (Tracker Item Submitted) made by jan_materne You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=2900491&group_id=23187 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: XMLUnit for Java Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jan Matèrne (jan_materne) Assigned to: Nobody/Anonymous (nobody) Summary: Provide assert method for making "strictless" chess Initial Comment: For using the assertXPathEvaluatesTo() method the expected string must match the actual completely. If you just want to check if the evaluation contains a substring this is not possible at the moment. Suggestion: protected void assertXPathEvaluationContains(String expected, String xpath, Document document) throws XPathExpressionException { XPathExpression xpathExpression = XPathFactory.newInstance().newXPath().compile(xpath); String evaluate = xpathExpression.evaluate(document); if (expected == null) { assertNull(evaluate); } else { assertNotNull(evaluate); assertTrue(evaluate.contains(expected)); } } (maybe another implementation - I dont know the internals of XMLUnit) cheers Jan ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=377771&aid=2900491&group_id=23187 |