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()})'' –