Skip to content

Commit e2d6f42

Browse files
feat(#211): Add puzzle
1 parent 1ae3100 commit e2d6f42

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

src/test/java/com/jcabi/xml/XMLDocumentTest.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
import org.hamcrest.MatcherAssert;
4646
import org.hamcrest.Matchers;
4747
import org.hamcrest.core.IsEqual;
48-
import org.junit.jupiter.api.Assertions;
48+
import org.junit.jupiter.api.Disabled;
4949
import org.junit.jupiter.api.Test;
5050
import org.w3c.dom.Document;
5151
import org.w3c.dom.Element;
@@ -56,6 +56,12 @@
5656
*
5757
* @since 0.1
5858
* @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.
5965
*/
6066
@SuppressWarnings({"PMD.TooManyMethods", "PMD.DoNotUseThreads"})
6167
final class XMLDocumentTest {
@@ -410,19 +416,14 @@ void appliesXpathToClonedNode() {
410416
}
411417

412418
@Test
419+
@Disabled
413420
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-
);
422421
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")
426427
);
427428
}
428429
}

0 commit comments

Comments
 (0)