/** Example test that tests a PTransform by using an in-memory input and inspecting the output. */ @Test @Category(RunnableOnService.class) public void testCountWords() throws Exception { Pipeline p = TestPipeline.create(); PCollection<String> input = p.apply(Create.of(WORDS).withCoder(StringUtf8Coder.of())); PCollection<String> output = input.apply(new CountWords()) .apply(ParDo.of(new FormatAsTextFn())); DataflowAssert.that(output).containsInAnyOrder(COUNTS_ARRAY); p.run(); }