@@ -71,7 +71,7 @@ public void asyncInvokeTest() throws ClientException, IOException {
7171 when (config .getSslSocketFactory ()).thenReturn (sslSocketFactory );
7272 when (config .isIgnoreSSLCerts ()).thenReturn (false );
7373 CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
74- HttpRequest request = mock ( HttpRequest . class );
74+ HttpRequest request = new HttpRequest ( "mockurl" );
7575 CallBack callback = mock (CallBack .class );
7676 client .asyncInvoke (request , callback );
7777 client .close ();
@@ -121,7 +121,7 @@ public void buildHttpConnectionNullSysUrlTest() throws Exception {
121121 when (config .isIgnoreSSLCerts ()).thenReturn (true );
122122 CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
123123 thrown .expect (IllegalArgumentException .class );
124- HttpRequest request = mock ( HttpRequest . class );
124+ HttpRequest request = new HttpRequest ( "mock url" );
125125 Whitebox .invokeMethod (client , "buildHttpConnection" , request );
126126 }
127127
@@ -133,7 +133,7 @@ public void buildHttpConnectionNullSysMethodTest() throws Exception {
133133 when (config .isIgnoreSSLCerts ()).thenReturn (true );
134134 CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
135135 thrown .expect (IllegalArgumentException .class );
136- HttpRequest request = mock ( HttpRequest . class );
136+ HttpRequest request = new HttpRequest ( "mock url" );
137137 when (request .getSysUrl ()).thenReturn ("sysUrl" );
138138 Whitebox .invokeMethod (client , "buildHttpConnection" , request );
139139 }
@@ -148,7 +148,7 @@ public void buildHttpConnectionPOSTMethodAndNullContentAndHttpsTest() throws Exc
148148 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
149149 Proxy proxy = Proxy .NO_PROXY ;
150150 PowerMockito .doReturn (proxy ).when (client , "calcProxy" , any (URL .class ), any (HttpRequest .class ));
151- HttpRequest request = mock ( HttpRequest . class );
151+ HttpRequest request = new HttpRequest ( "mock url" );
152152 when (request .getSysMethod ()).thenReturn (MethodType .POST );
153153 when (request .getSysUrl ()).thenReturn ("https://www.aliyun.com" );
154154 when (request .getSysConnectTimeout ()).thenReturn (120 );
@@ -178,7 +178,7 @@ public void buildHttpConnectionPOSTMethodAndHttpTest() throws Exception {
178178 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
179179 Proxy proxy = Proxy .NO_PROXY ;
180180 PowerMockito .doReturn (proxy ).when (client , "calcProxy" , any (URL .class ), any (HttpRequest .class ));
181- HttpRequest request = mock ( HttpRequest . class );
181+ HttpRequest request = new HttpRequest ( "mock url" );
182182 when (request .getHttpContent ()).thenReturn ("content" .getBytes ());
183183 when (request .getSysMethod ()).thenReturn (MethodType .POST );
184184 when (request .getSysUrl ()).thenReturn ("http://www.aliyun.com" );
@@ -196,7 +196,7 @@ public void buildHttpConnectionGETMethodAndHttpsTest() throws Exception {
196196 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
197197 Proxy proxy = Proxy .NO_PROXY ;
198198 PowerMockito .doReturn (proxy ).when (client , "calcProxy" , any (URL .class ), any (HttpRequest .class ));
199- HttpRequest request = mock ( HttpRequest . class );
199+ HttpRequest request = new HttpRequest ( "mock url" );
200200 when (request .getHttpContent ()).thenReturn ("content" .getBytes ());
201201 when (request .getSysMethod ()).thenReturn (MethodType .POST );
202202 when (request .getSysUrl ()).thenReturn ("https://www.aliyun.com" );
@@ -216,7 +216,7 @@ public void buildHttpConnectionGETMethodAndNullContentTest() throws Exception {
216216 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
217217 Proxy proxy = Proxy .NO_PROXY ;
218218 PowerMockito .doReturn (proxy ).when (client , "calcProxy" , any (URL .class ), any (HttpRequest .class ));
219- HttpRequest request = mock ( HttpRequest . class );
219+ HttpRequest request = new HttpRequest ( "mock url" );
220220 when (request .getHttpContent ()).thenReturn (null );
221221 when (request .getSysMethod ()).thenReturn (MethodType .GET );
222222 when (request .getSysUrl ()).thenReturn ("http://www.aliyun.com" );
@@ -271,7 +271,7 @@ public void syncInvokeIOExceptionTest() throws Exception {
271271 when (config .isIgnoreSSLCerts ()).thenReturn (true );
272272 CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
273273 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
274- HttpRequest request = mock ( HttpRequest . class );
274+ HttpRequest request = new HttpRequest ( "mock url" );
275275 HttpURLConnection connection = mock (HttpURLConnection .class );
276276 doThrow (new IOException ()).when (connection ).connect ();
277277 PowerMockito .doReturn (connection ).when (client , "buildHttpConnection" , request );
@@ -292,7 +292,7 @@ public void syncInvokeNormalAndNoneMethodAndContentIsNotEmptyTest() throws Excep
292292 when (config .isIgnoreSSLCerts ()).thenReturn (true );
293293 CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
294294 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
295- HttpRequest request = mock ( HttpRequest . class );
295+ HttpRequest request = new HttpRequest ( "mock url" );
296296 when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
297297 HttpURLConnection connection = mock (HttpURLConnection .class );
298298 doNothing ().when (connection ).connect ();
@@ -316,7 +316,7 @@ public void syncInvokeNormalAndGetMethodAndContentIsNotEmptyTest() throws Except
316316 when (config .isIgnoreSSLCerts ()).thenReturn (true );
317317 CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
318318 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
319- HttpRequest request = mock ( HttpRequest . class );
319+ HttpRequest request = new HttpRequest ( "mock url" );
320320 when (request .getSysMethod ()).thenReturn (MethodType .GET );
321321 when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
322322 HttpURLConnection connection = mock (HttpURLConnection .class );
@@ -345,7 +345,7 @@ public void syncInvokeNormalAndPostMethodAndContentIsNotEmptyTest() throws Excep
345345 when (config .isIgnoreSSLCerts ()).thenReturn (true );
346346 CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
347347 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
348- HttpRequest request = mock ( HttpRequest . class );
348+ HttpRequest request = new HttpRequest ( "mock url" );
349349 when (request .getSysMethod ()).thenReturn (MethodType .POST );
350350 when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
351351 HttpURLConnection connection = mock (HttpURLConnection .class );
@@ -373,7 +373,7 @@ public void syncInvokeNormalAndContentIsEmptyTest() throws Exception {
373373 when (config .isIgnoreSSLCerts ()).thenReturn (true );
374374 CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
375375 CompatibleUrlConnClient client = PowerMockito .spy (client0 );
376- HttpRequest request = mock ( HttpRequest . class );
376+ HttpRequest request = new HttpRequest ( "mock url" );
377377 when (request .getSysMethod ()).thenReturn (MethodType .GET );
378378 when (request .getHttpContent ()).thenReturn ("" .getBytes ());
379379 HttpURLConnection connection = mock (HttpURLConnection .class );
0 commit comments