RobWin/assertj-swagger

assertj > 2.4 breaks SoftAssertions

picaso opened this issue · 6 comments

Using this library with springboot 1.5.* fails; this version pulls assertj > 2.6 and the api implementation for SoftAssertion has changed.

I can implement a pull request for future assertj versions compatibility.

Hi
That would be awesome. Thx

oloo commented

@picaso Are you going to get to this? We have the same issue still. :)

FYI @compwron

This issue is causing runtime test failures.

Stack trace:

java.lang.NoSuchMethodError: org.assertj.core.api.SoftAssertions.assertThat(Ljava/lang/Iterable;)Lorg/assertj/core/api/IterableAssert;

	at io.github.robwin.swagger.test.DocumentationDrivenValidator.validatePaths(DocumentationDrivenValidator.java:68)
	at io.github.robwin.swagger.test.DocumentationDrivenValidator.validateSwagger(DocumentationDrivenValidator.java:39)
	at io.github.robwin.swagger.test.SwaggerAssert.isEqualTo(SwaggerAssert.java:73)

build.gradle

testCompile "io.github.robwin:assertj-swagger:0.5.0"
    testCompile("org.springframework.boot:spring-boot-starter-test:${springBootVersion}"){
        exclude group: "org.assertj", module: "assertj-core:2.6.0"
    }
    testRuntime "org.assertj:assertj-core:3.8.0"

Test:

@Test
    public void serveAllExpectedEndpoints() throws Exception {
        mockMvc.perform(MockMvcRequestBuilders.get("/v2/api-docs")).andDo(result -> {
            Swagger actual = new Swagger20Parser().parse(result.getResponse().getContentAsString());
            Swagger expected = new SwaggerParser().read(EXPECTED);

            new SwaggerAssert(actual, CONFIG).isEqualTo(expected);
        });
    }

springBootVersion = '1.5.2.RELEASE'

Hi, I won't have time to implement the change.
I'm busy at work and maintaining https://github.com/resilience4j/resilience4j and https://github.com/Swagger2Markup/swagger2markup
Feel free to create a PR. I will review and merge it.

@oloo i had totally forgotten about this. I'll take a look over the weekend.

@oloo @RobWin there is a failing pull request we can modify to be backward comparable I suppose, or can we just have a separate version for java 8 spring 1.5?

Please create a new PR and upgrade to the latest Assertj version and JDK8.