1
2
3
4
5 package com.jcabi.xml;
6
7 import com.jcabi.matchers.XhtmlMatchers;
8 import java.util.Arrays;
9 import org.apache.commons.lang3.StringUtils;
10 import org.hamcrest.MatcherAssert;
11 import org.junit.jupiter.api.Test;
12
13
14
15
16
17
18 @SuppressWarnings("PMD.UnnecessaryLocalRule")
19 final class XSLChainTest {
20
21 @Test
22 void makesXslTransformations() {
23 final XSL first = new XSLDocument(
24 StringUtils.join(
25 "<xsl:stylesheet",
26 " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'",
27 " version='2.0'>",
28 "<xsl:template match='/'><done/>",
29 "</xsl:template></xsl:stylesheet>"
30 )
31 );
32 final XSL second = new XSLDocument(
33 StringUtils.join(
34 "<xsl:stylesheet ",
35 " xmlns:xsl='http://www.w3.org/1999/XSL/Transform' ",
36 " version='2.0' >",
37 "<xsl:template match='/done'><twice/>",
38 "</xsl:template> </xsl:stylesheet>"
39 )
40 );
41 MatcherAssert.assertThat(
42 "XPath result node does not match with expected, but it should",
43 new XSLChain(Arrays.asList(first, second)).transform(
44 new XMLDocument("<a/>")
45 ),
46 XhtmlMatchers.hasXPath("/twice")
47 );
48 }
49
50 }