|
11 | 11 | import com.jcabi.xml.XPathContext; |
12 | 12 | import java.util.Collection; |
13 | 13 | import java.util.Map; |
| 14 | +import java.util.stream.Stream; |
14 | 15 | import javax.xml.parsers.DocumentBuilderFactory; |
15 | 16 | import net.jqwik.api.ForAll; |
16 | 17 | import net.jqwik.api.Property; |
|
25 | 26 | import org.hamcrest.MatcherAssert; |
26 | 27 | import org.hamcrest.Matchers; |
27 | 28 | import org.hamcrest.core.AllOf; |
| 29 | +import org.junit.jupiter.api.DynamicTest; |
28 | 30 | import org.junit.jupiter.api.Test; |
| 31 | +import org.junit.jupiter.api.TestFactory; |
29 | 32 | import org.junit.jupiter.params.ParameterizedTest; |
30 | 33 | import org.w3c.dom.Document; |
31 | 34 | import org.w3c.dom.Node; |
|
39 | 42 | @SuppressWarnings("PMD.TooManyMethods") |
40 | 43 | final class XemblerTest { |
41 | 44 |
|
| 45 | + @TestFactory |
| 46 | + Stream<DynamicTest> parsesDifferentScripts() { |
| 47 | + final String[] scripts = { |
| 48 | + "ADD 'a'; ADD 'b'; ADD 'c'; SET 'привет';", |
| 49 | + "ADD \"a\"; ADD \"b\"; ADD \"c\"; SET \"привет\";", |
| 50 | + "ADD 'x'; ATTR 'y', 'z'; PI 'foo', 'bar';", |
| 51 | + }; |
| 52 | + return Stream.of(scripts).map( |
| 53 | + script -> DynamicTest.dynamicTest( |
| 54 | + script, |
| 55 | + () -> { |
| 56 | + final Document dom = DocumentBuilderFactory.newInstance() |
| 57 | + .newDocumentBuilder().newDocument(); |
| 58 | + new Xembler( |
| 59 | + new Directives(script) |
| 60 | + ).apply(dom); |
| 61 | + } |
| 62 | + ) |
| 63 | + ); |
| 64 | + } |
| 65 | + |
42 | 66 | @Test |
43 | 67 | void printsNicely() throws Exception { |
44 | 68 | final Document dom = DocumentBuilderFactory.newInstance() |
|
0 commit comments