diff --git a/CHANGELOG.md b/CHANGELOG.md index d574bf82f..940e04059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ _**For better traceability add the corresponding GitHub issue number in each cha ### Changed - Improved documentation for `GET /irs/policies/paged` endpoint. #639 +- Cleanup in IrsApplicationTest.generatedOpenApiMatchesContract + (removed obsolete ignoringFields, improved assertion message) ## [5.4.0] - 2024-07-22 diff --git a/irs-api/src/test/java/org/eclipse/tractusx/irs/IrsApplicationTests.java b/irs-api/src/test/java/org/eclipse/tractusx/irs/IrsApplicationTests.java index f107e0611..7a2c300ef 100644 --- a/irs-api/src/test/java/org/eclipse/tractusx/irs/IrsApplicationTests.java +++ b/irs-api/src/test/java/org/eclipse/tractusx/irs/IrsApplicationTests.java @@ -90,24 +90,14 @@ void generatedOpenApiMatchesContract() throws Exception { final Map generatedYamlMap = mapper.readerForMapOf(Object.class).readValue(generatedYaml); try { - // To correctly display both documentations examples - manual and generated by annotations - - // we need to remove verification for some "examples", otherwise one or another won't display correctly assertThat(generatedYamlMap) - .usingRecursiveComparison() - - .ignoringFields("components.schemas.PageResult.example") - .ignoringFields("components.schemas.AspectModels.example") - .ignoringFields("components.schemas.BatchOrderResponse.example") - .ignoringFields("components.schemas.Jobs.example") - .ignoringFields("components.schemas.Policy") - .ignoringFields("components.schemas.BatchResponse.example") - .isEqualTo(definedYamlMap); } catch (AssertionError e) { // write changed API to file for easier comparison Files.writeString(Paths.get("../docs/src/api/irs-api.actual.yaml"), generatedYaml); - throw e; + throw new AssertionError("Please compare the generated irs-api.actual.yaml " + + "with irs-api.yaml to find the differences easily!", e); } }