anchela commented on a change in pull request #16:
URL:
https://github.com/apache/sling-org-apache-sling-repoinit-parser/pull/16#discussion_r789437145
##########
File path:
src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java
##########
@@ -59,6 +62,21 @@ private static Reader rebuildInputScript(Reader input)
throws Exception {
@Test
public void checkResultAsRepoInit() throws Exception {
- ParserTestCase.validate(rebuildInputScript(tc.input), tc.expected, tc);
+ try(ParserTestCase tc = testCaseSupplier.get()){
Review comment:
@klcodanr , minor nitpicking: there are 2 whitespaces missing. should be
`try (ParserTestCase tc = testCaseSupplier.get()) {`
instead of
`try(ParserTestCase tc = testCaseSupplier.get()){`
##########
File path:
src/test/java/org/apache/sling/repoinit/parser/operations/AsRepoInitTest.java
##########
@@ -59,6 +62,21 @@ private static Reader rebuildInputScript(Reader input)
throws Exception {
@Test
public void checkResultAsRepoInit() throws Exception {
- ParserTestCase.validate(rebuildInputScript(tc.input), tc.expected, tc);
+ try(ParserTestCase tc = testCaseSupplier.get()){
+ ParserTestCase.validate(rebuildInputScript(tc.input), tc.expected,
tc);
+ }
+ }
+
+ @Test
+ public void checkRepoInitStatementNewline() throws Exception {
+ try (ParserTestCase tc = testCaseSupplier.get()) {
+ for (Operation o : new RepoInitParserService().parse(tc.input)) {
+ String repoinitStatement = o.asRepoInitString();
+ assertTrue(
Review comment:
same here. please add a whitespace before the (
##########
File path:
src/test/java/org/apache/sling/repoinit/parser/test/ParserTestCase.java
##########
@@ -118,4 +123,27 @@ public static void validate(Reader validateInput,
InputStream validateExpected,
}
return result;
}
+
+ public static Collection<Object[]> buildTestDataSuppliers() throws
IOException {
+ final List<Object[]> result = new ArrayList<>();
+ for (int i = 0; i <= MAX_TEST_INDEX; i++) {
+ final int currentIdx = i;
+ Supplier<ParserTestCase> supplier = () -> {
+ try {
+ return ParserTestCase.build(currentIdx);
+ } catch (IOException e) {
+ return null;
+ }
+ };
+ try (ParserTestCase tc = supplier.get()) {
+ if(tc != null){
Review comment:
same here..... should be
`if (tc != null) {`
instead of
`if(tc != null){`
having consistent formatting helps the readability of the code and prevents
broken window syndrom that happen when code looks bad.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]