/**
* Loads a list of tests based on the json-encoded test vector files.
*/
@Parameters(name = "Test Vector {index}: {0}")
public static Collection<TestVector> testVectorData() throws Exception {
final URI baseUri =
ValidVectorTest.class.getResource(ValidVectorTest.class.getSimpleName() + ".class").toURI();
final File baseDirectoryFile = new File(baseUri).getParentFile();
final File validTestVectorDir = new File(baseDirectoryFile, "/vectors/valid");
final Builder<TestVector> vectors = ImmutableList.builder();
final ObjectMapper mapper = new ObjectMapper();
Arrays.stream(validTestVectorDir.listFiles()).forEach(file -> {
try {
if (file.getName().endsWith(".json")) {
TestVector vector = mapper.readValue(file, TestVector.class);
vector.setName(file.getName().substring(0, file.getName().length() - 5));
vectors.add(vector);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
});
return vectors.build();
}
ValidVectorTest.java 文件源码
java
阅读 34
收藏 0
点赞 0
评论 0
项目:quilt
作者:
评论列表
文章目录