1- /*
2- * Copyright 2025 https://github.com/openapi-processor/openapi-processor-base
3- * PDX-License-Identifier: Apache-2.0
4- */
5-
6- package io.openapiprocessor.core.model
1+ package io.openapiprocessor.core.converter
72
83import io.kotest.core.spec.style.StringSpec
4+ import io.kotest.core.spec.style.scopes.StringSpecRootScope.invoke
95import io.kotest.matchers.nulls.shouldBeNull
106import io.kotest.matchers.nulls.shouldNotBeNull
117import io.openapiprocessor.core.processor.mapping.v2.ResultStyle
128import io.openapiprocessor.core.support.parseApi
139
14- class EndpointResponseCollectorSpec : StringSpec ({
10+ class ContentTypeResponseCollectorSpec : StringSpec ({
1511
1612 " single empty success response" {
1713 val openApi = parseApi(
@@ -26,11 +22,12 @@ class EndpointResponseCollectorSpec: StringSpec({
2622 | responses:
2723 | '204':
2824 | description: empty
29- """.trimMargin())
25+ """.trimMargin()
26+ )
3027
3128 val operation = openApi.getPaths()[" /foo" ]!!.getOperations().first()
3229
33- val collector = EndpointResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
30+ val collector = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
3431
3532 collector.contentTypeResponses[" " ]!![" 204" ].shouldNotBeNull()
3633 }
@@ -52,11 +49,12 @@ class EndpointResponseCollectorSpec: StringSpec({
5249 | application/json:
5350 | schema:
5451 | type: string
55- """.trimMargin())
52+ """.trimMargin()
53+ )
5654
5755 val operation = openApi.getPaths()[" /foo" ]!!.getOperations().first()
5856
59- val collector = EndpointResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
57+ val collector = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
6058
6159 collector.contentTypeResponses[" application/json" ]!![" 200" ].shouldNotBeNull()
6260 }
@@ -87,11 +85,12 @@ class EndpointResponseCollectorSpec: StringSpec({
8785 | application/json:
8886 | schema:
8987 | type: string
90- """.trimMargin())
88+ """.trimMargin()
89+ )
9190
9291 val operation = openApi.getPaths()[" /foo" ]!!.getOperations().first()
9392
94- val collector = EndpointResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
93+ val collector = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
9594
9695 collector.contentTypeResponses[" application/json" ]!![" 200" ].shouldNotBeNull()
9796 collector.contentTypeResponses[" application/json" ]!![" 201" ].shouldNotBeNull()
@@ -122,11 +121,12 @@ class EndpointResponseCollectorSpec: StringSpec({
122121 | schema:
123122 | type: string
124123 | format: two
125- """.trimMargin())
124+ """.trimMargin()
125+ )
126126
127127 val operation = openApi.getPaths()[" /foo" ]!!.getOperations().first()
128128
129- val collector = EndpointResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
129+ val collector = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
130130
131131 collector.contentTypeResponses[" application/json" ]!![" 200" ].shouldNotBeNull()
132132 collector.contentTypeResponses[" application/json" ]!![" 201" ].shouldNotBeNull()
@@ -167,16 +167,17 @@ class EndpointResponseCollectorSpec: StringSpec({
167167 | type: string
168168 | format: error
169169 |
170- """.trimMargin())
170+ """.trimMargin()
171+ )
171172
172173 val operation = openApi.getPaths()[" /foo" ]!!.getOperations().first()
173174
174- val collectorA = EndpointResponseCollector (operation.getResponses(), ResultStyle .ALL )
175+ val collectorA = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .ALL )
175176 collectorA.contentTypeResponses[" application/json" ]!![" 200" ].shouldNotBeNull()
176177 collectorA.contentTypeResponses[" application/json" ]!![" 201" ].shouldNotBeNull()
177178 collectorA.contentTypeResponses[" application/json" ]!![" 400" ].shouldNotBeNull()
178179
179- val collectorS = EndpointResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
180+ val collectorS = ContentTypeResponseCollector (operation.getResponses(), ResultStyle .SUCCESS )
180181 collectorS.contentTypeResponses[" application/json" ]!![" 200" ].shouldNotBeNull()
181182 collectorS.contentTypeResponses[" application/json" ]!![" 201" ].shouldNotBeNull()
182183 collectorS.contentTypeResponses[" application/json" ]!![" 400" ].shouldBeNull()
0 commit comments