24
24
class AsyncHttpResourceHelper {
25
25
26
26
@ SuppressWarnings ("unchecked" )
27
- public static ActionListener <Boolean > mockBooleanActionListener () {
27
+ static ActionListener <Boolean > mockBooleanActionListener () {
28
28
return mock (ActionListener .class );
29
29
}
30
30
31
- public static void whenPerformRequestAsyncWith (final RestClient client , final Response response ) {
31
+ static void whenPerformRequestAsyncWith (final RestClient client , final Response response ) {
32
32
doAnswer (invocation -> {
33
33
((ResponseListener )invocation .getArguments ()[1 ]).onSuccess (response );
34
34
return null ;
35
35
}).when (client ).performRequestAsync (any (Request .class ), any (ResponseListener .class ));
36
36
}
37
37
38
- public static void whenPerformRequestAsyncWith (final RestClient client , final Matcher <Request > request , final Response response ) {
38
+ static void whenPerformRequestAsyncWith (final RestClient client , final Matcher <Request > request , final Response response ) {
39
39
doAnswer (invocation -> {
40
40
((ResponseListener )invocation .getArguments ()[1 ]).onSuccess (response );
41
41
return null ;
42
42
}).when (client ).performRequestAsync (argThat (request ), any (ResponseListener .class ));
43
43
}
44
44
45
- public static void whenPerformRequestAsyncWith (final RestClient client ,
46
- final Matcher <Request > request ,
47
- final List <Response > responses ) {
45
+ static void whenPerformRequestAsyncWith (final RestClient client , final Matcher <Request > request , final List <Response > responses ) {
48
46
if (responses .size () == 1 ) {
49
47
whenPerformRequestAsyncWith (client , request , responses .get (0 ));
50
48
} else if (responses .size () > 1 ) {
51
49
whenPerformRequestAsyncWith (client , request , responses .get (0 ), responses .subList (1 , responses .size ()), null );
52
50
}
53
51
}
54
52
55
- public static void whenPerformRequestAsyncWith (final RestClient client ,
56
- final Matcher <Request > request ,
57
- final Response response ,
58
- final Exception exception ) {
53
+ static void whenPerformRequestAsyncWith (final RestClient client ,
54
+ final Matcher <Request > request ,
55
+ final Response response ,
56
+ final Exception exception ) {
59
57
whenPerformRequestAsyncWith (client , request , response , null , exception );
60
58
}
61
59
62
- public static void whenPerformRequestAsyncWith (final RestClient client ,
63
- final Matcher <Request > request ,
64
- final Response first ,
65
- final List <Response > responses ,
66
- final Exception exception ) {
60
+ static void whenPerformRequestAsyncWith (final RestClient client ,
61
+ final Matcher <Request > request ,
62
+ final Response first ,
63
+ final List <Response > responses ,
64
+ final Exception exception ) {
67
65
Stubber stub = doAnswer (invocation -> {
68
66
((ResponseListener )invocation .getArguments ()[1 ]).onSuccess (first );
69
67
return null ;
@@ -88,28 +86,28 @@ public static void whenPerformRequestAsyncWith(final RestClient client,
88
86
stub .when (client ).performRequestAsync (argThat (request ), any (ResponseListener .class ));
89
87
}
90
88
91
- public static void whenPerformRequestAsyncWith (final RestClient client , final Request request , final Response response ) {
89
+ static void whenPerformRequestAsyncWith (final RestClient client , final Request request , final Response response ) {
92
90
doAnswer (invocation -> {
93
91
((ResponseListener )invocation .getArguments ()[1 ]).onSuccess (response );
94
92
return null ;
95
93
}).when (client ).performRequestAsync (eq (request ), any (ResponseListener .class ));
96
94
}
97
95
98
- public static void whenPerformRequestAsyncWith (final RestClient client , final Exception exception ) {
96
+ static void whenPerformRequestAsyncWith (final RestClient client , final Exception exception ) {
99
97
doAnswer (invocation -> {
100
98
((ResponseListener )invocation .getArguments ()[1 ]).onFailure (exception );
101
99
return null ;
102
100
}).when (client ).performRequestAsync (any (Request .class ), any (ResponseListener .class ));
103
101
}
104
102
105
- public static void whenPerformRequestAsyncWith (final RestClient client , final Matcher <Request > request , final Exception exception ) {
103
+ static void whenPerformRequestAsyncWith (final RestClient client , final Matcher <Request > request , final Exception exception ) {
106
104
doAnswer (invocation -> {
107
105
((ResponseListener )invocation .getArguments ()[1 ]).onFailure (exception );
108
106
return null ;
109
107
}).when (client ).performRequestAsync (argThat (request ), any (ResponseListener .class ));
110
108
}
111
109
112
- public static void whenPerformRequestAsyncWith (final RestClient client , final Request request , final Exception exception ) {
110
+ static void whenPerformRequestAsyncWith (final RestClient client , final Request request , final Exception exception ) {
113
111
doAnswer (invocation -> {
114
112
((ResponseListener )invocation .getArguments ()[1 ]).onFailure (exception );
115
113
return null ;
0 commit comments