1212 */
1313package org .asynchttpclient .extras .retrofit ;
1414
15+ import static org .asynchttpclient .extras .retrofit .AsyncHttpClientCall .*;
16+ import static org .mockito .Matchers .any ;
17+ import static org .mockito .Mockito .*;
18+ import static org .testng .Assert .assertTrue ;
1519import io .netty .handler .codec .http .EmptyHttpHeaders ;
16- import lombok .extern .slf4j .Slf4j ;
17- import lombok .val ;
18- import okhttp3 .Request ;
19- import org .asynchttpclient .AsyncCompletionHandler ;
20- import org .asynchttpclient .AsyncHttpClient ;
21- import org .asynchttpclient .BoundRequestBuilder ;
22- import org .asynchttpclient .Response ;
23- import org .testng .Assert ;
24- import org .testng .annotations .DataProvider ;
25- import org .testng .annotations .Test ;
2620
2721import java .io .IOException ;
2822import java .util .Arrays ;
3226import java .util .concurrent .atomic .AtomicInteger ;
3327import java .util .function .Consumer ;
3428
35- import static org .asynchttpclient .extras .retrofit .AsyncHttpClientCall .runConsumer ;
36- import static org .asynchttpclient .extras .retrofit .AsyncHttpClientCall .runConsumers ;
37- import static org .mockito .Matchers .any ;
38- import static org .mockito .Mockito .mock ;
39- import static org .mockito .Mockito .when ;
40- import static org .testng .Assert .assertTrue ;
29+ import lombok .val ;
30+ import okhttp3 .Request ;
31+
32+ import org .asynchttpclient .AsyncCompletionHandler ;
33+ import org .asynchttpclient .AsyncHttpClient ;
34+ import org .asynchttpclient .BoundRequestBuilder ;
35+ import org .asynchttpclient .Response ;
36+ import org .testng .Assert ;
37+ import org .testng .annotations .DataProvider ;
38+ import org .testng .annotations .Test ;
4139
42- @ Slf4j
4340public class AsyncHttpClientCallTest {
4441static final Request REQUEST =new Request .Builder ().url ("http://www.google.com/" ).build ();
4542
@@ -60,7 +57,7 @@ Object[][] dataProviderFirst() {
6057 }
6158
6259@ Test (dataProvider ="second" )
63- void shouldInvokeConsumersOnEachExecution (Consumer <AsyncCompletionHandler >handlerConsumer ,
60+ void shouldInvokeConsumersOnEachExecution (Consumer <AsyncCompletionHandler <?> >handlerConsumer ,
6461int expectedStarted ,
6562int expectedOk ,
6663int expectedFailed ) {
@@ -82,6 +79,7 @@ void shouldInvokeConsumersOnEachExecution(Consumer<AsyncCompletionHandler> handl
8279when (httpClient .prepareRequest ((org .asynchttpclient .RequestBuilder )any ())).thenReturn (brb );
8380
8481when (httpClient .executeRequest ((org .asynchttpclient .Request )any (),any ())).then (invocationOnMock -> {
82+ @ SuppressWarnings ("rawtypes" )
8583val handler =invocationOnMock .getArgumentAt (1 ,AsyncCompletionHandler .class );
8684handlerConsumer .accept (handler );
8785return null ;
@@ -140,15 +138,13 @@ Object[][] dataProviderSecond() {
140138when (response .getStatusText ()).thenReturn ("OK" );
141139when (response .getHeaders ()).thenReturn (EmptyHttpHeaders .INSTANCE );
142140
143- AsyncCompletionHandler x =null ;
144-
145- Consumer <AsyncCompletionHandler >okConsumer =handler -> {
141+ Consumer <AsyncCompletionHandler <?>>okConsumer =handler -> {
146142try {
147143handler .onCompleted (response );
148144 }catch (Exception e ) {
149145 }
150146 };
151- Consumer <AsyncCompletionHandler >failedConsumer =handler ->handler .onThrowable (new TimeoutException ("foo" ));
147+ Consumer <AsyncCompletionHandler <?> >failedConsumer =handler ->handler .onThrowable (new TimeoutException ("foo" ));
152148
153149return new Object [][]{
154150 {okConsumer ,1 ,1 ,0 },