Skip to content

Commit ca63448

Browse files
authored
Add JavaClientCodegen RxJava option tests (#24203)
1 parent 2e5be1e commit ca63448

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

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

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4596,4 +4596,41 @@ public void testSwagger2TagImportRestAssured() throws IOException {
45964596
.contains("@Tag(");
45974597
}
45984598

4599+
@DataProvider(name = "rxJavaOptions")
4600+
public static Object[][] rxJavaOptions() {
4601+
return new Object[][]{
4602+
{Map.of(USE_RX_JAVA2, true, USE_RX_JAVA3, true), Map.of(USE_RX_JAVA2, false, USE_RX_JAVA3, true)},
4603+
{Map.of(USE_RX_JAVA2, true), Map.of(USE_RX_JAVA2, true)}
4604+
};
4605+
}
4606+
4607+
@Test(dataProvider = "rxJavaOptions")
4608+
public void processOptsConfiguresRxJavaOptions(Map<String, Object> properties, Map<String, Object> expectedProperties) {
4609+
JavaClientCodegen codegen = newRetrofit2Codegen(properties);
4610+
4611+
codegen.processOpts();
4612+
4613+
assertThat(codegen.additionalProperties())
4614+
.containsAllEntriesOf(expectedProperties)
4615+
.doesNotContainKey(DO_NOT_USE_RX);
4616+
}
4617+
4618+
@Test
4619+
public void processOptsConvertsConfiguredSupportUrlQuery() {
4620+
JavaClientCodegen codegen = new JavaClientCodegen();
4621+
codegen.setLibrary(JavaClientCodegen.APACHE);
4622+
codegen.additionalProperties().put(SUPPORT_URL_QUERY, "false");
4623+
4624+
codegen.processOpts();
4625+
4626+
assertThat(codegen.additionalProperties())
4627+
.containsEntry(SUPPORT_URL_QUERY, false);
4628+
}
4629+
4630+
private static JavaClientCodegen newRetrofit2Codegen(Map<String, Object> properties) {
4631+
JavaClientCodegen codegen = new JavaClientCodegen();
4632+
codegen.setLibrary(JavaClientCodegen.RETROFIT_2);
4633+
codegen.additionalProperties().putAll(properties);
4634+
return codegen;
4635+
}
45994636
}

0 commit comments

Comments
 (0)