Skip to content

Commit 875cf36

Browse files
author
luigi
committed
fix
1 parent bde20e9 commit 875cf36

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

tests/codegen/service-codegen-tests/src/test/kotlin/com/test/JsonServiceTest.kt

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ class JsonServiceTest {
3434

3535
private lateinit var proc: Process
3636

37+
38+
3739
@BeforeAll
3840
fun boot() {
3941
proc = startService("netty", port, closeGracePeriodMillis, closeTimeoutMillis, requestBodyLimit, projectDir)
@@ -65,7 +67,6 @@ class JsonServiceTest {
6567

6668
@Test
6769
fun `checks http-label`() {
68-
val json = Json { }
6970
val response = sendRequest(
7071
"$baseUrl/http-label/labelValue",
7172
"GET",
@@ -77,7 +78,7 @@ class JsonServiceTest {
7778
assertIs<HttpResponse<String>>(response)
7879

7980
assertEquals(200, response.statusCode(), "Expected 200")
80-
val body = json.decodeFromString(
81+
val body = Json.decodeFromString(
8182
HttpLabelTestOutputResponse.serializer(),
8283
response.body(),
8384
)
@@ -86,7 +87,6 @@ class JsonServiceTest {
8687

8788
@Test
8889
fun `checks http-query`() {
89-
val json = Json { }
9090
val response = sendRequest(
9191
"$baseUrl/http-query?query=123&qqq=kotlin",
9292
"DELETE",
@@ -98,7 +98,7 @@ class JsonServiceTest {
9898
assertIs<HttpResponse<String>>(response)
9999

100100
assertEquals(200, response.statusCode(), "Expected 200")
101-
val body = json.decodeFromString(
101+
val body = Json.decodeFromString(
102102
HttpQueryTestOutputResponse.serializer(),
103103
response.body(),
104104
)
@@ -123,9 +123,7 @@ class JsonServiceTest {
123123

124124
@Test
125125
fun `checks http-payload structure`() {
126-
val json = Json { }
127-
128-
val requestJson = json.encodeToJsonElement(
126+
val requestJson = Json.encodeToJsonElement(
129127
HttpStructurePayloadTestStructure.serializer(),
130128
HttpStructurePayloadTestStructure(
131129
"content",
@@ -144,7 +142,7 @@ class JsonServiceTest {
144142
)
145143
assertIs<HttpResponse<String>>(response)
146144
assertEquals(201, response.statusCode(), "Expected 201")
147-
val body = json.decodeFromString(
145+
val body = Json.decodeFromString(
148146
HttpStructurePayloadTestStructure.serializer(),
149147
response.body(),
150148
)
@@ -155,9 +153,7 @@ class JsonServiceTest {
155153

156154
@Test
157155
fun `checks timestamp`() {
158-
val json = Json { }
159-
160-
val requestJson = json.encodeToJsonElement(
156+
val requestJson = Json.encodeToJsonElement(
161157
TimestampTestRequestResponse.serializer(),
162158
TimestampTestRequestResponse(
163159
1515531081.123,
@@ -177,7 +173,7 @@ class JsonServiceTest {
177173
)
178174
assertIs<HttpResponse<String>>(response)
179175
assertEquals(201, response.statusCode(), "Expected 201")
180-
val body = json.decodeFromString(
176+
val body = Json.decodeFromString(
181177
TimestampTestRequestResponse.serializer(),
182178
response.body(),
183179
)
@@ -189,9 +185,7 @@ class JsonServiceTest {
189185

190186
@Test
191187
fun `checks json name`() {
192-
val json = Json { }
193-
194-
val requestJson = json.encodeToJsonElement(
188+
val requestJson = Json.encodeToJsonElement(
195189
JsonNameTestRequest.serializer(),
196190
JsonNameTestRequest("Hello Kotlin Team"),
197191
)
@@ -206,7 +200,7 @@ class JsonServiceTest {
206200
)
207201
assertIs<HttpResponse<String>>(response)
208202
assertEquals(201, response.statusCode(), "Expected 201")
209-
val body = json.decodeFromString(
203+
val body = Json.decodeFromString(
210204
JsonNameTestResponse.serializer(),
211205
response.body(),
212206
)

tests/codegen/service-codegen-tests/src/test/kotlin/com/test/utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ private fun isWindows() = System.getProperty("os.name").lowercase().contains("wi
8383
internal fun waitForPort(port: Int, timeoutSec: Long = 180, proc: Process? = null): Boolean {
8484
val deadline = System.currentTimeMillis() + TimeUnit.SECONDS.toNanos(timeoutSec)
8585
while (System.currentTimeMillis() < deadline) {
86-
proc?.inputStream?.bufferedReader()?.forEachLine {println(it)}
86+
// proc?.inputStream?.bufferedReader()?.forEachLine { println(it) }
8787
try {
8888
Socket("localhost", port).use {
8989
return true // Port is available

0 commit comments

Comments
 (0)