8299520: TestPrintXML.java output error messages in case compare fails

Reviewed-by: mgronlun
This commit is contained in:
Matthias Baesken 2023-01-03 15:26:10 +00:00
parent 92dfc735f2
commit ea25a561c5

View File

@ -132,6 +132,8 @@ public class TestPrintXML {
Map<String, Object> xmlMap = (Map<String, Object>) xmlObject;
List<ValueDescriptor> fields = re.getFields();
if (fields.size() != xmlMap.size()) {
System.err.println("Size of fields of recorded object (" + fields.size() +
") and reference (" + xmlMap.size() + ") differ");
return false;
}
for (ValueDescriptor v : fields) {
@ -154,6 +156,7 @@ public class TestPrintXML {
expectedValue = Long.toUnsignedString(re.getLong(name));
}
if (!compare(expectedValue, xmlValue)) {
System.err.println("Expcted value " + expectedValue + " differs from " + xmlValue);
return false;
}
}
@ -163,10 +166,14 @@ public class TestPrintXML {
Object[] array = (Object[]) eventObject;
Object[] xmlArray = (Object[]) xmlObject;
if (array.length != xmlArray.length) {
System.err.println("Array length " + array.length + " differs from length " +
xmlArray.length);
return false;
}
for (int i = 0; i < array.length; i++) {
if (!compare(array[i], xmlArray[i])) {
System.err.println("Array element " + i + "(" + array[i] +
") differs from element " + xmlArray[i]);
return false;
}
}
@ -174,7 +181,11 @@ public class TestPrintXML {
}
String s1 = String.valueOf(eventObject);
String s2 = (String) xmlObject;
return s1.equals(s2);
boolean res = s1.equals(s2);
if (! res) {
System.err.println("Event object string " + s1 + " differs from " + s2);
}
return res;
}
static class XMLEvent {