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() {
178
178
179
179
public void test_does_handle_auth_failure () {
180
180
JsonServiceClient techStacksClient = new JsonServiceClient ("http://techstacks.io/" );
181
- String errorCode = "" ;
181
+ int errorCode = 0 ;
182
182
try {
183
183
dto .LockTechStack request = new dto .LockTechStack ();
184
184
request .setTechnologyStackId ((long )6 );
185
185
dto .LockStackResponse res = techStacksClient .post (request );
186
+ fail ("Should throw" );
186
187
} catch (WebServiceException ex ) {
187
188
//private StatusCode has correct code, response status is null due to empty response body.
188
- errorCode = ex .getResponseStatus (). errorCode ;
189
+ errorCode = ex .getStatusCode () ;
189
190
}
190
- assertEquals (errorCode ," 401" );
191
+ assertEquals (errorCode ,401 );
191
192
}
192
193
193
194
/* TEST HELPERS */
Original file line number Diff line number Diff line change 10
10
11
11
import org .apache .http .util .ByteArrayBuffer ;
12
12
13
-
14
13
import java .io .BufferedInputStream ;
15
14
import java .io .BufferedReader ;
16
15
import java .io .IOException ;
27
26
import java .util .Calendar ;
28
27
import java .util .Date ;
29
28
import java .util .HashMap ;
30
- import java .util .Iterator ;
31
29
import java .util .List ;
32
30
import java .util .Map ;
33
31
import java .util .UUID ;
34
32
35
- import static net .servicestack .client .Func .*;
33
+ import static net .servicestack .client .Func .Function ;
34
+ import static net .servicestack .client .Func .last ;
36
35
37
36
// Generic Utils
38
37
public class Utils {
Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ public String getServerStackTrace(){
39
39
return ResponseStatus != null ? ResponseStatus .stackTrace : null ;
40
40
}
41
41
42
+ public int getStatusCode () {
43
+ return this .StatusCode ;
44
+ }
45
+
46
+ public String getStatusDescription () {
47
+ return this .StatusDescription ;
48
+ }
49
+
42
50
public ArrayList <ResponseError > getFieldErrors (){
43
51
ArrayList <ResponseError > fieldErrors = ResponseStatus != null
44
52
? ResponseStatus .getErrors ()
You can’t perform that action at this time.
0 commit comments