Skip to content

Commit

Permalink
fix(impl): [#199] Improve variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmf committed Mar 28, 2024
1 parent 00dfa3c commit 7e07b49
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ class IrsApplicationTests {

@Test
void generatedOpenApiMatchesContract() throws Exception {
final String generatedYaml = this.restTemplate.getForObject("http://localhost:" + port + "/api/api-docs.yaml", String.class);
final InputStream fixedYaml = Files.newInputStream(Path.of("../docs/src/api/irs-api.yaml"));
final String generatedYaml = this.restTemplate.getForObject("http://localhost:" + port + "/api/api-docs.yaml",
String.class);
final InputStream definedYaml = Files.newInputStream(Path.of("../docs/src/api/irs-api.yaml"));

final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
final Map<String, Object> fixedYamlMap = mapper.readerForMapOf(Object.class).readValue(fixedYaml);
final Map<String, Object> definedYamlMap = mapper.readerForMapOf(Object.class).readValue(definedYaml);
final Map<String, Object> generatedYamlMap = mapper.readerForMapOf(Object.class).readValue(generatedYaml);

// To correctly display both documentations examples - manual and generated by annotations -
Expand All @@ -93,7 +94,8 @@ void generatedOpenApiMatchesContract() throws Exception {
.ignoringFields("components.schemas.Jobs.example")
.ignoringFields("components.schemas.Policy")
.ignoringFields("components.schemas.BatchResponse.example")
.isEqualTo(fixedYamlMap);
.isEqualTo(definedYamlMap);

}

@Test
Expand Down

0 comments on commit 7e07b49

Please sign in to comment.