数字格式异常
是由
帕森特
整数
上课。这明确表明,为键“Control_Wait”返回“String”值的方法getProperties返回的是null,这可能有“n”个原因。
属性文件中不存在项。
属性文件中不存在项的值。
获取键值的getProperties()逻辑错误。
属性文件未正确初始化或加载
public class PropertyTest {
public static Properties properties = new Properties();
private static void loadProperties() {
FileInputStream fis;
try {
fis = new FileInputStream("src/test/resources/property/android.properties");
properties.load(fis);
fis.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
public static String getProperty(String key) {
String value = "";
if (key != "") {
loadProperties();
try {
if (!properties.getProperty(key).trim().isEmpty())
value = properties.getProperty(key).trim();
}
catch (NullPointerException e) {
}
}
return value;
}
}
用法
driverWait(Integer.parseInt(getProperty("Control_Wait")));