Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Captures assertion site and message in PAssert
This makes PAssert failures quite a bit easier to debug. Example message after this commit: java.lang.AssertionError: Some message at org.apache.beam.sdk.testing.PAssert$PAssertionSite.capture(PAssert.java:384) at org.apache.beam.sdk.testing.PAssert.that(PAssert.java:279) at org.apache.beam.sdk.transforms.SplittableDoFnTest.testPairWithIndexWindowedTimestamped(SplittableDoFnTest.java:234) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... Caused by: java.lang.AssertionError: Expected: iterable over [<TimestampedValue(KV{z, 0}, 2017-01-10T00:38:28.000Z)>, <TimestampedValue(KV{bb, 0}, 2017-01-10T00:38:29.000Z)>, <TimestampedValue(KV{bb, 1}, 2017-01-10T00:38:29.000Z)>, <TimestampedValue(KV{ccccc, 0}, 2017-01-10T00:38:30.000Z)>, <TimestampedValue(KV{ccccc, 1}, 2017-01-10T00:38:30.000Z)>, <TimestampedValue(KV{ccccc, 2}, 2017-01-10T00:38:30.000Z)>, <TimestampedValue(KV{ccccc, 3}, 2017-01-10T00:38:30.000Z)>, <TimestampedValue(KV{ccccc, 4}, 2017-01-10T00:38:30.000Z)>] in any order but: Not matched: <TimestampedValue(KV{a, 0}, 2017-01-10T00:38:28.000Z)> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20) at org.junit.Assert.assertThat(Assert.java:956) at org.junit.Assert.assertThat(Assert.java:923) at org.apache.beam.sdk.testing.PAssert$AssertContainsInAnyOrder.apply(PAssert.java:1270) at org.apache.beam.sdk.testing.PAssert$AssertContainsInAnyOrder.apply(PAssert.java:1) ... (as opposed to, basically, just the "Caused by" part)
- Loading branch information