Keith Berkoben created BEAM-2493:
------------------------------------
Summary: TestStream.Builder.addElements() should return the same
builder
Key: BEAM-2493
URL: https://issues.apache.org/jira/browse/BEAM-2493
Project: Beam
Issue Type: Bug
Components: sdk-java-core
Affects Versions: 2.0.0
Reporter: Keith Berkoben
Assignee: Davor Bonaci
When writing tests for pipelines, it is commonly the case where a TestStream
must be built in steps ex:
TestStream.Builder<Object> tsb =
TestStream.create(<coder>).advanceWatermarkTo(new Instant(0);
if(<a thing is true>){
tsb.addElements(<element>);
}
TestStream<Object> stream = tsb.advanceWatermarkToInfinity();
The above code does not work, however, because addElements() is creating a NEW
builder rather than augmenting the existing one. This is a-typical for a
builder pattern and requires the user to do
tsb = tsb.addElements()
which is more verbose and counterintuitive if one is expecting a builder.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)