|
6 | 6 | package io.openapiprocessor.core.converter.mapping |
7 | 7 |
|
8 | 8 | import io.kotest.core.spec.style.StringSpec |
| 9 | +import io.kotest.matchers.collections.shouldNotBeEmpty |
9 | 10 | import io.kotest.matchers.nulls.shouldNotBeNull |
10 | 11 | import io.kotest.matchers.shouldBe |
11 | 12 | import io.mockk.mockk |
@@ -101,4 +102,24 @@ class MappingFinderEndpointMethodSpec: StringSpec({ |
101 | 102 | result.targetTypeName.shouldBe("org.openapitools.jackson.nullable.JsonNullable") |
102 | 103 | } |
103 | 104 |
|
| 105 | + "endpoint/method add parameter mapping matches" { |
| 106 | + val finder = MappingFinder( |
| 107 | + listOf( |
| 108 | + EndpointTypeMapping("/foo", null, emptyList()), |
| 109 | + EndpointTypeMapping("/foo", HttpMethod.GET, listOf( |
| 110 | + AddParameterTypeMapping("foo param", |
| 111 | + TypeMapping(null, "io.openapiprocessor.Foo")), |
| 112 | + AddParameterTypeMapping("bar param", |
| 113 | + TypeMapping(null, "io.openapiprocessor.Foo")) |
| 114 | + ))) |
| 115 | + ) |
| 116 | + |
| 117 | + val info = SchemaInfo(foo, "", "", null, resolver) |
| 118 | + val result = finder.findEndpointAddParameterTypeMappings(info.getPath(), info.getMethod()) |
| 119 | + |
| 120 | + result.shouldNotBeEmpty() |
| 121 | + result[0].parameterName.shouldBe("foo param") |
| 122 | + result[1].parameterName.shouldBe("bar param") |
| 123 | + } |
| 124 | + |
104 | 125 | }) |
0 commit comments