Skip to content

Commit 5485eab

Browse files
committed
improve unit test
1 parent a86a9f1 commit 5485eab

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2616,7 +2616,25 @@ public void testDollarsAndQuotesSwagger1() {
26162616
"@RequestParam(value = \"form\\$Value\"",
26172617
"PATH_ITEMS_ITEM_ID_SOMETHING_ITEM_SUB_ID_GET: String = \"/items/{item\\$Id}/something/{item\\$SubId}\"",
26182618
"/* \"/items/{item$Id}/something/{item$SubId}\" */"
2619-
)
2619+
),
2620+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200Response.kt"),
2621+
List.of(
2622+
"@ApiModelProperty(example = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\", value = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\")",
2623+
"@get:JsonProperty(\"item\\$Id\") val itemDollarId: kotlin.String? = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\"",
2624+
"@get:JsonProperty(\"name\\$Value\") val nameDollarValue: kotlin.String? = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\"",
2625+
"@get:JsonProperty(\"details\\$Info\")",
2626+
"@param itemDollarId SQ = \"; SBS = \\; DBS = \\\\; SD = $some",
2627+
"@param nameDollarValue SQ = \"; SBS = \\; DBS = \\\\; SD = $some"
2628+
),
2629+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt"),
2630+
List.of(
2631+
"@ApiModelProperty(example = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\", value = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\")",
2632+
"@get:JsonProperty(\"\\$id\") val dollarId: kotlin.String? = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\"",
2633+
"@get:JsonProperty(\"\\$name\") val dollarName: kotlin.String? = \"SQ = \\\"; SBS = \\\\; DBS = \\\\\\\\; SD = \\$some\"",
2634+
"* SQ = \"; SBS = \\; DBS = \\\\; SD = $some",
2635+
"* @param dollarId SQ = \"; SBS = \\; DBS = \\\\; SD = $some",
2636+
"* @param dollarName SQ = \"; SBS = \\; DBS = \\\\; SD = $some"
2637+
)
26202638
));
26212639
assertGeneratedFilesNotContain(Map.of(
26222640
apiSources.resolve("src/main/kotlin/org/openapitools/api/itemsApi.kt"),
@@ -2635,7 +2653,26 @@ public void testDollarsAndQuotesSwagger1() {
26352653
"@RequestParam(value = \"form$Value\"",
26362654
"PATH_ITEMS_ITEM_ID_SOMETHING_ITEM_SUB_ID_GET: String = \"/items/{item$Id}/something/{item$SubId}\"",
26372655
"/* \"/items/{item\\$Id}/something/{item\\$SubId}\" */"
2638-
)
2656+
),
2657+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemsItemIdSomethingItemSubIdGet200Response.kt"),
2658+
List.of(
2659+
"SQ = \\\\\";",
2660+
"SBS = \\\\\\\\;",
2661+
"DBS = \\\\\\\\\\\\\\\\;",
2662+
"SD = \\\\$some",
2663+
"item$Id",
2664+
"name$Value",
2665+
"details$Info"
2666+
),
2667+
apiSources.resolve("src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt"),
2668+
List.of(
2669+
"SQ = \\\\\";",
2670+
"SBS = \\\\\\\\;",
2671+
"DBS = \\\\\\\\\\\\\\\\;",
2672+
"SD = \\\\$some",
2673+
"\"$id\"",
2674+
"\"$name\""
2675+
)
26392676
));
26402677
}
26412678

0 commit comments

Comments
 (0)