My property files looks like this:
demo6312623.mockable.io/testingmoke = 200;aaaa
www.google.com = 200;bbbb
I need to iterate all the properties in the files and pass the parameters like this:
Object[][] data = new Object[][] {
{ 200, "demo6312623.mockable.io/testing", "aaaa"},
{ 200, "www.google.com", "bbbb"}
}
I can iterate trough the property file like this:
for (Map.Entry<Object, Object> props : props.entrySet()) {
System.out.println((String)props.getKey() +" nnnnn "+ (String)props.getValue());
}
But I'm not sure how to pass these parameters to this method:
@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);
}