use of com.google.cloud.conformance.bigtable.v2.TestDefinition.TestFile in project java-bigtable by googleapis.
the class ReadRowsMergingAcceptanceTest method data.
// Each tuple consists of [testData: ReadRowsTest, junitName: String]
@Parameters(name = "{1}")
public static Collection<Object[]> data() throws IOException {
ClassLoader cl = Thread.currentThread().getContextClassLoader();
InputStream dataJson = cl.getResourceAsStream(TEST_DATA_JSON_RESOURCE);
assertWithMessage("Unable to load test definition: %s", TEST_DATA_JSON_RESOURCE).that(dataJson).isNotNull();
InputStreamReader reader = new InputStreamReader(dataJson);
TestFile.Builder testBuilder = TestFile.newBuilder();
JsonFormat.parser().merge(reader, testBuilder);
TestFile testDefinition = testBuilder.build();
List<ReadRowsTest> tests = testDefinition.getReadRowsTestsList();
ArrayList<Object[]> data = new ArrayList<>(tests.size());
for (ReadRowsTest test : tests) {
String junitName = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, test.getDescription().replace(" ", "-"));
data.add(new Object[] { test, junitName });
}
return data;
}
Aggregations