Skip to content

Commit 7225bc8

Browse files
committed
Remove public modifiers from test classes and methods
Following JUnit 5 best practices, removed unnecessary public modifiers from: - Test class declaration in ScanTargetTest - All 16 test methods in ScanTargetTest ControllerTest already had proper visibility modifiers. This improves code clarity by using package-private visibility where appropriate.
1 parent fcae00a commit 7225bc8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/test/java/de/rub/nds/crawler/data/ScanTargetTest.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
import org.apache.commons.lang3.tuple.Pair;
1515
import org.junit.jupiter.api.Test;
1616

17-
public class ScanTargetTest {
17+
class ScanTargetTest {
1818

1919
@Test
20-
public void testIPv4WithPort() {
20+
void testIPv4WithPort() {
2121
Pair<ScanTarget, JobStatus> result =
2222
ScanTarget.fromTargetString("192.168.1.1:8080", 443, null);
2323
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -27,7 +27,7 @@ public void testIPv4WithPort() {
2727
}
2828

2929
@Test
30-
public void testIPv4WithoutPort() {
30+
void testIPv4WithoutPort() {
3131
Pair<ScanTarget, JobStatus> result = ScanTarget.fromTargetString("192.168.1.1", 443, null);
3232
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
3333
assertEquals("192.168.1.1", result.getLeft().getIp());
@@ -36,7 +36,7 @@ public void testIPv4WithoutPort() {
3636
}
3737

3838
@Test
39-
public void testIPv6WithPort() {
39+
void testIPv6WithPort() {
4040
Pair<ScanTarget, JobStatus> result =
4141
ScanTarget.fromTargetString("[2001:db8::1]:8080", 443, null);
4242
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -46,7 +46,7 @@ public void testIPv6WithPort() {
4646
}
4747

4848
@Test
49-
public void testIPv6WithoutPort() {
49+
void testIPv6WithoutPort() {
5050
Pair<ScanTarget, JobStatus> result = ScanTarget.fromTargetString("2001:db8::1", 443, null);
5151
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
5252
assertEquals("2001:db8::1", result.getLeft().getIp());
@@ -55,7 +55,7 @@ public void testIPv6WithoutPort() {
5555
}
5656

5757
@Test
58-
public void testIPv6FullAddressWithPort() {
58+
void testIPv6FullAddressWithPort() {
5959
Pair<ScanTarget, JobStatus> result =
6060
ScanTarget.fromTargetString(
6161
"[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8443", 443, null);
@@ -66,7 +66,7 @@ public void testIPv6FullAddressWithPort() {
6666
}
6767

6868
@Test
69-
public void testIPv6CompressedAddress() {
69+
void testIPv6CompressedAddress() {
7070
Pair<ScanTarget, JobStatus> result = ScanTarget.fromTargetString("::1", 443, null);
7171
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
7272
assertEquals("::1", result.getLeft().getIp());
@@ -75,7 +75,7 @@ public void testIPv6CompressedAddress() {
7575
}
7676

7777
@Test
78-
public void testHostnameWithPort() {
78+
void testHostnameWithPort() {
7979
Pair<ScanTarget, JobStatus> result =
8080
ScanTarget.fromTargetString("example.com:8080", 443, null);
8181
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -86,7 +86,7 @@ public void testHostnameWithPort() {
8686
}
8787

8888
@Test
89-
public void testHostnameWithoutPort() {
89+
void testHostnameWithoutPort() {
9090
Pair<ScanTarget, JobStatus> result = ScanTarget.fromTargetString("example.com", 443, null);
9191
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
9292
assertEquals("example.com", result.getLeft().getHostname());
@@ -95,7 +95,7 @@ public void testHostnameWithoutPort() {
9595
}
9696

9797
@Test
98-
public void testInvalidPortRangeHigh() {
98+
void testInvalidPortRangeHigh() {
9999
Pair<ScanTarget, JobStatus> result =
100100
ScanTarget.fromTargetString("192.168.1.1:70000", 443, null);
101101
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -104,7 +104,7 @@ public void testInvalidPortRangeHigh() {
104104
}
105105

106106
@Test
107-
public void testInvalidPortRangeLow() {
107+
void testInvalidPortRangeLow() {
108108
Pair<ScanTarget, JobStatus> result =
109109
ScanTarget.fromTargetString("192.168.1.1:0", 443, null);
110110
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -113,7 +113,7 @@ public void testInvalidPortRangeLow() {
113113
}
114114

115115
@Test
116-
public void testInvalidPortFormat() {
116+
void testInvalidPortFormat() {
117117
Pair<ScanTarget, JobStatus> result =
118118
ScanTarget.fromTargetString("[2001:db8::1]:abc", 443, null);
119119
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -122,7 +122,7 @@ public void testInvalidPortFormat() {
122122
}
123123

124124
@Test
125-
public void testTrancoRankWithIPv4() {
125+
void testTrancoRankWithIPv4() {
126126
Pair<ScanTarget, JobStatus> result =
127127
ScanTarget.fromTargetString("100,192.168.1.1:8080", 443, null);
128128
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -132,7 +132,7 @@ public void testTrancoRankWithIPv4() {
132132
}
133133

134134
@Test
135-
public void testTrancoRankWithIPv6() {
135+
void testTrancoRankWithIPv6() {
136136
Pair<ScanTarget, JobStatus> result =
137137
ScanTarget.fromTargetString("200,[2001:db8::1]:8080", 443, null);
138138
assertEquals(JobStatus.TO_BE_EXECUTED, result.getRight());
@@ -142,7 +142,7 @@ public void testTrancoRankWithIPv6() {
142142
}
143143

144144
@Test
145-
public void testUnknownHost() {
145+
void testUnknownHost() {
146146
Pair<ScanTarget, JobStatus> result =
147147
ScanTarget.fromTargetString("this-host-should-not-exist-12345.com", 443, null);
148148
assertEquals(JobStatus.UNRESOLVABLE, result.getRight());
@@ -151,7 +151,7 @@ public void testUnknownHost() {
151151
}
152152

153153
@Test
154-
public void testMalformedIPv6Bracket() {
154+
void testMalformedIPv6Bracket() {
155155
// Missing closing bracket - should result in UNRESOLVABLE
156156
Pair<ScanTarget, JobStatus> result =
157157
ScanTarget.fromTargetString("[2001:db8::1:8080", 443, null);

0 commit comments

Comments
 (0)