File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed
src/AndroidClient/client/src
androidTest/java/net/servicestack/client/tests
main/java/net/servicestack/client Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -178,16 +178,17 @@ public void test_Can_POST_valid_ThrowValidation_request() {
178178
179179 public void test_does_handle_auth_failure () {
180180 JsonServiceClient techStacksClient = new JsonServiceClient ("http://techstacks.io/" );
181- String errorCode = "" ;
181+ int errorCode = 0 ;
182182 try {
183183 dto .LockTechStack request = new dto .LockTechStack ();
184184 request .setTechnologyStackId ((long )6 );
185185 dto .LockStackResponse res = techStacksClient .post (request );
186+ fail ("Should throw" );
186187 } catch (WebServiceException ex ) {
187188 //private StatusCode has correct code, response status is null due to empty response body.
188- errorCode = ex .getResponseStatus (). errorCode ;
189+ errorCode = ex .getStatusCode () ;
189190 }
190- assertEquals (errorCode ," 401" );
191+ assertEquals (errorCode ,401 );
191192 }
192193
193194 /* TEST HELPERS */
Original file line number Diff line number Diff line change 1010
1111import org .apache .http .util .ByteArrayBuffer ;
1212
13-
1413import java .io .BufferedInputStream ;
1514import java .io .BufferedReader ;
1615import java .io .IOException ;
2726import java .util .Calendar ;
2827import java .util .Date ;
2928import java .util .HashMap ;
30- import java .util .Iterator ;
3129import java .util .List ;
3230import java .util .Map ;
3331import java .util .UUID ;
3432
35- import static net .servicestack .client .Func .*;
33+ import static net .servicestack .client .Func .Function ;
34+ import static net .servicestack .client .Func .last ;
3635
3736// Generic Utils
3837public class Utils {
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ public String getServerStackTrace(){
3939 return ResponseStatus != null ? ResponseStatus .stackTrace : null ;
4040 }
4141
42+ public int getStatusCode () {
43+ return this .StatusCode ;
44+ }
45+
46+ public String getStatusDescription () {
47+ return this .StatusDescription ;
48+ }
49+
4250 public ArrayList <ResponseError > getFieldErrors (){
4351 ArrayList <ResponseError > fieldErrors = ResponseStatus != null
4452 ? ResponseStatus .getErrors ()
You can’t perform that action at this time.
0 commit comments