|
8 | 8 | import java.util.List; |
9 | 9 |
|
10 | 10 | import org.apache.http.HttpHost; |
11 | | -import org.junit.BeforeClass; |
12 | | -import org.junit.Test; |
| 11 | +import org.junit.jupiter.api.BeforeAll; |
| 12 | +import org.junit.jupiter.api.Test; |
13 | 13 |
|
14 | 14 | /** |
15 | 15 | * @author yxssfxwzy@sina.com May 30, 2014 |
16 | | - * |
| 16 | + * |
17 | 17 | */ |
18 | 18 | public class ProxyTest { |
19 | 19 |
|
20 | 20 | private static List<String[]> httpProxyList = new ArrayList<String[]>(); |
21 | 21 |
|
22 | | - @BeforeClass |
| 22 | + @BeforeAll |
23 | 23 | public static void before() { |
24 | 24 | // String[] source = { "0.0.0.1:0", "0.0.0.2:0", "0.0.0.3:0", |
25 | 25 | // "0.0.0.4:0" }; |
@@ -48,7 +48,7 @@ public void run() { |
48 | 48 | } |
49 | 49 |
|
50 | 50 | @Test |
51 | | - public void testCreate() { |
| 51 | + void testCreate() { |
52 | 52 | Proxy proxy = Proxy.create(URI.create("//127.0.0.1:8080")); |
53 | 53 | assertNull(proxy.getScheme()); |
54 | 54 | assertNull(proxy.getUsername()); |
@@ -86,7 +86,15 @@ public void testCreate() { |
86 | 86 | } |
87 | 87 |
|
88 | 88 | @Test |
89 | | - public void testToString() { |
| 89 | + void testEqualsHashCode() { |
| 90 | + var proxy0 = new Proxy("::1", 1080); |
| 91 | + var proxy1 = new Proxy("::1", 1080); |
| 92 | + assertEquals(proxy0, proxy1); |
| 93 | + assertEquals(proxy0.hashCode(), proxy1.hashCode()); |
| 94 | + } |
| 95 | + |
| 96 | + @Test |
| 97 | + void testToString() { |
90 | 98 | assertEquals("//127.0.0.1:8080", new Proxy("127.0.0.1", 8080).toString()); |
91 | 99 | assertEquals("http://127.0.0.1:8080", new Proxy("127.0.0.1", 8080, "http").toString()); |
92 | 100 | assertEquals("//username:password@127.0.0.1:8080", new Proxy("127.0.0.1", 8080, "username", "password").toString()); |
|
0 commit comments