NO-JIRA improve logging for test System prop cleanup

This commit is contained in:
Justin Bertram 2018-11-15 13:03:40 -06:00 committed by Clebert Suconic
parent acb8ff5a2e
commit 3e5a2f4951
1 changed files with 16 additions and 6 deletions

View File

@ -68,14 +68,24 @@ public class CleanupSystemPropertiesRule extends ExternalResource {
System.out.println("======================================================================================================");
for (Object key : newProperties) {
System.out.println("Cleaning up system property " + key);
System.clearProperty(key.toString());
if (!newProperties.isEmpty()) {
System.out.println("Clearing system property...");
int i = 1;
for (Object key : newProperties) {
System.out.printf("\t%3d. %s = %s%n", i++, key, System.getProperty(key.toString()));
System.clearProperty(key.toString());
}
}
for (Map.Entry<Object, Object> entry : changed.entrySet()) {
System.out.println("Setting up old system property, key=" + entry.getKey() + ", value = " + entry.getValue());
System.setProperty(entry.getKey().toString(), entry.getValue().toString());
if (!changed.isEmpty()) {
System.out.println("Resetting system property...");
int i = 1;
for (Map.Entry<Object, Object> entry : changed.entrySet()) {
System.out.printf("\t%3d. %s = %s (was %s)%n", i++, entry.getKey(), entry.getValue(), System.getProperty(entry.getKey().toString()));
System.setProperty(entry.getKey().toString(), entry.getValue().toString());
}
}
System.out.println("======================================================================================================");