Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change KiwiXmlAssertTest assertions to check for instanceof Assertion…
…Error okhttp3.mockwebserver in version 4.12.0 depends on JUnit 4 (because MockWebServer actually extends ExternalResource). This caused some tests in KiwiXmlAssertTest to fail because they were expecting errors to be exactly instance of AssertionError. But xmlunit-assertj (deep inside org.xmlunit.assertj.error.ComparisonFailureErrorFactory) actually changes the error it throws to be an org,junit.ComparisonFailure if that class is available at runtime, whereas it simply delegates to AssertJ and throws a regular AssertionError if it is not available. So, by mockwebserver depending on JUnit 4.x, it makes ComparisonFailure available on the class path, so the throwable changes to ComparisonFailure instead of a raw AssertionError. ComparisonFailure is a subclass of AssertionError so we can fix it by changing our assertions in KiwiXmlAssertTest to only check that a Throwable is an instance of (not exactly) AssertionError, so it will pass whether ComparisonFailure exists or not. I don't know for sure, but am guessing they have to do it this way for JUnit 4.x environments to work properly. But I'm not at all sure.
- Loading branch information