Repository navigation
Conversation
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)
|
Refer to this link for build results (access rights to CI server needed): |
kennknowles
reviewed
Jan 10, 2017
| + exc.getMessage() | ||
| + "\"", | ||
| expectedPattern.matcher(exc.getMessage()).find()); | ||
| expectedPattern.matcher(Throwables.getStackTraceAsString(exc)).find()); |
Member
There was a problem hiding this comment.
Can this be tightened? I'd like for the case where I don't provide an auxiliary message to be unchanged, and for the new case to have the detailed cause immediately nested.
Contributor
Author
There was a problem hiding this comment.
Done. Added tests too.
Contributor
|
driveby: Awesome improvement; can this please be tagged with a JIRA? File one if necessary. |
|
Refer to this link for build results (access rights to CI server needed): |
Member
|
LGTM, merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This makes PAssert failures quite a bit easier to debug.
Example message after this commit:
(as opposed to, basically, just the "Caused by" part)
Inspiration for this CL was when this test failed while working on something else, but didn't tell me which of the assertions was wrong. https://github.com/apache/beam/blob/master/sdks/java/core/src/test/java/org/apache/beam/sdk/transforms/CombineTest.java#L157-L159
R: @kennknowles