layout: section title: “PAssert” permalink: /documentation/transforms/java/other/passert/ section_menu: section-menu/documentation.html

PAssert

Examples

For a given PCollection, you can use PAssert to verify the contents as follows:

PCollection<String> output = ...;

// Check whether a PCollection contains some elements in any order.
PAssert.that(output)
.containsInAnyOrder(
  "elem1",
  "elem3",
  "elem2");

Any code that uses PAssert must link in JUnit and Hamcrest. If you‘re using Maven, you can link in Hamcrest by adding the following dependency to your project’s pom.xml file:

<dependency>
    <groupId>org.hamcrest</groupId>
    <artifactId>hamcrest-all</artifactId>
    <version>1.3</version>
    <scope>test</scope>
</dependency>

Related transforms

  • TestStream