[
https://issues.apache.org/jira/browse/BEAM-3654?focusedWorklogId=136934&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-136934
]
ASF GitHub Bot logged work on BEAM-3654:
----------------------------------------
Author: ASF GitHub Bot
Created on: 22/Aug/18 12:48
Start Date: 22/Aug/18 12:48
Worklog Time Spent: 10m
Work Description: aromanenko-dev commented on a change in pull request
#6194: [BEAM-3654] Port FilterExamplesTest off DoFnTester
URL: https://github.com/apache/beam/pull/6194#discussion_r211930252
##########
File path:
examples/java/src/test/java/org/apache/beam/examples/cookbook/FilterExamplesTest.java
##########
@@ -54,31 +57,35 @@
.set("year", "2014")
.set("mean_temp", "45.3")
.set("tornado", true);
- static final TableRow[] ROWS_ARRAY = new TableRow[] {row1, row2, row3};
- static final List<TableRow> ROWS = Arrays.asList(ROWS_ARRAY);
private static final TableRow outRow1 =
new TableRow().set("year", 2014).set("month", 6).set("day",
21).set("mean_temp", 85.3);
private static final TableRow outRow2 =
new TableRow().set("year", 2014).set("month", 7).set("day",
20).set("mean_temp", 75.4);
private static final TableRow outRow3 =
new TableRow().set("year", 2014).set("month", 6).set("day",
18).set("mean_temp", 45.3);
- private static final TableRow[] PROJROWS_ARRAY = new TableRow[] {outRow1,
outRow2, outRow3};
+
+ @Rule public TestPipeline p = TestPipeline.create();
@Test
- public void testProjectionFn() throws Exception {
- DoFnTester<TableRow, TableRow> projectionFn = DoFnTester.of(new
ProjectionFn());
- List<TableRow> results = projectionFn.processBundle(ROWS_ARRAY);
- Assert.assertThat(results, CoreMatchers.hasItem(outRow1));
- Assert.assertThat(results, CoreMatchers.hasItem(outRow2));
- Assert.assertThat(results, CoreMatchers.hasItem(outRow3));
+ @Category(ValidatesRunner.class)
+ public void testProjectionFn1() {
+ PCollection<TableRow> input = p.apply(Create.of(row1, row2, row3));
+
+ PCollection<TableRow> results = input.apply(ParDo.of(new ProjectionFn()));
+
+ PAssert.that(results).containsInAnyOrder(outRow1, outRow2, outRow3);
+ p.run().waitUntilFinish();
}
@Test
- public void testFilterSingleMonthDataFn() throws Exception {
- DoFnTester<TableRow, TableRow> filterSingleMonthDataFn =
- DoFnTester.of(new FilterSingleMonthDataFn(7));
- List<TableRow> results =
filterSingleMonthDataFn.processBundle(PROJROWS_ARRAY);
- Assert.assertThat(results, CoreMatchers.hasItem(outRow2));
+ @Category(ValidatesRunner.class)
+ public void testFilterSingleMonthDataFn1() {
Review comment:
Any reason that the method name ends with "1"? I'd prefer to keep old name.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 136934)
Time Spent: 40m (was: 0.5h)
> Port FilterExamplesTest off DoFnTester
> --------------------------------------
>
> Key: BEAM-3654
> URL: https://issues.apache.org/jira/browse/BEAM-3654
> Project: Beam
> Issue Type: Sub-task
> Components: examples-java
> Reporter: Kenneth Knowles
> Assignee: Mikhail
> Priority: Major
> Labels: beginner, newbie, starter
> Time Spent: 40m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)