Skip to content

Commit 05fc0e7

Browse files
committed
test (JAVA CLIENTS): add another test for the useOneOfInterfaces option
1 parent 020a7a4 commit 05fc0e7

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
@@ -3556,4 +3556,38 @@ public void testClientWithUseOneOfInterface_issue_17419(String client) {
35563556

35573557
}
35583558

3559+
@Test(dataProvider = "allJavaClients")
3560+
public void testClientWithUseOneOfInterfaceWithoutDiscriminator_issue_17419(String client) {
3561+
// given
3562+
final Path output = newTempFolder();
3563+
final CodegenConfigurator configurator = new CodegenConfigurator()
3564+
.setGeneratorName("java")
3565+
.setLibrary(client)
3566+
.setAdditionalProperties(Map.of("useOneOfInterfaces", "true"))
3567+
.setInputSpec("src/test/resources/3_0/typescript-fetch/oneOf.yaml")
3568+
.setOutputDir(output.toString().replace("\\", "/"));
3569+
3570+
final ClientOptInput input = configurator.toClientOptInput();
3571+
3572+
// when
3573+
List<File> files = new DefaultGenerator().opts(input).generate();
3574+
3575+
// then
3576+
validateJavaSourceFiles(files);
3577+
3578+
TestUtils.assertFileContains(
3579+
output.resolve("src/main/java/org/openapitools/client/model/TestResponse.java"),
3580+
"public interface TestResponse {"
3581+
);
3582+
TestUtils.assertFileContains(
3583+
output.resolve("src/main/java/org/openapitools/client/model/TestA.java"),
3584+
"implements TestResponse"
3585+
);
3586+
TestUtils.assertFileContains(
3587+
output.resolve("src/main/java/org/openapitools/client/model/TestB.java"),
3588+
"implements TestResponse"
3589+
);
3590+
3591+
}
3592+
35593593
}

0 commit comments

Comments
 (0)