Skip to content

XmlUnit 2.6.[3,4] is not compatible with AssertJ-Core 3.15.0 #181

@jwalter

Description

@jwalter

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 when trying to run with assertj 3.15.0 on the classpath:

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 currently affects all Spring Boot projects using the milestone M2, M3 or M4 builds of Spring Boot 2.3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions