Java 将字符串数组作为参数传递给JUnit测试

Java 将字符串数组作为参数传递给JUnit测试,java,arrays,junit,junit4,parameterized,Java,Arrays,Junit,Junit4,Parameterized,我在编写JUNIT测试时使用@Parameter进行字段注入。是否可以将字符串数组传递给数据对象[][]。我的意思是在下面的代码中 我可以像这样传递字符串数组吗 {"Input1","Input2", {"file1","file2"}} 代码片段 @RunWith(Parameterized.class) public class AModuleTest { @Parameters public static Iterable<Object[]> testData() {

我在编写JUNIT测试时使用@Parameter进行字段注入。是否可以将字符串数组传递给数据对象[][]。我的意思是在下面的代码中 我可以像这样传递字符串数组吗

{"Input1","Input2",  {"file1","file2"}}
代码片段

@RunWith(Parameterized.class)
public class AModuleTest {

@Parameters
public static Iterable<Object[]> testData() {

    Object[][] data = new Object[][]{
        {"Input1","Input2",  }
    };
    return Arrays.asList(data);

}

@Parameter(value=0) public String tabName;
@Parameter(value=1) public String fileSetName;
@Parameter(value=2) public String[] fileNames

@Test
public void ATest(){
//here I'm just passing those parameters to these functions clickTab, Navigate()...
    clickTab(tabName); 
    Navigate(fileSet);

  }
}
@RunWith(参数化的.class)
公共类AModuleTest{
@参数
公共静态Iterable testData(){
对象[][]数据=新对象[][]{
{“Input1”、“Input2”,}
};
返回数组.asList(数据);
}
@参数(值=0)公共字符串tabName;
@参数(值=1)公共字符串fileSetName;
@参数(值=2)公共字符串[]文件名
@试验
公共无效测试(){
//这里我只是将这些参数传递给这些函数clickTab,Navigate()。。。
单击选项卡(选项卡名称);
导航(文件集);
}
}

所以我想我们可以在数组中创建一个数组;通过在数据对象内创建字符串数组,如

 Object[][] data = new Object[][]{
    {"Input1","Input2", new String[] {"file1", "file2"} }
};