Skip to content

Commit 622da70

Browse files
committed
minor fix
1 parent fe0d1c0 commit 622da70

3 files changed

Lines changed: 28 additions & 27 deletions

File tree

‎core-java/.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
*.ear
1414

1515
# Files generated by integration tests
16-
*.txt
16+
#*.txt
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World from fileTest.txt!!!

‎core-java/src/test/java/com/baeldung/java/networking/url/UrlTest.java‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,93 +11,93 @@ public class UrlTest {
1111

1212
@Test
1313
public void givenUrl_whenCanIdentifyProtocol_thenCorrect() throws MalformedURLException {
14-
URL url = new URL("http://baeldung.com");
14+
final URL url = new URL("http://baeldung.com");
1515
assertEquals("http", url.getProtocol());
1616
}
1717

1818
@Test
1919
public void givenUrl_whenCanGetHost_thenCorrect() throws MalformedURLException {
20-
URL url = new URL("http://baeldung.com");
20+
final URL url = new URL("http://baeldung.com");
2121
assertEquals("baeldung.com", url.getHost());
2222
}
2323

2424
@Test
2525
public void givenUrl_whenCanGetFileName_thenCorrect2() throws MalformedURLException {
26-
URL url = new URL("http://baeldung.com/articles?topic=java&version=8");
26+
final URL url = new URL("http://baeldung.com/articles?topic=java&version=8");
2727
assertEquals("/articles?topic=java&version=8", url.getFile());
2828
}
2929

3030
@Test
3131
public void givenUrl_whenCanGetFileName_thenCorrect1() throws MalformedURLException {
32-
URL url = new URL("http://baeldung.com/guidelines.txt");
32+
final URL url = new URL("http://baeldung.com/guidelines.txt");
3333
assertEquals("/guidelines.txt", url.getFile());
3434
}
3535

3636
@Test
3737
public void givenUrl_whenCanGetPathParams_thenCorrect() throws MalformedURLException {
38-
URL url = new URL("http://baeldung.com/articles?topic=java&version=8");
38+
final URL url = new URL("http://baeldung.com/articles?topic=java&version=8");
3939
assertEquals("/articles", url.getPath());
4040
}
4141

4242
@Test
4343
public void givenUrl_whenCanGetQueryParams_thenCorrect() throws MalformedURLException {
44-
URL url = new URL("http://baeldung.com/articles?topic=java");
44+
final URL url = new URL("http://baeldung.com/articles?topic=java");
4545
assertEquals("topic=java", url.getQuery());
4646
}
4747

4848
@Test
4949
public void givenUrl_whenGetsDefaultPort_thenCorrect() throws MalformedURLException {
50-
URL url = new URL("http://baeldung.com");
50+
final URL url = new URL("http://baeldung.com");
5151
assertEquals(-1, url.getPort());
5252
assertEquals(80, url.getDefaultPort());
5353
}
5454

5555
@Test
5656
public void givenUrl_whenGetsPort_thenCorrect() throws MalformedURLException {
57-
URL url = new URL("http://baeldung.com:8090");
57+
final URL url = new URL("http://baeldung.com:8090");
5858
assertEquals(8090, url.getPort());
5959
assertEquals(80, url.getDefaultPort());
6060
}
6161

6262
@Test
6363
public void givenBaseUrl_whenCreatesRelativeUrl_thenCorrect() throws MalformedURLException {
64-
URL baseUrl = new URL("http://baeldung.com");
65-
URL relativeUrl = new URL(baseUrl, "a-guide-to-java-sockets");
64+
final URL baseUrl = new URL("http://baeldung.com");
65+
final URL relativeUrl = new URL(baseUrl, "a-guide-to-java-sockets");
6666
assertEquals("http://baeldung.com/a-guide-to-java-sockets", relativeUrl.toString());
6767
}
6868

6969
@Test
7070
public void givenAbsoluteUrl_whenIgnoresBaseUrl_thenCorrect() throws MalformedURLException {
71-
URL baseUrl = new URL("http://baeldung.com");
72-
URL relativeUrl = new URL(baseUrl, "http://baeldung.com/a-guide-to-java-sockets");
71+
final URL baseUrl = new URL("http://baeldung.com");
72+
final URL relativeUrl = new URL(baseUrl, "http://baeldung.com/a-guide-to-java-sockets");
7373
assertEquals("http://baeldung.com/a-guide-to-java-sockets", relativeUrl.toString());
7474
}
7575

7676
@Test
7777
public void givenUrlComponents_whenConstructsCompleteUrl_thenCorrect() throws MalformedURLException {
78-
String protocol = "http";
79-
String host = "baeldung.com";
80-
String file = "/guidelines.txt";
81-
URL url = new URL(protocol, host, file);
78+
final String protocol = "http";
79+
final String host = "baeldung.com";
80+
final String file = "/guidelines.txt";
81+
final URL url = new URL(protocol, host, file);
8282
assertEquals("http://baeldung.com/guidelines.txt", url.toString());
8383
}
8484

8585
@Test
8686
public void givenUrlComponents_whenConstructsCompleteUrl_thenCorrect2() throws MalformedURLException {
87-
String protocol = "http";
88-
String host = "baeldung.com";
89-
String file = "/articles?topic=java&version=8";
90-
URL url = new URL(protocol, host, file);
91-
assertEquals("http://baeldung.com/guidelines.txt", url.toString());
87+
final String protocol = "http";
88+
final String host = "baeldung.com";
89+
final String file = "/articles?topic=java&version=8";
90+
final URL url = new URL(protocol, host, file);
91+
assertEquals("http://baeldung.com/articles?topic=java&version=8", url.toString());
9292
}
9393

9494
@Test
9595
public void givenUrlComponentsWithPort_whenConstructsCompleteUrl_thenCorrect() throws MalformedURLException {
96-
String protocol = "http";
97-
String host = "baeldung.com";
98-
int port = 9000;
99-
String file = "/guidelines.txt";
100-
URL url = new URL(protocol, host, port, file);
96+
final String protocol = "http";
97+
final String host = "baeldung.com";
98+
final int port = 9000;
99+
final String file = "/guidelines.txt";
100+
final URL url = new URL(protocol, host, port, file);
101101
assertEquals("http://baeldung.com:9000/guidelines.txt", url.toString());
102102
}
103103

0 commit comments

Comments
 (0)