Skip to content

Commit e0ddfc1

Browse files
committed
Use @ParameterizedTest
1 parent 283358d commit e0ddfc1

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

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

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -978,15 +978,20 @@ void testRfc4648Section10Encode() {
978978
* @see <a href="https://tools.ietf.org/html/rfc4648">https://tools.ietf.org/
979979
* html/rfc4648</a>
980980
*/
981-
@Test
982-
void testRfc4648Section10EncodeDecode() {
983-
testEncodeDecode("");
984-
testEncodeDecode("f");
985-
testEncodeDecode("fo");
986-
testEncodeDecode("foo");
987-
testEncodeDecode("foob");
988-
testEncodeDecode("fooba");
989-
testEncodeDecode("foobar");
981+
@ParameterizedTest
982+
// @formatter:off
983+
@ValueSource(strings = {
984+
"",
985+
"f",
986+
"fo",
987+
"foo",
988+
"foob",
989+
"fooba",
990+
"foobar",
991+
})
992+
// @formatter:on
993+
void testRfc4648Section10EncodeDecode(final String input) {
994+
testEncodeDecode(input);
990995
}
991996

992997
@Test
@@ -1219,10 +1224,7 @@ void testStringToByteVariations() throws DecoderException {
12191224
final String s3 = null;
12201225
final String s4a = "K/fMJwH+Q5e0nr7tWsxwkA==\r\n";
12211226
final String s4b = "K_fMJwH-Q5e0nr7tWsxwkA";
1222-
final byte[] b4 = Hex.decodeHex("2bf7cc2701fe4397b49ebeed5acc7090"); // for
1223-
// url-safe
1224-
// tests
1225-
1227+
final byte[] b4 = Hex.decodeHex("2bf7cc2701fe4397b49ebeed5acc7090"); // for url-safe tests
12261228
assertEquals("Hello World", StringUtils.newStringUtf8(base64.decode(s1)), "StringToByte Hello World");
12271229
assertEquals("Hello World", StringUtils.newStringUtf8((byte[]) base64.decode((Object) s1)), "StringToByte Hello World");
12281230
assertEquals("Hello World", StringUtils.newStringUtf8(Base64.decodeBase64(s1)), "StringToByte static Hello World");

0 commit comments

Comments
 (0)