Skip to content

Commit

Permalink
[ARCHETYPE-680] Use ERROR loglevel in integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Oct 9, 2024
1 parent edd826b commit a7b91d8
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ private void assertDirectoryEquals(File reference, File actual) throws Integrati
+ ", unexpected: " + actualFiles.size() + ")");
}

if (!ignoreEOLStyle) {
getLog().warn("Property ignoreEOLStyle was not set - files will be compared considering their EOL style!");
}

boolean contentEquals = true;

for (String file : referenceFiles) {
Expand All @@ -362,16 +366,16 @@ private void assertDirectoryEquals(File reference, File actual) throws Integrati

if (referenceFile.isDirectory()) {
if (actualFile.isFile()) {
getLog().warn("File " + file + " is a directory in the reference but a file in actual");
getLog().error("File " + file + " is a directory in the reference but a file in actual");
contentEquals = false;
}
} else if (actualFile.isDirectory()) {
if (referenceFile.isFile()) {
getLog().warn("File " + file + " is a file in the reference but a directory in actual");
getLog().error("File " + file + " is a file in the reference but a directory in actual");
contentEquals = false;
}
} else if (!contentEquals(referenceFile, actualFile)) {
getLog().warn("Contents of file " + file + " are not equal");
getLog().error("Contents of file " + file + " are not equal");
contentEquals = false;
}
}
Expand All @@ -387,7 +391,6 @@ private void assertDirectoryEquals(File reference, File actual) throws Integrati
private boolean contentEquals(File referenceFile, File actualFile) throws IOException {
// Original behaviour
if (!ignoreEOLStyle) {
getLog().warn("Property ignoreEOLStyle was not set - files will be compared considering their EOL style!");
return FileUtils.contentEquals(referenceFile, actualFile);
}

Expand All @@ -402,10 +405,10 @@ private boolean contentEquals(File referenceFile, File actualFile) throws IOExce
refLine = referenceFileReader.readLine();
actualLine = actualFileReader.readLine();
if (!Objects.equals(refLine, actualLine)) {
getLog().warn("Conflict found. Reference line :");
getLog().warn(refLine);
getLog().warn("Actual line :");
getLog().warn(actualLine);
getLog().error("Conflict found. Reference line :");
getLog().error(refLine);
getLog().error("Actual line :");
getLog().error(actualLine);
return false;
}
} while (refLine != null || actualLine != null);
Expand Down

0 comments on commit a7b91d8

Please sign in to comment.