Skip to content

Commit 662334b

Browse files
committed
feat: simplify test by re-using existing spec
1 parent d8b4e83 commit 662334b

3 files changed

Lines changed: 8 additions & 34 deletions

File tree

modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,13 +382,13 @@ public void generateFormatForDateAndDateTimeQueryParam() throws IOException {
382382
}
383383

384384
@Test
385-
public void generateLocalDateTimeForLocalDateFormat() throws IOException {
385+
public void generateLocalDateTimeForDateTimeLocalFormat() throws IOException {
386386
File output = Files.createTempDirectory("test").toFile().getCanonicalFile();
387387
output.deleteOnExit();
388388
String outputPath = output.getAbsolutePath().replace('\\', '/');
389389

390390
OpenAPI openAPI = new OpenAPIParser()
391-
.readLocation("src/test/resources/3_0/spring/date-time-local.yml", null, new ParseOptions()).getOpenAPI();
391+
.readLocation("src/test/resources/3_0/spring/date-time-parameter-types-for-testing.yml", null, new ParseOptions()).getOpenAPI();
392392

393393
SpringCodegen codegen = new SpringCodegen();
394394
codegen.setOutputDir(output.getAbsolutePath());
@@ -405,9 +405,9 @@ public void generateLocalDateTimeForLocalDateFormat() throws IOException {
405405
generator.setGenerateMetadata(false);
406406
generator.opts(input).generate();
407407

408-
JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/model/EventParams.java"))
408+
JavaFileAssert.assertThat(Paths.get(outputPath + "/src/main/java/org/openapitools/model/Pet.java"))
409409
.hasImports("java.time.LocalDateTime")
410-
.assertProperty("startAt").withType("LocalDateTime");
410+
.assertProperty("adoptionDate").withType("LocalDateTime");
411411
}
412412

413413
@Test

modules/openapi-generator/src/test/resources/3_0/spring/date-time-local.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

modules/openapi-generator/src/test/resources/3_0/spring/date-time-parameter-types-for-testing.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,7 @@ components:
102102
type: string
103103
format: date
104104
default: '2021-01-01'
105+
adoptionDate:
106+
type: string
107+
format: date-time-local
108+
default: '2007-12-03T10:15:30'

0 commit comments

Comments
 (0)