com.google.cloud.dataflow.sdk.testing

## Class DataflowAssert

- java.lang.Object
- - com.google.cloud.dataflow.sdk.testing.DataflowAssert

    public class DataflowAssert
    extends Object

An assertion on the contents of a `PCollection` incorporated into the pipeline. Such an assertion can be checked no matter what kind of `PipelineRunner` is used.

Note that the `DataflowAssert` call must precede the call to `Pipeline.run()`.

Examples of use:

     Pipeline p = TestPipeline.create();
     ...
     PCollection<String> output =
          input
          .apply(ParDo.of(new TestDoFn()));
     DataflowAssert.that(output)
         .containsInAnyOrder("out1", "out2", "out3");
     ...
     PCollection<Integer> ints = ...
     PCollection<Integer> sum =
         ints
         .apply(Combine.globally(new SumInts()));
     DataflowAssert.that(sum)
         .is(42);
     ...
     p.run();

JUnit and Hamcrest must be linked in by any code that uses DataflowAssert.

### Nested Class Summary

Nested Classes
`static class` `DataflowAssert.GroupThenAssert<T>` A transform that applies an assertion-checking function over iterables of `ActualT` to the entirety of the contents of its input.
`static class` `DataflowAssert.GroupThenAssertForSingleton<T>` A transform that applies an assertion-checking function to a single iterable contained as the sole element of a `PCollection`.
`static interface` `DataflowAssert.IterableAssert<T>` Builder interface for assertions applicable to iterables and PCollection contents.
`static class` `DataflowAssert.OneSideInputAssert<ActualT>` An assertion checker that takes a single `PCollectionView<ActualT>` and an assertion over `ActualT`, and checks it within a Beam pipeline.
`static interface` `DataflowAssert.SingletonAssert<T>` Builder interface for assertions applicable to a single value.

### Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods
`static <T> DataflowAssert.IterableAssert<T>` `that(PCollection<T> actual)` Constructs an `DataflowAssert.IterableAssert` for the elements of the provided `PCollection`.
`static <T> DataflowAssert.IterableAssert<T>` `thatIterable(PCollectionView<Iterable<T>> actual)` Deprecated. use `thatSingletonIterable(PCollection)`, `thatSingleton(PCollection)` or `that(PCollection)` instead.
`static <K,V> DataflowAssert.SingletonAssert<Map<K,V>>` `thatMap(PCollection<KV<K,V>> actual)` Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection`, which must have at most one value per key.
`static <K,V> DataflowAssert.SingletonAssert<Map<K,Iterable<V>>>` `thatMultimap(PCollection<KV<K,V>> actual)` Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection`.
`static <T> DataflowAssert.SingletonAssert<T>` `thatSingleton(PCollection<T> actual)` Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection PCollection<T>`, which must be a singleton.
`static <T> DataflowAssert.IterableAssert<T>` `thatSingletonIterable(PCollection<? extends Iterable<T>> actual)` Constructs an `DataflowAssert.IterableAssert` for the value of the provided `PCollection` which must contain a single `Iterable<T>` value.

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

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

### Method Detail

#### that

    public static <T> DataflowAssert.IterableAssert<T> that(PCollection<T> actual)

Constructs an `DataflowAssert.IterableAssert` for the elements of the provided `PCollection`.

#### thatSingletonIterable

    public static <T> DataflowAssert.IterableAssert<T> thatSingletonIterable(PCollection<? extends Iterable<T>> actual)

Constructs an `DataflowAssert.IterableAssert` for the value of the provided `PCollection` which must contain a single `Iterable<T>` value.

#### thatIterable

    @Deprecated
    public static <T> DataflowAssert.IterableAssert<T> thatIterable(PCollectionView<Iterable<T>> actual)

Deprecated. use `thatSingletonIterable(PCollection)`, `thatSingleton(PCollection)` or `that(PCollection)` instead.
Constructs an `DataflowAssert.IterableAssert` for the value of the provided `PCollectionView`.

#### thatSingleton

    public static <T> DataflowAssert.SingletonAssert<T> thatSingleton(PCollection<T> actual)

Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection PCollection<T>`, which must be a singleton.

#### thatMultimap

    public static <K,V> DataflowAssert.SingletonAssert<Map<K,Iterable<V>>> thatMultimap(PCollection<KV<K,V>> actual)

Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection`.

Note that the actual value must be coded by a `KvCoder`, not just any `Coder<K, V>`.

#### thatMap

    public static <K,V> DataflowAssert.SingletonAssert<Map<K,V>> thatMap(PCollection<KV<K,V>> actual)

Constructs a `DataflowAssert.SingletonAssert` for the value of the provided `PCollection`, which must have at most one value per key.

Note that the actual value must be coded by a `KvCoder`, not just any `Coder<K, V>`.