Skip to content

Commit 81d6e26

Browse files
committed
feat(kotlin): idiomatic Kotlin with full e2e tests (done)
1 parent 73c05f0 commit 81d6e26

File tree

2 files changed

+7
-36
lines changed

2 files changed

+7
-36
lines changed

e2e/src/test/java/io/zenwave360/sdk/e2e/TestMonolithKlinicalProject.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,13 @@ public void fixControllers() throws Exception {
138138
"masterDataService.listMasterDataOfType\\(type, lang\\)",
139139
"masterDataService.listMasterDataOfType(MasterDataType.valueOf(type), lang)");
140140

141-
TextUtils.replaceInFile(new File(targetFolder + "/src/main/kotlin/com/example/clinical/modules/documents/mappers/DocumentServiceMapper.kt"),
142-
"DocumentInfo asDocumentInfo\\(List<Long> documentIds\\);",
143-
"default DocumentInfo asDocumentInfo(List<Long> documentIds) { return new DocumentInfo(); }");
144-
TextUtils.replaceInFile(new File(targetFolder + "/src/main/kotlin/com/example/clinical/modules/documents/mappers/DocumentServiceMapper.kt"),
145-
"DocumentInfo update\\(@MappingTarget DocumentInfo entity, List<Long> documentIds\\);",
146-
" default DocumentInfo update(@MappingTarget DocumentInfo entity, List<Long> documentIds) { return entity; }");
141+
TextUtils.replaceInFile(new File(targetFolder + "/src/test/kotlin/com/example/clinical/adapters/web/documents/DocumentApiControllerTest.kt"),
142+
"data = \"aaa\"",
143+
"data = org.springframework.core.io.ByteArrayResource(\"test data\".toByteArray())");
144+
145+
TextUtils.replaceInFile(new File(targetFolder + "/src/test/kotlin/com/example/clinical/modules/surveys/service/impl/SurveysServiceTest.kt"),
146+
"val input: java.util.Map = java.util.Map",
147+
" val input = mutableMapOf<String, Any?>");
147148
}
148149

149150
@Test

plugins/customizations/kotlin-backend-application/src/test/java/io/zenwave360/sdk/plugins/kotlin/OpenAPIControllersKotlinGeneratorTest.java

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,36 +59,6 @@ public void test_generator_openapi_controllers_zdl_customer_address() throws Exc
5959

6060
}
6161

62-
@Test
63-
public void test_asMethodParametersInitializer() throws Exception {
64-
OpenAPIControllersKotlinHelpers helpers = new OpenAPIControllersKotlinHelpers("", "DTO");
65-
66-
// Test with empty operation
67-
Map<String, Object> emptyOperation = Map.of();
68-
CharSequence result = helpers.asMethodParametersInitializer(emptyOperation, null);
69-
Assertions.assertEquals("", result.toString());
70-
71-
// Test with operation containing parameters
72-
Map<String, Object> operation = Map.of(
73-
"parameters", List.of(
74-
Map.of(
75-
"name", "id",
76-
"schema", Map.of("type", "integer")
77-
),
78-
Map.of(
79-
"name", "name",
80-
"schema", Map.of("type", "string")
81-
)
82-
)
83-
);
84-
85-
result = helpers.asMethodParametersInitializer(operation, null);
86-
String resultStr = result.toString();
87-
88-
Assertions.assertTrue(resultStr.contains("val id: Int = 0"));
89-
Assertions.assertTrue(resultStr.contains("val name: String = \"\""));
90-
}
91-
9262
@Test
9363
public void test_asMethodParametersInitializer_uploadDocument() throws Exception {
9464
// Load the documents OpenAPI spec

0 commit comments

Comments
 (0)