lukas-krecan / JsonUnit

Compare JSON in your Unit Tests
Apache License 2.0
893 stars 115 forks source link

How to do soft assertions with assertj APIs? #482

Open akshayamaldhure opened 2 years ago

akshayamaldhure commented 2 years ago

My test case has a flow that looks like this:

  1. Create some config.
  2. Hit an API and perform JSON assertion using https://github.com/lukas-krecan/JsonUnit#assertj-integration.
  3. Hit the same API with different parameters and perform similar JSON assertions.

The problem is that if the assertion at step 2 fails, then step 3 is not performed at all, which is like a hard assertion. So I'm wondering if there's a way to make the flow go through and do each and every assertion (soft assertion).

EDIT: I see that the core AssertJ library supports soft assertions (https://assertj.github.io/doc/#assertj-core-soft-assertions). I'm not sure how to use the json unit assertions with the same though.

lukas-krecan commented 2 years ago

Duplicate of #145