@@ -0,0 +1,1898 @@
+package net.dempsy.utils.test;%0A%0Aimport java.io.FileInputStream;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Properties;%0Aimport java.util.stream.IntStream;%0A%0A/**%0A * This class allows the setting and then unsetting of System properties within the scope of a test.%0A */%0Apublic class SystemPropertyManager implements AutoCloseable %7B%0A    private static class OldProperty %7B%0A        public final boolean hasOldValue;%0A        public final String oldValue;%0A        public final String name;%0A%0A        public OldProperty(final String name, final boolean hasOldValue, final String oldValue) %7B%0A            this.hasOldValue = hasOldValue;%0A            this.oldValue = oldValue;%0A            this.name = name;%0A        %7D%0A    %7D%0A%0A    private final List%3COldProperty%3E oldProperties = new ArrayList%3C%3E();%0A%0A    public SystemPropertyManager set(final String name, final String value) %7B%0A        oldProperties.add(new OldProperty(name, System.getProperties().containsKey(name), System.getProperty(name)));%0A        System.setProperty(name, value);%0A        return this;%0A    %7D%0A%0A    public SystemPropertyManager load(final String file) %7B%0A        final Properties props = new Properties();%0A        try (FileInputStream fis = new FileInputStream(file)) %7B%0A            props.load(fis);%0A            props.entrySet().stream().forEach(e -%3E set((String) e.getKey(), (String) e.getValue()));%0A            return this;%0A        %7D catch (final IOException ioe) %7B%0A            throw new RuntimeException(ioe);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void close() %7B%0A        final int num = oldProperties.size();%0A        IntStream.range(0, num).forEach(i -%3E revert(oldProperties.get(num - i - 1)));%0A    %7D%0A%0A    private static void revert(final OldProperty op) %7B%0A        if (op.hasOldValue)%0A            System.setProperty(op.name, op.oldValue);%0A        else System.clearProperty(op.name);%0A    %7D%0A%7D%0A

Add helper for managing System properties in tests.