Skip to content

Commit 08ddca1

Browse files
committed
test (JAVA CLIENTS): add another test for the useOneOfInterfaces option
1 parent 8314c98 commit 08ddca1

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

43884388
}
43894389

4390+
@Test(dataProvider = "allJavaClients")
4391+
public void testClientWithUseOneOfInterfaceWithoutDiscriminator_issue_17419(String client) {
4392+
// given
4393+
final Path output = newTempFolder();
4394+
final CodegenConfigurator configurator = new CodegenConfigurator()
4395+
.setGeneratorName("java")
4396+
.setLibrary(client)
4397+
.setAdditionalProperties(Map.of("useOneOfInterfaces", "true"))
4398+
.setInputSpec("src/test/resources/3_0/typescript-fetch/oneOf.yaml")
4399+
.setOutputDir(output.toString().replace("\\", "/"));
4400+
4401+
final ClientOptInput input = configurator.toClientOptInput();
4402+
4403+
// when
4404+
List<File> files = new DefaultGenerator().opts(input).generate();
4405+
4406+
// then
4407+
validateJavaSourceFiles(files);
4408+
4409+
TestUtils.assertFileContains(
4410+
output.resolve("src/main/java/org/openapitools/client/model/TestResponse.java"),
4411+
"public interface TestResponse {"
4412+
);
4413+
TestUtils.assertFileContains(
4414+
output.resolve("src/main/java/org/openapitools/client/model/TestA.java"),
4415+
"implements TestResponse"
4416+
);
4417+
TestUtils.assertFileContains(
4418+
output.resolve("src/main/java/org/openapitools/client/model/TestB.java"),
4419+
"implements TestResponse"
4420+
);
4421+
4422+
}
4423+
43904424
}

0 commit comments

Comments
 (0)