Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ protected void verify(String testCaseName) throws Exception {
final String inputPath = testCaseName.toLowerCase() + "/" + inputFileName;
final String outputPath = testCaseName.toLowerCase() + "/" + outputFileName;

verifyOutputFile(outputPath);

final Configuration config = getCheckConfigurations(inputPath);
final List<CheckstyleViolation> violations = runCheckstyle(inputPath, config);

Expand Down Expand Up @@ -95,6 +97,28 @@ private List<CheckstyleViolation> runCheckstyle(String inputPath,
}
}

private void verifyOutputFile(String outputPath) throws Exception {

final Configuration config = getCheckConfigurations(outputPath);
final List<CheckstyleViolation> violations = runCheckstyle(outputPath, config);
if (!violations.isEmpty()) {
final StringBuilder violationMessage =
new StringBuilder("Checkstyle violations found in the output file:\n");

violationMessage.append("outputFile: ").append(getPath(outputPath)).append("\n");

for (CheckstyleViolation violation : violations) {
violationMessage
.append("line: ").append(violation.getLine())
.append(", col: ").append(violation.getColumn())
.append(", message: ").append(violation.getMessage())
.append("\n");
}

throw new IllegalStateException(violationMessage.toString());
}
}

private Configuration getCheckConfigurations(String inputPath) throws Exception {
final String configFilePath = getPath(inputPath);
final TestInputConfiguration testInputConfiguration =
Expand Down
Loading