In 2.3.0.M2 the assertj version was changed from 3.14.0 to 3.15.0. This version is not fully compatible with XMLUnit 2.6.3 (or 2.6.4). The following test:
@Test
fun `assertThatXml_valueByXPath should work`() {
val xml = """
<fruit>
<color>yellow</color>
</fruit>
"""
assertThatXml(xml).valueByXPath("//color").isEqualTo("yellow")
}
will throw an error:
java.lang.NoSuchMethodError: org.xmlunit.assertj.ValueAssert.describedAs(Ljava/lang/String;[Ljava/lang/Object;)Lorg/assertj/core/api/AbstractAssert;
at org.xmlunit.assertj.ValueAssert.create(ValueAssert.java:68)
at org.xmlunit.assertj.XmlAssert.valueByXPath(XmlAssert.java:202)
The cause is that assertj 3.15.0 moved the `describedAs´method from AbstractAssert to Descriptable and due to type erasure the method return type changed on the byte code level from AbstractAssert to Object.
This issue has been created for XMLUnit: https://github.com/xmlunit/xmlunit/issues/181
Comment From: wilkinsona
Thanks for letting us know. Given that the problem only affects those using AssertJ and XMLUnit, we don't want to downgrade AssertJ as that will affect everyone that uses AssertJ. Hopefully the problem will be addressed in a future version of AssertJ or XMLUnit which we'll pick up in due course as part of our dependency upgrade process.