Skip to content

Commit 8bfccb2

Browse files
committed
Use JUnit 5 convention for @test method visibility
1 parent b009002 commit 8bfccb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+325
-325
lines changed

src/test/java/org/apache/commons/cli/AbstractParserTestCase.java

Lines changed: 66 additions & 66 deletions
Large diffs are not rendered by default.

src/test/java/org/apache/commons/cli/AlreadySelectedExceptionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2929
public class AlreadySelectedExceptionTest {
3030

3131
@Test
32-
public void testConstructor() {
32+
void testConstructor() {
3333
assertEquals("a", new AlreadySelectedException("a").getMessage());
3434
assertNull(new AlreadySelectedException("a").getOption());
3535
final Option option = new Option("a", "d");

src/test/java/org/apache/commons/cli/ApplicationTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class ApplicationTest {
4444
* Ant test
4545
*/
4646
@Test
47-
public void testAnt() throws Exception {
47+
void testAnt() throws Exception {
4848
// use the GNU parser
4949
final CommandLineParser parser = new GnuParser();
5050
final Options options = new Options();
@@ -86,7 +86,7 @@ public void testAnt() throws Exception {
8686
}
8787

8888
@Test
89-
public void testGroovy() throws Exception {
89+
void testGroovy() throws Exception {
9090
final Options options = new Options();
9191

9292
//@formatter:off
@@ -156,7 +156,7 @@ public void testGroovy() throws Exception {
156156
}
157157

158158
@Test
159-
public void testLs() throws Exception {
159+
void testLs() throws Exception {
160160
// create the command line parser
161161
final CommandLineParser parser = new PosixParser();
162162
final Options options = new Options();
@@ -186,7 +186,7 @@ public void testLs() throws Exception {
186186
* author Slawek Zachcial
187187
*/
188188
@Test
189-
public void testMan() {
189+
void testMan() {
190190
final String cmdLine = "man [-c|-f|-k|-w|-tZT device] [-adlhu7V] [-Mpath] [-Ppager] [-Slist] [-msystem] [-pstring] [-Llocale] [-eextension] [section]"
191191
+ " page ...";
192192
//@formatter:off
@@ -279,7 +279,7 @@ public void testMan() {
279279
* Real world test with long and short options.
280280
*/
281281
@Test
282-
public void testNLT() throws Exception {
282+
void testNLT() throws Exception {
283283
final Option help = new Option("h", "help", false, "print this message");
284284
final Option version = new Option("v", "version", false, "print version information");
285285
final Option newRun = new Option("n", "new", false, "Create NLT cache entries only for new items");

src/test/java/org/apache/commons/cli/ArgumentIsOptionTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void setUp() {
3737
}
3838

3939
@Test
40-
public void testOption() throws Exception {
40+
void testOption() throws Exception {
4141
final String[] args = {"-p"};
4242

4343
final CommandLine cl = parser.parse(options, args);
@@ -47,7 +47,7 @@ public void testOption() throws Exception {
4747
}
4848

4949
@Test
50-
public void testOptionAndOptionWithArgument() throws Exception {
50+
void testOptionAndOptionWithArgument() throws Exception {
5151
final String[] args = {"-p", "-attr", "p"};
5252

5353
final CommandLine cl = parser.parse(options, args);
@@ -58,7 +58,7 @@ public void testOptionAndOptionWithArgument() throws Exception {
5858
}
5959

6060
@Test
61-
public void testOptionWithArgument() throws Exception {
61+
void testOptionWithArgument() throws Exception {
6262
final String[] args = {"-attr", "p"};
6363

6464
final CommandLine cl = parser.parse(options, args);

src/test/java/org/apache/commons/cli/CommandLineTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void checkHandler(final boolean optDep, final List<Option> handler, final Option
231231
}
232232

233233
@Test
234-
public void testBadGetParsedOptionValue() throws Exception {
234+
void testBadGetParsedOptionValue() throws Exception {
235235

236236
final Options options = new Options();
237237
options.addOption(Option.builder("i").hasArg().type(Number.class).build());
@@ -245,7 +245,7 @@ public void testBadGetParsedOptionValue() throws Exception {
245245
}
246246

247247
@Test
248-
public void testBuilderBuild() {
248+
void testBuilderBuild() {
249249
// @formatter:off
250250
final CommandLine cmd = CommandLine.builder()
251251
.addArg("foo")
@@ -259,7 +259,7 @@ public void testBuilderBuild() {
259259
}
260260

261261
@Test
262-
public void testBuilderGet() {
262+
void testBuilderGet() {
263263
// @formatter:off
264264
final CommandLine cmd = CommandLine.builder()
265265
.addArg("foo")
@@ -273,7 +273,7 @@ public void testBuilderGet() {
273273
}
274274

275275
@Test
276-
public void testBuilderNullArgs() {
276+
void testBuilderNullArgs() {
277277
final CommandLine.Builder builder = CommandLine.builder();
278278
builder.addArg(null).addArg(null);
279279
builder.addOption(Option.builder("T").build());
@@ -284,7 +284,7 @@ public void testBuilderNullArgs() {
284284
}
285285

286286
@Test
287-
public void testBuilderNullOption() {
287+
void testBuilderNullOption() {
288288
final CommandLine.Builder builder = CommandLine.builder();
289289
builder.addArg("foo").addArg("bar");
290290
builder.addOption(null);
@@ -298,7 +298,7 @@ public void testBuilderNullOption() {
298298
}
299299

300300
@Test
301-
public void testGetOptionProperties() throws Exception {
301+
void testGetOptionProperties() throws Exception {
302302
final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
303303

304304
final Options options = new Options();
@@ -320,7 +320,7 @@ public void testGetOptionProperties() throws Exception {
320320
}
321321

322322
@Test
323-
public void testGetOptionPropertiesWithOption() throws Exception {
323+
void testGetOptionPropertiesWithOption() throws Exception {
324324
final String[] args = {"-Dparam1=value1", "-Dparam2=value2", "-Dparam3", "-Dparam4=value4", "-D", "--property", "foo=bar"};
325325

326326
final Options options = new Options();
@@ -344,7 +344,7 @@ public void testGetOptionPropertiesWithOption() throws Exception {
344344
}
345345

346346
@Test
347-
public void testGetOptionsBuilder() {
347+
void testGetOptionsBuilder() {
348348
final CommandLine cmd = CommandLine.builder().build();
349349
assertNotNull(cmd.getOptions());
350350
assertEquals(0, cmd.getOptions().length);
@@ -358,7 +358,7 @@ public void testGetOptionsBuilder() {
358358
}
359359

360360
@Test
361-
public void testGetOptionsCtor() {
361+
void testGetOptionsCtor() {
362362
final CommandLine cmd = new CommandLine();
363363
assertNotNull(cmd.getOptions());
364364
assertEquals(0, cmd.getOptions().length);
@@ -1006,7 +1006,7 @@ public void testNoDeprecationHandler(final String[] args, final Option opt, fina
10061006
}
10071007

10081008
@Test
1009-
public void testNullOption() throws Exception {
1009+
void testNullOption() throws Exception {
10101010
final Options options = new Options();
10111011
final Option optI = Option.builder("i").hasArg().type(Number.class).build();
10121012
final Option optF = Option.builder("f").hasArg().build();

src/test/java/org/apache/commons/cli/ConverterTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static Stream<Arguments> numberTestParameters() {
6161
}
6262

6363
@Test
64-
public void testClass() throws Exception {
64+
void testClass() throws Exception {
6565

6666
assertNotNull(Converter.CLASS.apply(this.getClass().getName()), this.getClass().getName());
6767
assertNotNull(Converter.CLASS.apply(this.getClass().getCanonicalName()), this.getClass().getCanonicalName());
@@ -74,7 +74,7 @@ public void testClass() throws Exception {
7474
}
7575

7676
@Test
77-
public void testDate() throws Exception {
77+
void testDate() throws Exception {
7878
assertThrows(java.text.ParseException.class, () -> Converter.DATE.apply("whatever"));
7979

8080
/*
@@ -92,7 +92,7 @@ public void testDate() throws Exception {
9292
}
9393

9494
@Test
95-
public void testFile() throws Exception {
95+
void testFile() throws Exception {
9696
final URL url = this.getClass().getClassLoader().getResource("./org/apache/commons/cli/existing-readable.file");
9797
final String fileName = url.toString().substring("file:".length());
9898
assertNotNull(Converter.FILE.apply(fileName));
@@ -109,7 +109,7 @@ public void testNumber(final String str, final Number expected) throws Exception
109109
}
110110

111111
@Test
112-
public void testObject() throws Exception {
112+
void testObject() throws Exception {
113113
assertNotNull(Converter.OBJECT.apply(this.getClass().getName()), this.getClass().getName());
114114
assertNotNull(Converter.OBJECT.apply(this.getClass().getCanonicalName()), this.getClass().getCanonicalName());
115115
assertThrows(ClassNotFoundException.class, () -> Converter.OBJECT.apply(this.getClass().getSimpleName()),
@@ -121,7 +121,7 @@ public void testObject() throws Exception {
121121
}
122122

123123
@Test
124-
public void testUrl() throws Exception {
124+
void testUrl() throws Exception {
125125
assertEquals(new URL("http://apache.org"), Converter.URL.apply("http://apache.org"));
126126
assertThrows(java.net.MalformedURLException.class, () -> Converter.URL.apply("foo.bar"));
127127
}

src/test/java/org/apache/commons/cli/DefaultParserTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void setUp() {
158158
}
159159

160160
@Test
161-
public void testBuilder() {
161+
void testBuilder() {
162162
// @formatter:off
163163
final Builder builder = DefaultParser.builder()
164164
.setStripLeadingAndTrailingQuotes(false)
@@ -172,7 +172,7 @@ public void testBuilder() {
172172
}
173173

174174
@Test
175-
public void testDeprecated() throws ParseException {
175+
void testDeprecated() throws ParseException {
176176
final Set<Option> handler = new HashSet<>();
177177
parser = DefaultParser.builder().setDeprecatedHandler(handler::add).build();
178178
final Option opt1 = Option.builder().option("d1").deprecated().build();

src/test/java/org/apache/commons/cli/DeprecatedAttributesTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2424
public class DeprecatedAttributesTest {
2525

2626
@Test
27-
public void testBuilderNonDefaults() {
27+
void testBuilderNonDefaults() {
2828
// @formatter:off
2929
final DeprecatedAttributes value = DeprecatedAttributes.builder()
3030
.setDescription("Use Bar instead!")
@@ -38,7 +38,7 @@ public void testBuilderNonDefaults() {
3838
}
3939

4040
@Test
41-
public void testBuilderNonDefaultsToString() {
41+
void testBuilderNonDefaultsToString() {
4242
// @formatter:off
4343
assertEquals("Deprecated for removal since 2.0: Use Bar instead!", DeprecatedAttributes.builder()
4444
.setDescription("Use Bar instead!")
@@ -61,15 +61,15 @@ public void testBuilderNonDefaultsToString() {
6161
}
6262

6363
@Test
64-
public void testDefaultBuilder() {
64+
void testDefaultBuilder() {
6565
final DeprecatedAttributes defaultValue = DeprecatedAttributes.builder().get();
6666
assertEquals(DeprecatedAttributes.DEFAULT.getDescription(), defaultValue.getDescription());
6767
assertEquals(DeprecatedAttributes.DEFAULT.getSince(), defaultValue.getSince());
6868
assertEquals(DeprecatedAttributes.DEFAULT.isForRemoval(), defaultValue.isForRemoval());
6969
}
7070

7171
@Test
72-
public void testDefaultToString() {
72+
void testDefaultToString() {
7373
assertEquals("Deprecated", DeprecatedAttributes.DEFAULT.toString());
7474
}
7575
}

src/test/java/org/apache/commons/cli/DisablePartialMatchingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Licensed to the Apache Software Foundation (ASF) under one or more
2424

2525
public class DisablePartialMatchingTest {
2626
@Test
27-
public void testDisablePartialMatching() throws Exception {
27+
void testDisablePartialMatching() throws Exception {
2828
final CommandLineParser parser = new DefaultParser(false);
2929

3030
final Options options = new Options();
@@ -41,7 +41,7 @@ public void testDisablePartialMatching() throws Exception {
4141
}
4242

4343
@Test
44-
public void testRegularPartialMatching() throws Exception {
44+
void testRegularPartialMatching() throws Exception {
4545
final CommandLineParser parser = new DefaultParser();
4646

4747
final Options options = new Options();

0 commit comments

Comments
 (0)