DataflowAssert (Google Cloud Dataflow SDK 1.9.1 API)

Google Cloud Dataflow SDK for Java, version 1.9.1

com.google.cloud.dataflow.sdk.testing

Class 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.


Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Dataflow