File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
httprpc-test/src/test/java/org/httprpc Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 4242import static org .junit .jupiter .api .Assertions .assertEquals ;
4343import static org .junit .jupiter .api .Assertions .assertNotNull ;
4444import static org .junit .jupiter .api .Assertions .assertNull ;
45+ import static org .junit .jupiter .api .Assertions .assertThrows ;
4546import static org .junit .jupiter .api .Assertions .assertTrue ;
4647
4748public class WebServiceProxyTest {
@@ -172,6 +173,9 @@ enum Size {
172173 }
173174 }
174175
176+ public static class CustomException extends IOException {
177+ }
178+
175179 private URL serverURL ;
176180
177181 private DayOfWeek dayOfWeek = DayOfWeek .MONDAY ;
@@ -466,8 +470,14 @@ public void testError() throws IOException {
466470 }
467471
468472 @ Test
469- public void testCustomErrorHandler () throws IOException {
470- // TODO
473+ public void testCustomException () throws IOException {
474+ WebServiceProxy webServiceProxy = new WebServiceProxy ("GET" , new URL (serverURL , "test/error" ));
475+
476+ webServiceProxy .setErrorHandler ((errorStream , contentType , statusCode ) -> {
477+ throw new CustomException ();
478+ });
479+
480+ assertThrows (CustomException .class , webServiceProxy ::invoke );
471481 }
472482
473483 @ Test
You can’t perform that action at this time.
0 commit comments