Skip to content

Commit

Permalink
polished
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 9, 2025
1 parent 7f80a95 commit 7563432
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/test/java/org/xembly/XemblerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,28 +286,31 @@ void checksYamlStories(final String story) {

@SuppressWarnings("unchecked")
private static XML outcomeOf(final String story) {
final Map<String, Object> yaml = new Yaml().load(
String.class.cast(story)
final Map<String, Object> yaml = new Yaml().load(story);
final Node before = new XMLDocument(
yaml.get("before").toString()
).inner();
return new XMLDocument(
new Xembler(
new Directives(
String.join(
"",
(Iterable<String>) yaml.get("directives")
)
)
).applyQuietly(before)
);
final Directives directives = new Directives();
for (final String dir : (Iterable<String>) yaml.get("directives")) {
directives.append(new Directives(dir));
}
final XML xml = new XMLDocument(yaml.get("before").toString());
new Xembler(directives).applyQuietly(xml.inner());
return xml;
}

@SuppressWarnings("unchecked")
private static Matcher<XML> matchersOf(final String story) {
final Map<String, Object> yaml = new Yaml().load(
String.class.cast(story)
);
return new AllOf<>(
new ListOf<>(
new Mapped<>(
str -> new XPathMatcher<>(str, new XPathContext()),
(Collection<String>) yaml.get("xpaths")
(Collection<String>) new Yaml()
.<Map<String, Object>>load(story)
.get("xpaths")
)
)
);
Expand Down

0 comments on commit 7563432

Please sign in to comment.