org.testng.xml.XmlUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of testng Show documentation
Show all versions of testng Show documentation
Testing framework for Java
package org.testng.xml;
import org.testng.reporters.XMLStringBuffer;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
public class XmlUtils {
/**
* Don't add this property if it's equal to its default value.
*/
public static void setProperty(Properties p, String name, String value, String def) {
if (! def.equals(value) && value != null) {
p.setProperty(name, value);
}
}
public static void dumpParameters(XMLStringBuffer xsb, Map parameters) {
// parameters
if (!parameters.isEmpty()) {
for(Map.Entry para: parameters.entrySet()) {
Properties paramProps= new Properties();
paramProps.setProperty("name", para.getKey());
paramProps.setProperty("value", para.getValue());
xsb.addEmptyElement("parameter", paramProps); // BUGFIX: TESTNG-27
}
}
}
}