|
45 | 45 | import org.hamcrest.MatcherAssert; |
46 | 46 | import org.hamcrest.Matchers; |
47 | 47 | import org.hamcrest.core.IsEqual; |
48 | | -import org.junit.jupiter.api.Assertions; |
| 48 | +import org.junit.jupiter.api.Disabled; |
49 | 49 | import org.junit.jupiter.api.Test; |
50 | 50 | import org.w3c.dom.Document; |
51 | 51 | import org.w3c.dom.Element; |
|
56 | 56 | * |
57 | 57 | * @since 0.1 |
58 | 58 | * @checkstyle AbbreviationAsWordInNameCheck (5 lines) |
| 59 | + * @todo #221:30min Implement XPath 2.0 evaluations. |
| 60 | + * We have to implement XPath 2.0 evaluations in order to support more complex XPath queries. |
| 61 | + * For example, the following query is not supported: |
| 62 | + * //o[@base and @ver]/concat(@base,'|',@ver) |
| 63 | + * When we implement XPath 2.0 evaluations, we should remove the @Disabled annotation from |
| 64 | + * findsXpathWithFunctionThatReturnsSeveralItems test. |
59 | 65 | */ |
60 | 66 | @SuppressWarnings({"PMD.TooManyMethods", "PMD.DoNotUseThreads"}) |
61 | 67 | final class XMLDocumentTest { |
@@ -410,19 +416,14 @@ void appliesXpathToClonedNode() { |
410 | 416 | } |
411 | 417 |
|
412 | 418 | @Test |
| 419 | + @Disabled |
413 | 420 | void findsXpathWithFunctionThatReturnsSeveralItems() { |
414 | | - final IllegalArgumentException exception = Assertions.assertThrows( |
415 | | - IllegalArgumentException.class, |
416 | | - () -> |
417 | | - new XMLDocument( |
418 | | - "<o><o base='a' ver='1'/><o base='b' ver='2'/></o>" |
419 | | - ).xpath("//o[@base and @ver]/concat(@base,'|',@ver)"), |
420 | | - "XMLDocument throws exception if we are trying to use XPath 2.0 functionality. The current implementation supports only XPath 1.0." |
421 | | - ); |
422 | 421 | MatcherAssert.assertThat( |
423 | | - "Message should emphasize that XPath 2.0 features are not supported", |
424 | | - exception.getCause().getMessage(), |
425 | | - Matchers.equalTo("javax.xml.transform.TransformerException: Unknown nodetype: concat") |
| 422 | + "XMLDocument can handle XPath 2.0 feature - XPath evaluation of concat method, but it can't", |
| 423 | + new XMLDocument( |
| 424 | + "<o><o base='a' ver='1'/><o base='b' ver='2'/></o>" |
| 425 | + ).xpath("//o[@base and @ver]/concat(@base,'|',@ver)"), |
| 426 | + Matchers.hasItems("a|1", "b|2") |
426 | 427 | ); |
427 | 428 | } |
428 | 429 | } |
0 commit comments