Skip to content

Commit 6cb7d15

Browse files
committed
Use JUnit 5 convention for test method visibility
1 parent 6660a22 commit 6cb7d15

16 files changed

+59
-59
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static List<String> getResourceNames() {
3636

3737
@ParameterizedTest
3838
@MethodSource("getResourceNames")
39-
public void testGetInputStream(final String resName) throws IOException {
39+
void testGetInputStream(final String resName) throws IOException {
4040
try (InputStream in = Resources.getInputStream(resName)) {
4141
// empty
4242
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private void testBase32EmptyInputStream(final int chuckSize) throws Exception {
7878
// * @throws Exception for some failure scenarios.
7979
// */
8080
// @Test
81-
// public void testCodec101() throws Exception {
81+
// void testCodec101() throws Exception {
8282
// byte[] codec101 = StringUtils.getBytesUtf8(Base32TestData.CODEC_101_MULTIPLE_OF_3);
8383
// ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
8484
// Base32InputStream in = new Base32InputStream(bais);
@@ -106,7 +106,7 @@ private void testBase32EmptyInputStream(final int chuckSize) throws Exception {
106106
* for some failure scenarios.
107107
*/
108108
// @Test
109-
// public void testInputStreamReader() throws Exception {
109+
// void testInputStreamReader() throws Exception {
110110
// byte[] codec101 = StringUtils.getBytesUtf8(Base32TestData.CODEC_101_MULTIPLE_OF_3);
111111
// ByteArrayInputStream bais = new ByteArrayInputStream(codec101);
112112
// Base32InputStream in = new Base32InputStream(bais);
@@ -123,7 +123,7 @@ private void testBase32EmptyInputStream(final int chuckSize) throws Exception {
123123
* for some failure scenarios.
124124
*/
125125
// @Test
126-
// public void testCodec98NPE() throws Exception {
126+
// void testCodec98NPE() throws Exception {
127127
// byte[] codec98 = StringUtils.getBytesUtf8(Base32TestData.CODEC_98_NPE);
128128
// ByteArrayInputStream data = new ByteArrayInputStream(codec98);
129129
// Base32InputStream stream = new Base32InputStream(data);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Base32OutputStreamTest {
4444
// * @throws Exception for some failure scenarios.
4545
// */
4646
// @Test
47-
// public void testCodec98NPE() throws Exception {
47+
// void testCodec98NPE() throws Exception {
4848
// byte[] codec98 = StringUtils.getBytesUtf8(Base32TestData.CODEC_98_NPE);
4949
// byte[] codec98_1024 = new byte[1024];
5050
// System.arraycopy(codec98, 0, codec98_1024, 0, codec98.length);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void testCodec112() { // size calculation assumes always chunked
309309
* Tests <a href="https://issues.apache.org/jira/browse/CODEC-263">CODEC-263</a>.
310310
*/
311311
@Test
312-
public void testCodec263() {
312+
void testCodec263() {
313313
Base64.decodeBase64("publishMessage");
314314
assertTrue(Base64.isBase64("publishMessage"));
315315
}

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void testContextToString() {
200200
}
201201

202202
// @Test
203-
// public void testGetEncodedLength() {
203+
// void testGetEncodedLength() {
204204
// fail("Not yet implemented");
205205
// }
206206

@@ -272,47 +272,47 @@ void testEnsureBufferSizeThrowsOnOverflow() {
272272

273273
//
274274
// @Test
275-
// public void testEncodeObject() {
275+
// void testEncodeObject() {
276276
// fail("Not yet implemented");
277277
// }
278278
//
279279
// @Test
280-
// public void testEncodeToString() {
280+
// void testEncodeToString() {
281281
// fail("Not yet implemented");
282282
// }
283283
//
284284
// @Test
285-
// public void testDecodeObject() {
285+
// void testDecodeObject() {
286286
// fail("Not yet implemented");
287287
// }
288288
//
289289
// @Test
290-
// public void testDecodeString() {
290+
// void testDecodeString() {
291291
// fail("Not yet implemented");
292292
// }
293293
//
294294
// @Test
295-
// public void testDecodeByteArray() {
295+
// void testDecodeByteArray() {
296296
// fail("Not yet implemented");
297297
// }
298298
//
299299
// @Test
300-
// public void testEncodeByteArray() {
300+
// void testEncodeByteArray() {
301301
// fail("Not yet implemented");
302302
// }
303303
//
304304
// @Test
305-
// public void testEncodeAsString() {
305+
// void testEncodeAsString() {
306306
// fail("Not yet implemented");
307307
// }
308308
//
309309
// @Test
310-
// public void testEncodeByteArrayIntInt() {
310+
// void testEncodeByteArrayIntInt() {
311311
// fail("Not yet implemented");
312312
// }
313313
//
314314
// @Test
315-
// public void testDecodeByteArrayIntInt() {
315+
// void testDecodeByteArrayIntInt() {
316316
// fail("Not yet implemented");
317317
// }
318318
//
@@ -343,22 +343,22 @@ void testIsInAlphabetString() {
343343
}
344344

345345
// @Test
346-
// public void testHasData() {
346+
// void testHasData() {
347347
// fail("Not yet implemented");
348348
// }
349349
//
350350
// @Test
351-
// public void testAvail() {
351+
// void testAvail() {
352352
// fail("Not yet implemented");
353353
// }
354354
//
355355
// @Test
356-
// public void testEnsureBufferSize() {
356+
// void testEnsureBufferSize() {
357357
// fail("Not yet implemented");
358358
// }
359359
//
360360
// @Test
361-
// public void testReadResults() {
361+
// void testReadResults() {
362362
// fail("Not yet implemented");
363363
// }
364364
//

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ private void testCharset(final String name, final String parent) throws Unsuppor
187187

188188
@ParameterizedTest
189189
@MethodSource("org.apache.commons.codec.CharsetsTest#getAvailableCharsetNames()")
190-
public void testCustomCharset(final String name) throws UnsupportedEncodingException, DecoderException {
190+
void testCustomCharset(final String name) throws UnsupportedEncodingException, DecoderException {
191191
testCharset(name, "testCustomCharset");
192192
}
193193

@@ -666,7 +666,7 @@ void testGetCharsetName() {
666666

667667
@ParameterizedTest
668668
@MethodSource("org.apache.commons.codec.CharsetsTest#getRequiredCharsets()")
669-
public void testRequiredCharset(final Charset charset) throws UnsupportedEncodingException, DecoderException {
669+
void testRequiredCharset(final Charset charset) throws UnsupportedEncodingException, DecoderException {
670670
testCharset(charset.name(), "testRequiredCharset");
671671
}
672672
}

src/test/java/org/apache/commons/codec/digest/HmacAlgorithmsTest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void tearDown() throws Exception {
135135

136136
@ParameterizedTest
137137
@MethodSource("data")
138-
public void testAlgorithm(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
138+
void testAlgorithm(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
139139
throws NoSuchAlgorithmException {
140140
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
141141
final String algorithm = hmacAlgorithm.getName();
@@ -147,63 +147,63 @@ public void testAlgorithm(final HmacAlgorithms hmacAlgorithm, final byte[] stand
147147

148148
@ParameterizedTest
149149
@MethodSource("data")
150-
public void testGetHmacEmptyKey(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
150+
void testGetHmacEmptyKey(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
151151
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
152152
assertThrows(IllegalArgumentException.class, () -> HmacUtils.getInitializedMac(hmacAlgorithm, EMPTY_BYTE_ARRAY));
153153
}
154154

155155
@ParameterizedTest
156156
@MethodSource("data")
157-
public void testGetHmacNullKey(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
157+
void testGetHmacNullKey(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
158158
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
159159
assertThrows(IllegalArgumentException.class, () -> HmacUtils.getInitializedMac(hmacAlgorithm, null));
160160
}
161161

162162
@ParameterizedTest
163163
@MethodSource("data")
164-
public void testHmacFailByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
164+
void testHmacFailByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
165165
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
166166
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (byte[]) null).hmac(STANDARD_PHRASE_BYTES));
167167
}
168168

169169
@ParameterizedTest
170170
@MethodSource("data")
171-
public void testHmacFailInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
171+
void testHmacFailInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
172172
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
173173
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (byte[]) null).hmac(new ByteArrayInputStream(STANDARD_PHRASE_BYTES)));
174174
}
175175

176176
@ParameterizedTest
177177
@MethodSource("data")
178-
public void testHmacFailString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
178+
void testHmacFailString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
179179
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
180180
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (String) null).hmac(STANDARD_PHRASE_STRING));
181181
}
182182

183183
@ParameterizedTest
184184
@MethodSource("data")
185-
public void testHmacHexFailByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
185+
void testHmacHexFailByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
186186
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
187187
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (byte[]) null).hmac(STANDARD_PHRASE_BYTES));
188188
}
189189

190190
@ParameterizedTest
191191
@MethodSource("data")
192-
public void testHmacHexFailInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
192+
void testHmacHexFailInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
193193
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
194194
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (byte[]) null).hmac(new ByteArrayInputStream(STANDARD_PHRASE_BYTES)));
195195
}
196196

197197
@ParameterizedTest
198198
@MethodSource("data")
199-
public void testHmacHexFailString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
199+
void testHmacHexFailString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
200200
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
201201
assertThrows(IllegalArgumentException.class, () -> new HmacUtils(hmacAlgorithm, (String) null).hmac(STANDARD_PHRASE_STRING));
202202
}
203203

204204
@ParameterizedTest
205205
@MethodSource("data")
206-
public void testInitializedMac(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
206+
void testInitializedMac(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
207207
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
208208
final Mac mac = HmacUtils.getInitializedMac(hmacAlgorithm, STANDARD_KEY_BYTES);
209209
final Mac mac2 = HmacUtils.getInitializedMac(hmacAlgorithm.getName(), STANDARD_KEY_BYTES);
@@ -213,59 +213,59 @@ public void testInitializedMac(final HmacAlgorithms hmacAlgorithm, final byte[]
213213

214214
@ParameterizedTest
215215
@MethodSource("data")
216-
public void testMacByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
216+
void testMacByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
217217
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
218218
assertArrayEquals(standardResultBytes, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmac(STANDARD_PHRASE_BYTES));
219219
}
220220

221221
@ParameterizedTest
222222
@MethodSource("data")
223-
public void testMacHexByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
223+
void testMacHexByteArray(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
224224
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
225225
assertEquals(standardResultString, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmacHex(STANDARD_PHRASE_BYTES));
226226
}
227227

228228
@ParameterizedTest
229229
@MethodSource("data")
230-
public void testMacHexFile(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
230+
void testMacHexFile(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
231231
throws IOException {
232232
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
233233
assertEquals(standardResultString, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmacHex(TempFile.toFile()));
234234
}
235235

236236
@ParameterizedTest
237237
@MethodSource("data")
238-
public void testMacHexPath(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
238+
void testMacHexPath(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
239239
throws IOException {
240240
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
241241
assertEquals(standardResultString, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmacHex(TempFile));
242242
}
243243

244244
@ParameterizedTest
245245
@MethodSource("data")
246-
public void testMacHexInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
246+
void testMacHexInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString)
247247
throws IOException {
248248
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
249249
assertEquals(standardResultString, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmacHex(new ByteArrayInputStream(STANDARD_PHRASE_BYTES)));
250250
}
251251

252252
@ParameterizedTest
253253
@MethodSource("data")
254-
public void testMacHexString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
254+
void testMacHexString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
255255
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
256256
assertEquals(standardResultString, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmacHex(STANDARD_PHRASE_STRING));
257257
}
258258

259259
@ParameterizedTest
260260
@MethodSource("data")
261-
public void testMacInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) throws IOException {
261+
void testMacInputStream(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) throws IOException {
262262
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
263263
assertArrayEquals(standardResultBytes, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmac(new ByteArrayInputStream(STANDARD_PHRASE_BYTES)));
264264
}
265265

266266
@ParameterizedTest
267267
@MethodSource("data")
268-
public void testMacString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
268+
void testMacString(final HmacAlgorithms hmacAlgorithm, final byte[] standardResultBytes, final String standardResultString) {
269269
assumeTrue(HmacUtils.isAvailable(hmacAlgorithm));
270270
assertArrayEquals(standardResultBytes, new HmacUtils(hmacAlgorithm, STANDARD_KEY_BYTES).hmac(STANDARD_PHRASE_STRING));
271271
}

src/test/java/org/apache/commons/codec/digest/MessageDigestAlgorithmsTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public void tearDown() throws Exception {
125125

126126
@ParameterizedTest
127127
@MethodSource("data")
128-
public void testAlgorithm(final String messageDigestAlgorithm) throws NoSuchAlgorithmException {
128+
void testAlgorithm(final String messageDigestAlgorithm) throws NoSuchAlgorithmException {
129129
final String algorithm = messageDigestAlgorithm;
130130
assertNotNull(algorithm);
131131
assertFalse(algorithm.isEmpty());
@@ -135,15 +135,15 @@ public void testAlgorithm(final String messageDigestAlgorithm) throws NoSuchAlgo
135135

136136
@ParameterizedTest
137137
@MethodSource("data")
138-
public void testDigestByteArray(final String messageDigestAlgorithm) {
138+
void testDigestByteArray(final String messageDigestAlgorithm) {
139139
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
140140
assertArrayEquals(digestTestData(messageDigestAlgorithm), DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), getTestData()));
141141
assertArrayEquals(digestTestData(messageDigestAlgorithm), DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), getTestData()));
142142
}
143143

144144
@ParameterizedTest
145145
@MethodSource("data")
146-
public void testDigestByteBuffer(final String messageDigestAlgorithm) {
146+
void testDigestByteBuffer(final String messageDigestAlgorithm) {
147147
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
148148
assertArrayEquals(digestTestData(messageDigestAlgorithm),
149149
DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), ByteBuffer.wrap(getTestData())));
@@ -153,15 +153,15 @@ public void testDigestByteBuffer(final String messageDigestAlgorithm) {
153153

154154
@ParameterizedTest
155155
@MethodSource("data")
156-
public void testDigestFile(final String messageDigestAlgorithm) throws IOException {
156+
void testDigestFile(final String messageDigestAlgorithm) throws IOException {
157157
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
158158
assertArrayEquals(digestTestData(messageDigestAlgorithm), DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), getTestFile()));
159159
assertArrayEquals(digestTestData(messageDigestAlgorithm), DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), getTestFile()));
160160
}
161161

162162
@ParameterizedTest
163163
@MethodSource("data")
164-
public void testDigestInputStream(final String messageDigestAlgorithm) throws IOException {
164+
void testDigestInputStream(final String messageDigestAlgorithm) throws IOException {
165165
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
166166
assertArrayEquals(digestTestData(messageDigestAlgorithm),
167167
DigestUtils.digest(DigestUtils.getDigest(messageDigestAlgorithm), new ByteArrayInputStream(getTestData())));
@@ -179,27 +179,27 @@ private void testDigestPath(final String messageDigestAlgorithm, final OpenOptio
179179

180180
@ParameterizedTest
181181
@MethodSource("data")
182-
public void testDigestPathOpenOptionsEmpty(final String messageDigestAlgorithm) throws IOException {
182+
void testDigestPathOpenOptionsEmpty(final String messageDigestAlgorithm) throws IOException {
183183
testDigestPath(messageDigestAlgorithm);
184184
}
185185

186186
@ParameterizedTest
187187
@MethodSource("data")
188-
public void testDigestPathStandardOpenOptionRead(final String messageDigestAlgorithm) throws IOException {
188+
void testDigestPathStandardOpenOptionRead(final String messageDigestAlgorithm) throws IOException {
189189
testDigestPath(messageDigestAlgorithm, StandardOpenOption.READ);
190190
}
191191

192192
@ParameterizedTest
193193
@MethodSource("data")
194-
public void testGetMessageDigest(final String messageDigestAlgorithm) {
194+
void testGetMessageDigest(final String messageDigestAlgorithm) {
195195
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
196196
final MessageDigest messageDigest = DigestUtils.getDigest(messageDigestAlgorithm);
197197
assertEquals(messageDigestAlgorithm, messageDigest.getAlgorithm());
198198
}
199199

200200
@ParameterizedTest
201201
@MethodSource("data")
202-
public void testNonBlockingDigestRandomAccessFile(final String messageDigestAlgorithm) throws IOException {
202+
void testNonBlockingDigestRandomAccessFile(final String messageDigestAlgorithm) throws IOException {
203203
assumeTrue(DigestUtils.isAvailable(messageDigestAlgorithm));
204204

205205
final byte[] expected = digestTestData(messageDigestAlgorithm);

0 commit comments

Comments
 (0)