Skip to content

Instantly share code, notes, and snippets.

@sanderploegsma
Last active January 31, 2018 19:07
Show Gist options
  • Save sanderploegsma/be9417e5b225082163e7998f7ebf6a0e to your computer and use it in GitHub Desktop.
Save sanderploegsma/be9417e5b225082163e7998f7ebf6a0e to your computer and use it in GitHub Desktop.
class PCollectionUtilsTest {
@get:Rule
private val pipeline : TestPipeline = TestPipeline.create()
@Test
fun `PCollection - filter should correctly filter items`() {
val input = pipeline.apply(Create.of(1, 2, 3, 4, 5))
val output = input.filter { it > 3 }
PAssert.that(output).containsInAnyOrder(4, 5)
}
@Test
fun `PCollection - map should correctly map items`() {
val input = pipeline.apply(Create.of(1, 2, 3, 4, 5))
val output = input.map { it > 3 }
PAssert.that(output).containsInAnyOrder(false, false, false, true, true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment