Search in sources :

Example 1 with ExtractTornadoesFn

use of org.apache.beam.examples.cookbook.BigQueryTornadoes.ExtractTornadoesFn in project beam by apache.

the class BigQueryTornadoesTest method testNoTornadoes.

@Test
public void testNoTornadoes() throws Exception {
    TableRow row = new TableRow().set("month", 6).set("tornado", false);
    DoFnTester<TableRow, Integer> extractWordsFn = DoFnTester.of(new ExtractTornadoesFn());
    Assert.assertTrue(extractWordsFn.processBundle(row).isEmpty());
}
Also used : ExtractTornadoesFn(org.apache.beam.examples.cookbook.BigQueryTornadoes.ExtractTornadoesFn) TableRow(com.google.api.services.bigquery.model.TableRow) Test(org.junit.Test)

Example 2 with ExtractTornadoesFn

use of org.apache.beam.examples.cookbook.BigQueryTornadoes.ExtractTornadoesFn in project beam by apache.

the class BigQueryTornadoesTest method testExtractTornadoes.

@Test
public void testExtractTornadoes() throws Exception {
    TableRow row = new TableRow().set("month", "6").set("tornado", true);
    DoFnTester<TableRow, Integer> extractWordsFn = DoFnTester.of(new ExtractTornadoesFn());
    Assert.assertThat(extractWordsFn.processBundle(row), CoreMatchers.hasItems(6));
}
Also used : ExtractTornadoesFn(org.apache.beam.examples.cookbook.BigQueryTornadoes.ExtractTornadoesFn) TableRow(com.google.api.services.bigquery.model.TableRow) Test(org.junit.Test)

Aggregations

TableRow (com.google.api.services.bigquery.model.TableRow)2 ExtractTornadoesFn (org.apache.beam.examples.cookbook.BigQueryTornadoes.ExtractTornadoesFn)2 Test (org.junit.Test)2