diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java index ced11d247d..3dfddd1ce7 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/CleanupSystemPropertiesRule.java @@ -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 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 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("======================================================================================================");