0
我想通过TestNG数据提供程序给出文件名列表,因此测试可以加载每个文件。带有使用lambda的文件夹内容的TestNG数据提供程序
Object[][] result = Files.list(Paths.get("tst/resources/json"))
.filter(Files::isRegularFile)
.map(fileName -> new Object[] { fileName })
.toArray(Object[][]::new);
我得在那里我可以从文件夹中的内容建立对象[] []点,但TestNG的抛出异常:
org.testng.internal.reflect.MethodMatcherException:
Data provider mismatch
Method: testFBTinka11InterpretJson([Parameter{index=0,
type=java.lang.String, declaredAnnotations=[]}])
Arguments: [(sun.nio.fs.WindowsPath$WindowsPathWithAttributes)tst\resources\json\admin.json]
at org.testng.internal.reflect.DataProviderMethodMatcher.getConformingArguments(DataProviderMethodMatcher.java:52)
...
谢谢!它实际上是一个Path,但这是代码的问题。 (路径 - >新对象[] {path.toString()})'' –