Skip to content

Commit 3605028

Browse files
committed
test (JAVA CLIENTS): add another test for the useOneOfInterfaces option
1 parent 929296b commit 3605028

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3745,4 +3745,38 @@ public void testClientWithUseOneOfInterface_issue_17419(String client) {
37453745

37463746
}
37473747

3748+
@Test(dataProvider = "allJavaClients")
3749+
public void testClientWithUseOneOfInterfaceWithoutDiscriminator_issue_17419(String client) {
3750+
// given
3751+
final Path output = newTempFolder();
3752+
final CodegenConfigurator configurator = new CodegenConfigurator()
3753+
.setGeneratorName("java")
3754+
.setLibrary(client)
3755+
.setAdditionalProperties(Map.of("useOneOfInterfaces", "true"))
3756+
.setInputSpec("src/test/resources/3_0/typescript-fetch/oneOf.yaml")
3757+
.setOutputDir(output.toString().replace("\\", "/"));
3758+
3759+
final ClientOptInput input = configurator.toClientOptInput();
3760+
3761+
// when
3762+
List<File> files = new DefaultGenerator().opts(input).generate();
3763+
3764+
// then
3765+
validateJavaSourceFiles(files);
3766+
3767+
TestUtils.assertFileContains(
3768+
output.resolve("src/main/java/org/openapitools/client/model/TestResponse.java"),
3769+
"public interface TestResponse {"
3770+
);
3771+
TestUtils.assertFileContains(
3772+
output.resolve("src/main/java/org/openapitools/client/model/TestA.java"),
3773+
"implements TestResponse"
3774+
);
3775+
TestUtils.assertFileContains(
3776+
output.resolve("src/main/java/org/openapitools/client/model/TestB.java"),
3777+
"implements TestResponse"
3778+
);
3779+
3780+
}
3781+
37483782
}

0 commit comments

Comments
 (0)