|
14 | 14 |
|
15 | 15 | package com.google.api.client.http;
|
16 | 16 |
|
17 |
| -import java.io.IOException; |
18 |
| - |
19 | 17 | import com.google.api.client.http.javanet.NetHttpTransport;
|
20 |
| - |
| 18 | +import java.io.IOException; |
21 | 19 | import junit.framework.TestCase;
|
22 | 20 |
|
23 |
| -/** |
24 |
| - * Tests {@link HttpRequestFactory}. |
25 |
| - */ |
| 21 | +/** Tests {@link HttpRequestFactory}. */ |
26 | 22 | public class HttpRequestFactoryTest extends TestCase {
|
27 | 23 |
|
28 | 24 | public void testBuildRequest_urlShouldBeSet() throws IllegalArgumentException, IOException {
|
29 | 25 | HttpRequestFactory requestFactory =
|
30 |
| - new NetHttpTransport().createRequestFactory( |
31 |
| - new HttpRequestInitializer() { |
32 |
| - @Override |
33 |
| - public void initialize(HttpRequest request) { |
34 |
| - // Url should be set by buildRequest method before calling initialize. |
35 |
| - if (request.getUrl() == null) { |
36 |
| - throw new IllegalArgumentException("url is not set in request"); |
37 |
| - } |
38 |
| - } |
39 |
| - }); |
| 26 | + new NetHttpTransport() |
| 27 | + .createRequestFactory( |
| 28 | + new HttpRequestInitializer() { |
| 29 | + @Override |
| 30 | + public void initialize(HttpRequest request) { |
| 31 | + // Url should be set by buildRequest method before calling initialize. |
| 32 | + if (request.getUrl() == null) { |
| 33 | + throw new IllegalArgumentException("url is not set in request"); |
| 34 | + } |
| 35 | + } |
| 36 | + }); |
40 | 37 | GenericUrl url = new GenericUrl("https://foo.googleapis.com/");
|
41 | 38 | HttpRequest request = requestFactory.buildRequest("GET", url, null);
|
42 | 39 | assertEquals(url, request.getUrl());
|
|
0 commit comments