use of org.apache.sling.repoinit.parser.operations.OperationVisitor in project sling by apache.
the class ParserTest method checkResult.
@Test
public void checkResult() throws ParseException, IOException {
final String expected = IOUtils.toString(tc.expected, DEFAULT_ENCODING).trim();
try {
final StringWriter sw = new StringWriter();
final OperationVisitor v = new OperationToStringVisitor(new PrintWriter(sw));
final List<Operation> result = new RepoInitParserImpl(tc.input).parse();
for (Operation o : result) {
o.accept(v);
}
sw.flush();
String actual = sw.toString().trim();
// normalize line endings to ensure tests run on windows as well
actual = actual.replaceAll("\r\n", "\n");
assertEquals(expected, actual);
} finally {
tc.close();
}
}
Aggregations