Skip to content

Commit 264a34f

Browse files
committed
Use JUnit 5 convention for @test method visibility
1 parent a9f9be4 commit 264a34f

File tree

62 files changed

+836
-836
lines changed

Some content is hidden

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

62 files changed

+836
-836
lines changed

src/test/java/org/apache/commons/codec/AbstractStringEncoderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,27 @@ public T getStringEncoder() {
5454
}
5555

5656
@Test
57-
public void testEncodeEmpty() throws Exception {
57+
void testEncodeEmpty() throws Exception {
5858
final Encoder encoder = this.getStringEncoder();
5959
encoder.encode("");
6060
encoder.encode(" ");
6161
encoder.encode("\t");
6262
}
6363

6464
@Test
65-
public void testEncodeNull() throws EncoderException {
65+
void testEncodeNull() throws EncoderException {
6666
final StringEncoder encoder = this.getStringEncoder();
6767
encoder.encode(null);
6868
}
6969

7070
@Test
71-
public void testEncodeWithInvalidObject() throws Exception {
71+
void testEncodeWithInvalidObject() throws Exception {
7272
final StringEncoder encoder = this.getStringEncoder();
7373
assertThrows(EncoderException.class, () -> encoder.encode(Float.valueOf(3.4f)),
7474
"An exception was not thrown when we tried to encode a Float object");
7575
}
7676
@Test
77-
public void testLocaleIndependence() throws Exception {
77+
void testLocaleIndependence() throws Exception {
7878
final StringEncoder encoder = this.getStringEncoder();
7979

8080
final String[] data = { "I", "i" };

src/test/java/org/apache/commons/codec/BinaryEncoderAbstractTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ public abstract class BinaryEncoderAbstractTest {
2828
protected abstract BinaryEncoder makeEncoder();
2929

3030
@Test
31-
public void testEncodeEmpty() throws Exception {
31+
void testEncodeEmpty() throws Exception {
3232
final BinaryEncoder encoder = makeEncoder();
3333
encoder.encode(new byte[0]);
3434
}
3535

3636
@Test
37-
public void testEncodeNull() {
37+
void testEncodeNull() {
3838
assertThrows(EncoderException.class, () -> makeEncoder().encode(null));
3939
}
4040
}

src/test/java/org/apache/commons/codec/CharEncodingTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,37 @@ public class CharEncodingTest {
3232
* We could make the constructor private in the future, it's a matter a style.
3333
*/
3434
@Test
35-
public void testConstructor() {
35+
void testConstructor() {
3636
new CharEncoding();
3737
}
3838

3939
@Test
40-
public void testIso8859_1() {
40+
void testIso8859_1() {
4141
assertEquals(StandardCharsets.ISO_8859_1.name(), CharEncoding.ISO_8859_1);
4242
}
4343

4444
@Test
45-
public void testUsAscii() {
45+
void testUsAscii() {
4646
assertEquals(StandardCharsets.US_ASCII.name(), CharEncoding.US_ASCII);
4747
}
4848

4949
@Test
50-
public void testUtf16() {
50+
void testUtf16() {
5151
assertEquals(StandardCharsets.UTF_16.name(), CharEncoding.UTF_16);
5252
}
5353

5454
@Test
55-
public void testUtf16Be() {
55+
void testUtf16Be() {
5656
assertEquals(StandardCharsets.UTF_16BE.name(), CharEncoding.UTF_16BE);
5757
}
5858

5959
@Test
60-
public void testUtf16Le() {
60+
void testUtf16Le() {
6161
assertEquals(StandardCharsets.UTF_16LE.name(), CharEncoding.UTF_16LE);
6262
}
6363

6464
@Test
65-
public void testUtf8() {
65+
void testUtf8() {
6666
assertEquals(StandardCharsets.UTF_8.name(), CharEncoding.UTF_8);
6767
}
6868

src/test/java/org/apache/commons/codec/CharsetsTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ public static Collection<Charset> getRequiredCharsets() {
4545

4646
@SuppressWarnings("deprecation")
4747
@Test
48-
public void testIso8859_1() {
48+
void testIso8859_1() {
4949
assertEquals("ISO-8859-1", Charsets.ISO_8859_1.name());
5050
}
5151

5252
@Test
53-
public void testToCharset() {
53+
void testToCharset() {
5454
assertEquals(Charset.defaultCharset(), Charsets.toCharset((String) null));
5555
assertEquals(Charset.defaultCharset(), Charsets.toCharset((Charset) null));
5656
assertEquals(Charset.defaultCharset(), Charsets.toCharset(Charset.defaultCharset()));
@@ -59,31 +59,31 @@ public void testToCharset() {
5959

6060
@SuppressWarnings("deprecation")
6161
@Test
62-
public void testUsAscii() {
62+
void testUsAscii() {
6363
assertEquals(StandardCharsets.US_ASCII.name(), Charsets.US_ASCII.name());
6464
}
6565

6666
@SuppressWarnings("deprecation")
6767
@Test
68-
public void testUtf16() {
68+
void testUtf16() {
6969
assertEquals(StandardCharsets.UTF_16.name(), Charsets.UTF_16.name());
7070
}
7171

7272
@SuppressWarnings("deprecation")
7373
@Test
74-
public void testUtf16Be() {
74+
void testUtf16Be() {
7575
assertEquals(StandardCharsets.UTF_16BE.name(), Charsets.UTF_16BE.name());
7676
}
7777

7878
@SuppressWarnings("deprecation")
7979
@Test
80-
public void testUtf16Le() {
80+
void testUtf16Le() {
8181
assertEquals(StandardCharsets.UTF_16LE.name(), Charsets.UTF_16LE.name());
8282
}
8383

8484
@SuppressWarnings("deprecation")
8585
@Test
86-
public void testUtf8() {
86+
void testUtf8() {
8787
assertEquals(StandardCharsets.UTF_8.name(), Charsets.UTF_8.name());
8888
}
8989

src/test/java/org/apache/commons/codec/DecoderExceptionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ public class DecoderExceptionTest {
3232
private static final Throwable t = new Exception();
3333

3434
@Test
35-
public void testConstructor0() {
35+
void testConstructor0() {
3636
final DecoderException e = new DecoderException();
3737
assertNull(e.getMessage());
3838
assertNull(e.getCause());
3939
}
4040

4141
@Test
42-
public void testConstructorString() {
42+
void testConstructorString() {
4343
final DecoderException e = new DecoderException(MSG);
4444
assertEquals(MSG, e.getMessage());
4545
assertNull(e.getCause());
4646
}
4747

4848
@Test
49-
public void testConstructorStringThrowable() {
49+
void testConstructorStringThrowable() {
5050
final DecoderException e = new DecoderException(MSG, t);
5151
assertEquals(MSG, e.getMessage());
5252
assertEquals(t, e.getCause());
5353
}
5454

5555
@Test
56-
public void testConstructorThrowable() {
56+
void testConstructorThrowable() {
5757
final DecoderException e = new DecoderException(t);
5858
assertEquals(t.getClass().getName(), e.getMessage());
5959
assertEquals(t, e.getCause());

src/test/java/org/apache/commons/codec/EncoderExceptionTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,28 +32,28 @@ public class EncoderExceptionTest {
3232
private static final Throwable t = new Exception();
3333

3434
@Test
35-
public void testConstructor0() {
35+
void testConstructor0() {
3636
final EncoderException e = new EncoderException();
3737
assertNull(e.getMessage());
3838
assertNull(e.getCause());
3939
}
4040

4141
@Test
42-
public void testConstructorString() {
42+
void testConstructorString() {
4343
final EncoderException e = new EncoderException(MSG);
4444
assertEquals(MSG, e.getMessage());
4545
assertNull(e.getCause());
4646
}
4747

4848
@Test
49-
public void testConstructorStringThrowable() {
49+
void testConstructorStringThrowable() {
5050
final EncoderException e = new EncoderException(MSG, t);
5151
assertEquals(MSG, e.getMessage());
5252
assertEquals(t, e.getCause());
5353
}
5454

5555
@Test
56-
public void testConstructorThrowable() {
56+
void testConstructorThrowable() {
5757
final EncoderException e = new EncoderException(t);
5858
assertEquals(t.getClass().getName(), e.getMessage());
5959
assertEquals(t, e.getCause());

src/test/java/org/apache/commons/codec/StringEncoderComparatorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class StringEncoderComparatorTest {
3434

3535
@SuppressWarnings("unchecked") // cannot easily avoid this warning
3636
@Test
37-
public void testComparatorWithDoubleMetaphone() throws Exception {
37+
void testComparatorWithDoubleMetaphone() throws Exception {
3838
final StringEncoderComparator sCompare = new StringEncoderComparator(new DoubleMetaphone());
3939

4040
final String[] testArray = { "Jordan", "Sosa", "Prior", "Pryor" };
@@ -52,15 +52,15 @@ public void testComparatorWithDoubleMetaphone() throws Exception {
5252
}
5353

5454
@Test
55-
public void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
55+
void testComparatorWithDoubleMetaphoneAndInvalidInput() throws Exception {
5656
final StringEncoderComparator sCompare = new StringEncoderComparator(new DoubleMetaphone());
5757

5858
final int compare = sCompare.compare(Double.valueOf(3.0d), Long.valueOf(3));
5959
assertEquals(0, compare, "Trying to compare objects that make no sense to the underlying encoder" + " should return a zero compare code");
6060
}
6161

6262
@Test
63-
public void testComparatorWithSoundex() throws Exception {
63+
void testComparatorWithSoundex() throws Exception {
6464
final StringEncoderComparator sCompare = new StringEncoderComparator(new Soundex());
6565

6666
assertEquals(0, sCompare.compare("O'Brien", "O'Brian"), "O'Brien and O'Brian didn't come out with the same Soundex, something must be wrong here");

src/test/java/org/apache/commons/codec/binary/Base16InputStreamTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class Base16InputStreamTest {
4646
* @throws IOException for some failure scenarios.
4747
*/
4848
@Test
49-
public void testAvailable() throws IOException {
49+
void testAvailable() throws IOException {
5050
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
5151
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
5252
assertEquals(1, b16Stream.available());
@@ -65,7 +65,7 @@ public void testAvailable() throws IOException {
6565
* @throws IOException for some failure scenarios.
6666
*/
6767
@Test
68-
public void testBase16EmptyInputStream() throws IOException {
68+
void testBase16EmptyInputStream() throws IOException {
6969
final byte[] emptyEncoded = {};
7070
final byte[] emptyDecoded = {};
7171
testByteByByte(emptyEncoded, emptyDecoded);
@@ -78,7 +78,7 @@ public void testBase16EmptyInputStream() throws IOException {
7878
* @throws IOException for some failure scenarios.
7979
*/
8080
@Test
81-
public void testBase16InputStreamByChunk() throws IOException {
81+
void testBase16InputStreamByChunk() throws IOException {
8282
// Hello World test.
8383
byte[] encoded = StringUtils.getBytesUtf8("48656C6C6F20576F726C64");
8484
byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
@@ -110,7 +110,7 @@ public void testBase16InputStreamByChunk() throws IOException {
110110
* @throws IOException for some failure scenarios.
111111
*/
112112
@Test
113-
public void testBase16InputStreamByteByByte() throws IOException {
113+
void testBase16InputStreamByteByByte() throws IOException {
114114
// Hello World test.
115115
byte[] encoded = StringUtils.getBytesUtf8("48656C6C6F20576F726C64");
116116
byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
@@ -267,7 +267,7 @@ private void testByteByByte(final byte[] encoded, final byte[] decoded, final bo
267267
* @throws IOException for some failure scenarios.
268268
*/
269269
@Test
270-
public void testMarkSupported() throws IOException {
270+
void testMarkSupported() throws IOException {
271271
final byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
272272
final ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
273273
try (Base16InputStream in = new Base16InputStream(bin, true)) {
@@ -282,7 +282,7 @@ public void testMarkSupported() throws IOException {
282282
* @throws IOException for some failure scenarios.
283283
*/
284284
@Test
285-
public void testRead0() throws IOException {
285+
void testRead0() throws IOException {
286286
final byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
287287
final byte[] buf = new byte[1024];
288288
int bytesRead = 0;
@@ -299,7 +299,7 @@ public void testRead0() throws IOException {
299299
* @throws IOException for some failure scenarios.
300300
*/
301301
@Test
302-
public void testReadNull() throws IOException {
302+
void testReadNull() throws IOException {
303303
final byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
304304
final ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
305305
try (Base16InputStream in = new Base16InputStream(bin, true)) {
@@ -313,7 +313,7 @@ public void testReadNull() throws IOException {
313313
* @throws IOException for some failure scenarios.
314314
*/
315315
@Test
316-
public void testReadOutOfBounds() throws IOException {
316+
void testReadOutOfBounds() throws IOException {
317317
final byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
318318
final byte[] buf = new byte[1024];
319319
final ByteArrayInputStream bin = new ByteArrayInputStream(decoded);
@@ -331,7 +331,7 @@ public void testReadOutOfBounds() throws IOException {
331331
* @throws IOException for some failure scenarios.
332332
*/
333333
@Test
334-
public void testSkipBig() throws IOException {
334+
void testSkipBig() throws IOException {
335335
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
336336
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
337337
assertEquals(6, b16Stream.skip(Integer.MAX_VALUE));
@@ -347,7 +347,7 @@ public void testSkipBig() throws IOException {
347347
* @throws IOException for some failure scenarios.
348348
*/
349349
@Test
350-
public void testSkipNone() throws IOException {
350+
void testSkipNone() throws IOException {
351351
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
352352
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
353353
final byte[] actualBytes = new byte[6];
@@ -365,7 +365,7 @@ public void testSkipNone() throws IOException {
365365
* @throws IOException for some failure scenarios.
366366
*/
367367
@Test
368-
public void testSkipPastEnd() throws IOException {
368+
void testSkipPastEnd() throws IOException {
369369
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
370370
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
371371
// due to CODEC-130, skip now skips correctly decoded characters rather than encoded
@@ -382,7 +382,7 @@ public void testSkipPastEnd() throws IOException {
382382
* @throws IOException for some failure scenarios.
383383
*/
384384
@Test
385-
public void testSkipToEnd() throws IOException {
385+
void testSkipToEnd() throws IOException {
386386
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
387387
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
388388
// due to CODEC-130, skip now skips correctly decoded characters rather than encoded
@@ -399,7 +399,7 @@ public void testSkipToEnd() throws IOException {
399399
* @throws IOException for some failure scenarios.
400400
*/
401401
@Test
402-
public void testSkipWrongArgument() throws IOException {
402+
void testSkipWrongArgument() throws IOException {
403403
final InputStream ins = new ByteArrayInputStream(StringUtils.getBytesIso8859_1(ENCODED_B16));
404404
try (Base16InputStream b16Stream = new Base16InputStream(ins)) {
405405
assertThrows(IllegalArgumentException.class, () -> b16Stream.skip(-10));

src/test/java/org/apache/commons/codec/binary/Base16OutputStreamTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class Base16OutputStreamTest {
3939
* @throws IOException for some failure scenarios.
4040
*/
4141
@Test
42-
public void testBase16EmptyOutputStream() throws IOException {
42+
void testBase16EmptyOutputStream() throws IOException {
4343
final byte[] emptyEncoded = {};
4444
final byte[] emptyDecoded = {};
4545
testByteByByte(emptyEncoded, emptyDecoded);
@@ -52,7 +52,7 @@ public void testBase16EmptyOutputStream() throws IOException {
5252
* @throws IOException for some failure scenarios.
5353
*/
5454
@Test
55-
public void testBase16OutputStreamByChunk() throws IOException {
55+
void testBase16OutputStreamByChunk() throws IOException {
5656
// Hello World test.
5757
byte[] encoded = StringUtils.getBytesUtf8("48656C6C6F20576F726C64");
5858
byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
@@ -79,7 +79,7 @@ public void testBase16OutputStreamByChunk() throws IOException {
7979
* @throws IOException for some failure scenarios.
8080
*/
8181
@Test
82-
public void testBase16OutputStreamByteByByte() throws IOException {
82+
void testBase16OutputStreamByteByByte() throws IOException {
8383
// Hello World test.
8484
byte[] encoded = StringUtils.getBytesUtf8("48656C6C6F20576F726C64");
8585
byte[] decoded = StringUtils.getBytesUtf8(STRING_FIXTURE);
@@ -234,7 +234,7 @@ private void testByteByByte(final byte[] encoded, final byte[] decoded, final bo
234234
* @throws IOException for some failure scenarios.
235235
*/
236236
@Test
237-
public void testWriteOutOfBounds() throws IOException {
237+
void testWriteOutOfBounds() throws IOException {
238238
final byte[] buf = new byte[1024];
239239
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
240240
try (Base16OutputStream out = new Base16OutputStream(bout)) {
@@ -251,7 +251,7 @@ public void testWriteOutOfBounds() throws IOException {
251251
* @throws IOException for some failure scenarios.
252252
*/
253253
@Test
254-
public void testWriteToNullCoverage() throws IOException {
254+
void testWriteToNullCoverage() throws IOException {
255255
final ByteArrayOutputStream bout = new ByteArrayOutputStream();
256256
try (Base16OutputStream out = new Base16OutputStream(bout)) {
257257
assertThrows(NullPointerException.class, () -> out.write(null, 0, 0));

0 commit comments

Comments
 (0)