@@ -138,6 +138,48 @@ class MappingAnnotationWriterSpec extends Specification {
138
138
target. toString () == """ @Get(uri = "${ endpoint.path} ", consumes = {"multipart/form-data"})"""
139
139
}
140
140
141
+ void " writes unique 'consumes' parameter" () {
142
+ def endpoint = createEndpoint (path : ' /foo' , method : HttpMethod . GET , responses : [
143
+ ' 204' : [new EmptyResponse ()]
144
+ ], requestBodies : [
145
+ new RequestBody (' body' , ' foo/in' , new StringDataType (),
146
+ false , false ),
147
+ new RequestBody (' body' , ' foo/in' , new StringDataType (),
148
+ false , false ),
149
+ new RequestBody (' body' , ' foo/in' , new StringDataType (),
150
+ false , false )
151
+ ])
152
+
153
+ when :
154
+ writer. write (target, endpoint, endpoint. endpointResponses. first ())
155
+
156
+ then :
157
+ target. toString (). contains (' consumes = {"foo/in"}' )
158
+ }
159
+
160
+ void " writes unique 'produces' parameters" () {
161
+ def endpoint = createEndpoint (path : ' /foo' , method : HttpMethod . GET , responses : [
162
+ ' 200' : [
163
+ new Response (' foo/out' , new StringDataType (), null )
164
+ ],
165
+ ' 400' : [
166
+ new Response (' foo/out' , new StringDataType (), null )
167
+ ],
168
+ ' 401' : [
169
+ new Response (' foo/out' , new StringDataType (), null )
170
+ ],
171
+ ' 403' : [
172
+ new Response (' foo/out' , new StringDataType (), null )
173
+ ]
174
+ ])
175
+
176
+ when :
177
+ writer. write (target, endpoint, endpoint. endpointResponses. first ())
178
+
179
+ then :
180
+ target. toString (). contains (' produces = {"foo/out"}' )
181
+ }
182
+
141
183
@Deprecated
142
184
private Endpoint createEndpoint (Map properties ) {
143
185
def ep = new Endpoint (
0 commit comments