2121import org .junit .runners .Parameterized ;
2222import org .junit .runners .Parameterized .Parameters ;
2323import org .junit .runners .Parameterized .Parameter ;
24-
2524import javax .swing .text .html .Option ;
2625import java .util .*;
27-
2826import static org .assertj .core .api .Assertions .assertThat ;
2927import static feign .error .AnnotationErrorDecoderExceptionConstructorsTest .TestClientInterfaceWithDifferentExceptionConstructors ;
3028import static feign .error .AnnotationErrorDecoderExceptionConstructorsTest .TestClientInterfaceWithDifferentExceptionConstructors .*;
@@ -37,7 +35,8 @@ public class AnnotationErrorDecoderExceptionConstructorsTest extends
3735 private static final String NO_BODY = "NO BODY" ;
3836 private static final Object NULL_BODY = null ;
3937 private static final String NON_NULL_BODY = "A GIVEN BODY" ;
40- private static final feign .Request REQUEST = feign .Request .create (feign .Request .HttpMethod .GET , "http://test" , Collections .emptyMap (), null );
38+ private static final feign .Request REQUEST = feign .Request .create (feign .Request .HttpMethod .GET ,
39+ "http://test" , Collections .emptyMap (), null );
4140 private static final feign .Request NO_REQUEST = null ;
4241 private static final Map <String , Collection <String >> NON_NULL_HEADERS =
4342 new HashMap <String , Collection <String >>();
@@ -53,44 +52,55 @@ public Class<TestClientInterfaceWithDifferentExceptionConstructors> interfaceAtT
5352 name = "{0}: When error code ({1}) on method ({2}) should return exception type ({3})" )
5453 public static Iterable <Object []> data () {
5554 return Arrays .asList (new Object [][] {
56- {"Test Default Constructor" , 500 , DefaultConstructorException .class , NO_REQUEST , NO_BODY , NO_HEADERS },
57- {"test Default Constructor" , 501 , DeclaredDefaultConstructorException .class , NO_REQUEST , NO_BODY ,
55+ {"Test Default Constructor" , 500 , DefaultConstructorException .class , NO_REQUEST , NO_BODY ,
56+ NO_HEADERS },
57+ {"test Default Constructor" , 501 , DeclaredDefaultConstructorException .class , NO_REQUEST ,
58+ NO_BODY ,
5859 NO_HEADERS },
5960 {"test Default Constructor" , 502 ,
60- DeclaredDefaultConstructorWithOtherConstructorsException .class , NO_REQUEST , NO_BODY , NO_HEADERS },
61- {"test Declared Constructor" , 503 , DefinedConstructorWithNoAnnotationForBody .class , NO_REQUEST ,
61+ DeclaredDefaultConstructorWithOtherConstructorsException .class , NO_REQUEST , NO_BODY ,
62+ NO_HEADERS },
63+ {"test Declared Constructor" , 503 , DefinedConstructorWithNoAnnotationForBody .class ,
64+ NO_REQUEST ,
6265 NON_NULL_BODY , NO_HEADERS },
6366 {"test Declared Constructor" , 504 , DefinedConstructorWithAnnotationForBody .class ,
64- NO_REQUEST , NON_NULL_BODY , NO_HEADERS },
67+ NO_REQUEST , NON_NULL_BODY , NO_HEADERS },
6568 {"test Declared Constructor" , 505 , DefinedConstructorWithAnnotationForBodyAndHeaders .class ,
66- NO_REQUEST , NON_NULL_BODY , NON_NULL_HEADERS },
69+ NO_REQUEST , NON_NULL_BODY , NON_NULL_HEADERS },
6770 {"test Declared Constructor" , 506 ,
68- DefinedConstructorWithAnnotationForBodyAndHeadersSecondOrder .class , NO_REQUEST , NON_NULL_BODY ,
71+ DefinedConstructorWithAnnotationForBodyAndHeadersSecondOrder .class , NO_REQUEST ,
72+ NON_NULL_BODY ,
6973 NON_NULL_HEADERS },
7074 {"test Declared Constructor" , 507 , DefinedConstructorWithAnnotationForHeaders .class ,
71- NO_REQUEST , NO_BODY , NON_NULL_HEADERS },
75+ NO_REQUEST , NO_BODY , NON_NULL_HEADERS },
7276 {"test Declared Constructor" , 508 ,
73- DefinedConstructorWithAnnotationForHeadersButNotForBody .class , NO_REQUEST , NON_NULL_BODY ,
77+ DefinedConstructorWithAnnotationForHeadersButNotForBody .class , NO_REQUEST ,
78+ NON_NULL_BODY ,
7479 NON_NULL_HEADERS },
7580 {"test Declared Constructor" , 509 ,
76- DefinedConstructorWithAnnotationForNonSupportedBody .class , NO_REQUEST , NULL_BODY , NO_HEADERS },
81+ DefinedConstructorWithAnnotationForNonSupportedBody .class , NO_REQUEST , NULL_BODY ,
82+ NO_HEADERS },
7783 {"test Declared Constructor" , 510 ,
78- DefinedConstructorWithAnnotationForOptionalBody .class , NO_REQUEST , Optional .of (NON_NULL_BODY ),
84+ DefinedConstructorWithAnnotationForOptionalBody .class , NO_REQUEST ,
85+ Optional .of (NON_NULL_BODY ),
7986 NO_HEADERS },
8087 {"test Declared Constructor" , 511 ,
81- DefinedConstructorWithRequest .class , REQUEST , NO_BODY ,
82- NO_HEADERS },
88+ DefinedConstructorWithRequest .class , REQUEST , NO_BODY ,
89+ NO_HEADERS },
8390 {"test Declared Constructor" , 512 ,
84- DefinedConstructorWithRequestAndResponseBody .class , REQUEST , NON_NULL_BODY ,
85- NO_HEADERS },
91+ DefinedConstructorWithRequestAndResponseBody .class , REQUEST , NON_NULL_BODY ,
92+ NO_HEADERS },
8693 {"test Declared Constructor" , 513 ,
87- DefinedConstructorWithRequestAndAnnotationForResponseBody .class , REQUEST , NON_NULL_BODY , NO_HEADERS },
94+ DefinedConstructorWithRequestAndAnnotationForResponseBody .class , REQUEST , NON_NULL_BODY ,
95+ NO_HEADERS },
8896 {"test Declared Constructor" , 514 ,
89- DefinedConstructorWithRequestAndResponseHeadersAndResponseBody .class , REQUEST , NON_NULL_BODY ,
90- NON_NULL_HEADERS },
97+ DefinedConstructorWithRequestAndResponseHeadersAndResponseBody .class , REQUEST ,
98+ NON_NULL_BODY ,
99+ NON_NULL_HEADERS },
91100 {"test Declared Constructor" , 515 ,
92- DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody .class , REQUEST , Optional .of (NON_NULL_BODY ),
93- NON_NULL_HEADERS }
101+ DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody .class , REQUEST ,
102+ Optional .of (NON_NULL_BODY ),
103+ NON_NULL_HEADERS }
94104 });
95105 }
96106
@@ -155,21 +165,25 @@ interface TestClientInterfaceWithDifferentExceptionConstructors {
155165 @ ErrorCodes (codes = {511 },
156166 generate = DefinedConstructorWithRequest .class ),
157167 @ ErrorCodes (codes = {512 },
158- generate = DefinedConstructorWithRequestAndResponseBody .class ),
168+ generate = DefinedConstructorWithRequestAndResponseBody .class ),
159169 @ ErrorCodes (codes = {513 },
160- generate = DefinedConstructorWithRequestAndAnnotationForResponseBody .class ),
170+ generate = DefinedConstructorWithRequestAndAnnotationForResponseBody .class ),
161171 @ ErrorCodes (codes = {514 },
162- generate = DefinedConstructorWithRequestAndResponseHeadersAndResponseBody .class ),
172+ generate = DefinedConstructorWithRequestAndResponseHeadersAndResponseBody .class ),
163173 @ ErrorCodes (codes = {515 },
164- generate = DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody .class )
174+ generate = DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody .class )
165175 })
166176 void method1Test ();
167177
168178 class ParametersException extends Exception {
169179 public Object body () {
170180 return NO_BODY ;
171181 }
172- public feign .Request request () { return null ; }
182+
183+ public feign .Request request () {
184+ return null ;
185+ }
186+
173187 public Map <String , Collection <String >> headers () {
174188 return null ;
175189 }
@@ -282,7 +296,8 @@ public DefinedConstructorWithRequestAndAnnotationForResponseBody() {
282296 }
283297
284298 @ FeignExceptionConstructor
285- public DefinedConstructorWithRequestAndAnnotationForResponseBody (feign .Request request , @ ResponseBody String body ) {
299+ public DefinedConstructorWithRequestAndAnnotationForResponseBody (feign .Request request ,
300+ @ ResponseBody String body ) {
286301 this .request = request ;
287302 this .body = body ;
288303 }
@@ -302,7 +317,8 @@ public String body() {
302317 }
303318 }
304319
305- class DefinedConstructorWithRequestAndResponseHeadersAndResponseBody extends ParametersException {
320+ class DefinedConstructorWithRequestAndResponseHeadersAndResponseBody
321+ extends ParametersException {
306322 feign .Request request ;
307323 String body ;
308324 Map headers ;
@@ -313,8 +329,8 @@ public DefinedConstructorWithRequestAndResponseHeadersAndResponseBody() {
313329
314330 @ FeignExceptionConstructor
315331 public DefinedConstructorWithRequestAndResponseHeadersAndResponseBody (feign .Request request ,
316- @ ResponseHeaders Map headers ,
317- @ ResponseBody String body ) {
332+ @ ResponseHeaders Map headers ,
333+ @ ResponseBody String body ) {
318334 this .request = request ;
319335 this .body = body ;
320336 this .headers = headers ;
@@ -340,7 +356,8 @@ public String body() {
340356 }
341357 }
342358
343- class DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody extends ParametersException {
359+ class DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody
360+ extends ParametersException {
344361 feign .Request request ;
345362 Optional <String > body ;
346363 Map headers ;
@@ -350,15 +367,17 @@ public DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody()
350367 }
351368
352369 @ FeignExceptionConstructor
353- public DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody (feign .Request request ,
354- @ ResponseHeaders Map headers ,
355- @ ResponseBody Optional <String > body ) {
370+ public DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody (
371+ feign .Request request ,
372+ @ ResponseHeaders Map headers ,
373+ @ ResponseBody Optional <String > body ) {
356374 this .request = request ;
357375 this .body = body ;
358376 this .headers = headers ;
359377 }
360378
361- public DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody (TestPojo testPojo ) {
379+ public DefinedConstructorWithRequestAndResponseHeadersAndOptionalResponseBody (
380+ TestPojo testPojo ) {
362381 throw new UnsupportedOperationException ("Should not be called" );
363382 }
364383
0 commit comments