com.google.cloud.dataflow.sdk.testing

## Class TestStream.Builder<T>

- java.lang.Object
- - com.google.cloud.dataflow.sdk.testing.TestStream.Builder<T>

Enclosing class:
  TestStream<T>

    public static class TestStream.Builder<T>
    extends Object

An incomplete `TestStream`. Elements added to this builder will be produced in sequence when the pipeline created by the `TestStream` is run.

### Method Summary

All Methods Instance Methods Concrete Methods
`TestStream.Builder<T>` `addElements(TimestampedValue<T> first, TimestampedValue<T>... rest)` Adds the specified elements to the source with the provided timestamps.
`TestStream.Builder<T>` `addElements(T first, T... rest)` Adds the specified elements to the source with timestamp equal to the current watermark.
`TestStream.Builder<T>` `advanceProcessingTime(Duration amount)` Advance the processing time by the specified amount.
`TestStream.Builder<T>` `advanceWatermarkTo(Instant newWatermark)` Advance the watermark of this source to the specified instant.
`TestStream<T>` `advanceWatermarkToInfinity()` Advance the watermark to infinity, completing this `TestStream`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### addElements

    @SafeVarargs
    public final TestStream.Builder<T> addElements(T first,
                                                                T... rest)

Adds the specified elements to the source with timestamp equal to the current watermark.

Returns:
  A `TestStream.Builder` like this one that will emit the provided elements after all earlier events have completed.

#### addElements

    @SafeVarargs
    public final TestStream.Builder<T> addElements(TimestampedValue<T> first,
                                                                TimestampedValue<T>... rest)

Adds the specified elements to the source with the provided timestamps.

Returns:
  A `TestStream.Builder` like this one that will emit the provided elements after all earlier events have completed.

#### advanceWatermarkTo

    public TestStream.Builder<T> advanceWatermarkTo(Instant newWatermark)

Advance the watermark of this source to the specified instant.

The watermark must advance monotonically and cannot advance to `BoundedWindow.TIMESTAMP_MAX_VALUE` or beyond.

Returns:
  A `TestStream.Builder` like this one that will advance the watermark to the specified point after all earlier events have completed.

#### advanceProcessingTime

    public TestStream.Builder<T> advanceProcessingTime(Duration amount)

Advance the processing time by the specified amount.

Returns:
  A `TestStream.Builder` like this one that will advance the processing time by the specified amount after all earlier events have completed.

#### advanceWatermarkToInfinity

    public TestStream<T> advanceWatermarkToInfinity()

Advance the watermark to infinity, completing this `TestStream`. Future calls to the same builder will not affect the returned `TestStream`.