Skip to content

Commit 04e1b13

Browse files
thejeff77claude
andcommitted
test: add serviceInterface test, fix fully-qualified import
- Add suspendFunctionsWithServiceInterface test covering service.mustache - Replace java.nio.file.Files with already-imported Files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 43885d7 commit 04e1b13

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5133,8 +5133,32 @@ public void suspendFunctionsDefaultsToFalse() throws Exception {
51335133
);
51345134
// Verify no suspend keyword appears
51355135
Path petApiPath = root.resolve("src/main/kotlin/org/openapitools/api/PetApi.kt");
5136-
String content = new String(java.nio.file.Files.readAllBytes(petApiPath));
5136+
String content = new String(Files.readAllBytes(petApiPath));
51375137
Assert.assertFalse(content.contains("suspend fun"),
51385138
"suspend should not be present when suspendFunctions is not enabled");
51395139
}
5140+
5141+
@Test
5142+
public void suspendFunctionsWithServiceInterface() throws Exception {
5143+
Path root = generateApiSources(Map.of(
5144+
KotlinSpringServerCodegen.SUSPEND_FUNCTIONS, true,
5145+
KotlinSpringServerCodegen.SERVICE_INTERFACE, true,
5146+
KotlinSpringServerCodegen.DOCUMENTATION_PROVIDER, "none",
5147+
KotlinSpringServerCodegen.ANNOTATION_LIBRARY, "none",
5148+
KotlinSpringServerCodegen.USE_RESPONSE_ENTITY, true
5149+
), Map.of(
5150+
CodegenConstants.MODELS, "false",
5151+
CodegenConstants.MODEL_TESTS, "false",
5152+
CodegenConstants.MODEL_DOCS, "false",
5153+
CodegenConstants.APIS, "true",
5154+
CodegenConstants.SUPPORTING_FILES, "false"
5155+
));
5156+
verifyGeneratedFilesContain(
5157+
Map.of(
5158+
root.resolve("src/main/kotlin/org/openapitools/api/PetApiService.kt"), List.of(
5159+
"suspend fun deletePet(",
5160+
"suspend fun getPetById(")
5161+
)
5162+
);
5163+
}
51405164
}

0 commit comments

Comments
 (0)