
com.github.endoscope.util.PropertyTestUtil Maven / Gradle / Ivy
package com.github.endoscope.util;
public class PropertyTestUtil {
public static void withProperty(String name, String value, Runnable runnable) {
String previousValue = System.getProperty(name);
System.setProperty(name, value);
try{
runnable.run();
}finally{
if( previousValue == null ){
System.clearProperty(name);
} else {
System.setProperty(name, previousValue);
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy