Search in sources :

Example 1 with TestFile

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;
}
Also used : ReadRowsTest(com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest) InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) TestFile(com.google.cloud.conformance.bigtable.v2.TestDefinition.TestFile) ArrayList(java.util.ArrayList) Parameters(org.junit.runners.Parameterized.Parameters)

Aggregations

ReadRowsTest (com.google.cloud.conformance.bigtable.v2.TestDefinition.ReadRowsTest)1 TestFile (com.google.cloud.conformance.bigtable.v2.TestDefinition.TestFile)1 InputStream (java.io.InputStream)1 InputStreamReader (java.io.InputStreamReader)1 ArrayList (java.util.ArrayList)1 Parameters (org.junit.runners.Parameterized.Parameters)1