@@ -71,7 +71,7 @@ public void asyncInvokeTest() throws ClientException, IOException {
71
71
when (config .getSslSocketFactory ()).thenReturn (sslSocketFactory );
72
72
when (config .isIgnoreSSLCerts ()).thenReturn (false );
73
73
CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
74
- HttpRequest request = mock ( HttpRequest . class );
74
+ HttpRequest request = new HttpRequest ( "mockurl" );
75
75
CallBack callback = mock (CallBack .class );
76
76
client .asyncInvoke (request , callback );
77
77
client .close ();
@@ -121,7 +121,7 @@ public void buildHttpConnectionNullSysUrlTest() throws Exception {
121
121
when (config .isIgnoreSSLCerts ()).thenReturn (true );
122
122
CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
123
123
thrown .expect (IllegalArgumentException .class );
124
- HttpRequest request = mock ( HttpRequest . class );
124
+ HttpRequest request = new HttpRequest ( "mock url" );
125
125
Whitebox .invokeMethod (client , "buildHttpConnection" , request );
126
126
}
127
127
@@ -133,7 +133,7 @@ public void buildHttpConnectionNullSysMethodTest() throws Exception {
133
133
when (config .isIgnoreSSLCerts ()).thenReturn (true );
134
134
CompatibleUrlConnClient client = new CompatibleUrlConnClient (config );
135
135
thrown .expect (IllegalArgumentException .class );
136
- HttpRequest request = mock ( HttpRequest . class );
136
+ HttpRequest request = new HttpRequest ( "mock url" );
137
137
when (request .getSysUrl ()).thenReturn ("sysUrl" );
138
138
Whitebox .invokeMethod (client , "buildHttpConnection" , request );
139
139
}
@@ -148,7 +148,7 @@ public void buildHttpConnectionPOSTMethodAndNullContentAndHttpsTest() throws Exc
148
148
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
149
149
Proxy proxy = Proxy .NO_PROXY ;
150
150
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" );
152
152
when (request .getSysMethod ()).thenReturn (MethodType .POST );
153
153
when (request .getSysUrl ()).thenReturn ("https://www.aliyun.com" );
154
154
when (request .getSysConnectTimeout ()).thenReturn (120 );
@@ -178,7 +178,7 @@ public void buildHttpConnectionPOSTMethodAndHttpTest() throws Exception {
178
178
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
179
179
Proxy proxy = Proxy .NO_PROXY ;
180
180
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" );
182
182
when (request .getHttpContent ()).thenReturn ("content" .getBytes ());
183
183
when (request .getSysMethod ()).thenReturn (MethodType .POST );
184
184
when (request .getSysUrl ()).thenReturn ("http://www.aliyun.com" );
@@ -196,7 +196,7 @@ public void buildHttpConnectionGETMethodAndHttpsTest() throws Exception {
196
196
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
197
197
Proxy proxy = Proxy .NO_PROXY ;
198
198
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" );
200
200
when (request .getHttpContent ()).thenReturn ("content" .getBytes ());
201
201
when (request .getSysMethod ()).thenReturn (MethodType .POST );
202
202
when (request .getSysUrl ()).thenReturn ("https://www.aliyun.com" );
@@ -216,7 +216,7 @@ public void buildHttpConnectionGETMethodAndNullContentTest() throws Exception {
216
216
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
217
217
Proxy proxy = Proxy .NO_PROXY ;
218
218
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" );
220
220
when (request .getHttpContent ()).thenReturn (null );
221
221
when (request .getSysMethod ()).thenReturn (MethodType .GET );
222
222
when (request .getSysUrl ()).thenReturn ("http://www.aliyun.com" );
@@ -271,7 +271,7 @@ public void syncInvokeIOExceptionTest() throws Exception {
271
271
when (config .isIgnoreSSLCerts ()).thenReturn (true );
272
272
CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
273
273
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
274
- HttpRequest request = mock ( HttpRequest . class );
274
+ HttpRequest request = new HttpRequest ( "mock url" );
275
275
HttpURLConnection connection = mock (HttpURLConnection .class );
276
276
doThrow (new IOException ()).when (connection ).connect ();
277
277
PowerMockito .doReturn (connection ).when (client , "buildHttpConnection" , request );
@@ -292,7 +292,7 @@ public void syncInvokeNormalAndNoneMethodAndContentIsNotEmptyTest() throws Excep
292
292
when (config .isIgnoreSSLCerts ()).thenReturn (true );
293
293
CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
294
294
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
295
- HttpRequest request = mock ( HttpRequest . class );
295
+ HttpRequest request = new HttpRequest ( "mock url" );
296
296
when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
297
297
HttpURLConnection connection = mock (HttpURLConnection .class );
298
298
doNothing ().when (connection ).connect ();
@@ -316,7 +316,7 @@ public void syncInvokeNormalAndGetMethodAndContentIsNotEmptyTest() throws Except
316
316
when (config .isIgnoreSSLCerts ()).thenReturn (true );
317
317
CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
318
318
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
319
- HttpRequest request = mock ( HttpRequest . class );
319
+ HttpRequest request = new HttpRequest ( "mock url" );
320
320
when (request .getSysMethod ()).thenReturn (MethodType .GET );
321
321
when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
322
322
HttpURLConnection connection = mock (HttpURLConnection .class );
@@ -345,7 +345,7 @@ public void syncInvokeNormalAndPostMethodAndContentIsNotEmptyTest() throws Excep
345
345
when (config .isIgnoreSSLCerts ()).thenReturn (true );
346
346
CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
347
347
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
348
- HttpRequest request = mock ( HttpRequest . class );
348
+ HttpRequest request = new HttpRequest ( "mock url" );
349
349
when (request .getSysMethod ()).thenReturn (MethodType .POST );
350
350
when (request .getHttpContent ()).thenReturn ("http content" .getBytes ());
351
351
HttpURLConnection connection = mock (HttpURLConnection .class );
@@ -373,7 +373,7 @@ public void syncInvokeNormalAndContentIsEmptyTest() throws Exception {
373
373
when (config .isIgnoreSSLCerts ()).thenReturn (true );
374
374
CompatibleUrlConnClient client0 = new CompatibleUrlConnClient (config );
375
375
CompatibleUrlConnClient client = PowerMockito .spy (client0 );
376
- HttpRequest request = mock ( HttpRequest . class );
376
+ HttpRequest request = new HttpRequest ( "mock url" );
377
377
when (request .getSysMethod ()).thenReturn (MethodType .GET );
378
378
when (request .getHttpContent ()).thenReturn ("" .getBytes ());
379
379
HttpURLConnection connection = mock (HttpURLConnection .class );
0 commit comments