import java.nio.file.Path
import java.util.concurrent.TimeUnit
import java.util.regex.Pattern
def referenceFile = rc.lookup("referenceFile")
def actualFile = rc.lookup("generatedFile")
def reference = new File(referenceFile).text
def actual = new File(actualFile).text
def isADELrapFormat = reference.contains("<ADELrap")
if(isADELrapFormat) {
reference = fixFieldsToBeIgnoredInComparison(reference)
actual = fixFieldsToBeIgnoredInComparison(actual)
}
rc.setLocal("areIdentical", rc.checkEqual(reference, actual, "Mesaj", level:2, report:true, nowrap:false))
private static String fixFieldsToBeIgnoredInComparison(final String xml) {
final Pattern last_modified_time = Pattern.compile("<LAST_MODIFIED_TIME>.*</LAST_MODIFIED_TIME>");
return last_modified_time.matcher(xml).replaceFirst("<LAST_MODIFIED_TIME>XXXX</LAST_MODIFIED_TIME>")
}
Niciun comentariu:
Trimiteți un comentariu