@@ -124,7 +124,6 @@ public static Iterable<Object[]> data() {
124124
125125 @ Test
126126 public void test () throws Exception {
127-
128127 AnnotationErrorDecoder decoder = AnnotationErrorDecoder
129128 .builderFor (TestClientInterfaceWithDifferentExceptionConstructors .class )
130129 .withResponseBodyDecoder (new OptionalDecoder (new Decoder .Default ()))
@@ -133,13 +132,26 @@ public void test() throws Exception {
133132 Exception genericException = decoder .decode (feignConfigKey ("method1Test" ),
134133 testResponse (errorCode , NON_NULL_BODY , NON_NULL_HEADERS ));
135134
136- assertThat (genericException . getClass ()). isEqualTo (expectedExceptionClass );
135+ assertThat (genericException ). isInstanceOf (expectedExceptionClass );
137136
138137 ParametersException exception = (ParametersException ) genericException ;
139138 assertThat (exception .body ()).isEqualTo (expectedBody );
140139 assertThat (exception .headers ()).isEqualTo (expectedHeaders );
140+ }
141+
142+ @ Test
143+ public void testIfExceptionIsNotInTheList () throws Exception {
144+ AnnotationErrorDecoder decoder = AnnotationErrorDecoder
145+ .builderFor (TestClientInterfaceWithDifferentExceptionConstructors .class )
146+ .withResponseBodyDecoder (new OptionalDecoder (new Decoder .Default ()))
147+ .build ();
141148
149+ Exception genericException = decoder .decode (feignConfigKey ("method1Test" ),
150+ testResponse (-1 , NON_NULL_BODY , NON_NULL_HEADERS ));
142151
152+ assertThat (genericException )
153+ .isInstanceOf (ErrorHandling .NO_DEFAULT .class )
154+ .hasMessage ("Endpoint responded with -1, reason: null" );
143155 }
144156
145157 interface TestClientInterfaceWithDifferentExceptionConstructors {
0 commit comments