Hamcrest check if value is null or empty array
问题 I have a code, which returns JSON, where one field might be null or empty array. I have this code to check: import static org.hamcrest.core.AnyOf.anyOf; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.Matchers.blankOrNullString; // io.restassured.response getResponse.then() .assertThat() .body("entity.fields", anyOf(nullValue(), emptyArray())) But output is unclear java.lang.AssertionError: 1 expectation failed. JSON path entity.fields doesn't match. Expected: