0
我的属性文件看起来是这样的:Programmaticaly分配属性值到@参数
demo6312623.mockable.io/testingmoke = 200;aaaa
www.google.com = 200;bbbb
我需要遍历在文件中的所有属性和传递的参数是这样的:
Object[][] data = new Object[][] {
{ 200, "demo6312623.mockable.io/testing", "aaaa"},
{ 200, "www.google.com", "bbbb"}
}
我可以迭代通过属性文件是这样的:
for (Map.Entry<Object, Object> props : props.entrySet()) {
System.out.println((String)props.getKey() +" nnnnn "+ (String)props.getValue());
}
但我不知道如何通过这些参数TER值这个方法:
@Parameters
public static Collection <Object[]> addedNumbers() throws IOException {
props = new Properties();
FileInputStream fin = new FileInputStream("src/test/resources/application.properties");
props.load(fin);
for (Map.Entry < Object, Object > props: props.entrySet()) {
System.out.println((String) props.getKey() + " nnnnn " + (String) props.getValue());
}
// not sure how to assign the values to the 2 dimensional array by splitting from ";"
// Object[][] data = new Object[][]{
// { 200, "demo6312623.mockable.io/testing", "aaaa"},
// { 200, "www.google.com", "bbbb"}
// };
return Arrays.asList(data);
}