File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
main/java/com/xero/api/exception
test/java/com/xero/api/exception Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ public XeroApiException handleBadRequest(HttpResponseException httpResponseExcep
80
80
return convertException (httpResponseException );
81
81
}
82
82
} else {
83
- return convertException (httpResponseException );
83
+ return newApiException (httpResponseException );
84
84
}
85
85
}
86
86
Original file line number Diff line number Diff line change 13
13
import org .mockito .Mock ;
14
14
import org .mockito .junit .MockitoJUnitRunner ;
15
15
16
- import static org .junit .Assert .assertFalse ;
17
- import static org .junit .Assert .assertNotNull ;
18
- import static org .junit .Assert .assertTrue ;
16
+ import static org .junit .Assert .*;
19
17
import static org .mockito .Mockito .when ;
20
18
21
19
@ RunWith (MockitoJUnitRunner .class )
@@ -67,6 +65,17 @@ public void handleOAuthErrorRequest() throws Exception {
67
65
assertNotNull (xeroApiException .getMessage ());
68
66
}
69
67
68
+ @ Test
69
+ public void handleOtherErrorRequest () throws Exception {
70
+ when (httpResponseException .getContent ()).thenReturn ("dummy" );
71
+ when (httpResponseException .getStatusCode ()).thenReturn (400 );
72
+ XeroApiException xeroApiException = xeroExceptionHandler .handleBadRequest (httpResponseException );
73
+ assertNotNull (xeroApiException );
74
+ assertNotNull (xeroApiException .getMessages ());
75
+ assertNotNull (xeroApiException .getMessage ());
76
+ assertEquals (xeroApiException .getResponseCode (), 400 );
77
+ }
78
+
70
79
/**
71
80
* sample oauth exception
72
81
* @return oauth exception
You can’t perform that action at this time.
0 commit comments