You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are required to verify multiple properties of complex objects.
One way to do this is within a "then" step to run a loop -- like this:
public SELF the_response_matches(
@JsonAssertionsFormatter.Annotation final Iterable<JsonAssertion> expectedContents) {
val jsonVerifier = JsonAssert.with(responseContent.get());
for (val pair : expectedContents) {
if (null == pair.getValue()) {
jsonVerifier.assertNotDefined(pair.getKey());
} else {
jsonVerifier.assertThat(pair.getKey(), pair.getValue());
}
}
return self();
}
The issue with this approach is that it stops evaluating further assertions upon first failed assertion. Hence, if someone tries to fix the test, then he has to run it multiple times until all properties are as they should be.
Another way would be to just write one @Test method per property. The downside of this is the amount of extra code.
It would be much nicer if we could accumulate the AssertionErrors into one AssertionError and throw it.
While running in an IDE the failure message appears quite nice:
We are required to verify multiple properties of complex objects.
One way to do this is within a "then" step to run a loop -- like this:
The issue with this approach is that it stops evaluating further assertions upon first failed assertion. Hence, if someone tries to fix the test, then he has to run it multiple times until all properties are as they should be.
Another way would be to just write one
@Test
method per property. The downside of this is the amount of extra code.It would be much nicer if we could accumulate the
AssertionErrors
into oneAssertionError
and throw it.While running in an IDE the failure message appears quite nice:
But, in the JGiven Report it is rendered into one continuous line. I tried adding CRLFs,
`s -- nothing helped :(
Is there some way to customize failure messages in the JGiven Report?
The text was updated successfully, but these errors were encountered: