This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git


The following commit(s) were added to refs/heads/master by this push:
     new 547cf4d0 Use Checkstyle WhitespaceAround
547cf4d0 is described below

commit 547cf4d098f79257c75e9e481bb8225ce2ed3260
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Apr 12 11:08:55 2024 -0400

    Use Checkstyle WhitespaceAround
---
 src/conf/checkstyle.xml                            |   1 +
 .../org/apache/commons/codec/binary/Base64.java    |   8 +-
 .../apache/commons/codec/binary/BaseNCodec.java    |  17 +--
 .../org/apache/commons/codec/net/PercentCodec.java |   6 +-
 .../commons/codec/binary/BaseNCodecTest.java       |   7 +-
 .../codec/binary/CharSequenceUtilsTest.java        |  16 ++-
 .../commons/codec/digest/DigestUtilsTest.java      | 151 ++++++++-------------
 .../language/MatchRatingApproachEncoderTest.java   |  17 ++-
 .../apache/commons/codec/net/PercentCodecTest.java |   5 +-
 9 files changed, 94 insertions(+), 134 deletions(-)

diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 5d67b2cc..1566a238 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -61,6 +61,7 @@ limitations under the License.
 
   <module name="TreeWalker">
     <module name="WhitespaceAfter" />
+    <module name="WhitespaceAround" />
     <module name="ExplicitInitializationCheck" />
     <module name="OperatorWrap">
       <property name="option" value="eol" />
diff --git a/src/main/java/org/apache/commons/codec/binary/Base64.java 
b/src/main/java/org/apache/commons/codec/binary/Base64.java
index 61e411ae..a53cb8b0 100644
--- a/src/main/java/org/apache/commons/codec/binary/Base64.java
+++ b/src/main/java/org/apache/commons/codec/binary/Base64.java
@@ -597,7 +597,7 @@ public class Base64 extends BaseNCodec {
                 final String sep = StringUtils.newStringUtf8(lineSeparator);
                 throw new IllegalArgumentException("lineSeparator must not 
contain base64 characters: [" + sep + "]");
             }
-            if (lineLength > 0){ // null line-sep forces no chunking rather 
than throwing IAE
+            if (lineLength > 0) { // null line-sep forces no chunking rather 
than throwing IAE
                 this.encodeSize = BYTES_PER_ENCODED_BLOCK + 
lineSeparator.length;
                 this.lineSeparator = lineSeparator.clone();
             } else {
@@ -658,7 +658,7 @@ public class Base64 extends BaseNCodec {
             if (b >= 0 && b < DECODE_TABLE.length) {
                 final int result = DECODE_TABLE[b];
                 if (result >= 0) {
-                    context.modulus = (context.modulus+1) % 
BYTES_PER_ENCODED_BLOCK;
+                    context.modulus = (context.modulus + 1) % 
BYTES_PER_ENCODED_BLOCK;
                     context.ibitWorkArea = (context.ibitWorkArea << 
BITS_PER_ENCODED_BYTE) + result;
                     if (context.modulus == 0) {
                         buffer[context.pos++] = (byte) (context.ibitWorkArea 
>> 16 & MASK_8BITS);
@@ -770,12 +770,12 @@ public class Base64 extends BaseNCodec {
         } else {
             for (int i = 0; i < inAvail; i++) {
                 final byte[] buffer = ensureBufferSize(encodeSize, context);
-                context.modulus = (context.modulus+1) % 
BYTES_PER_UNENCODED_BLOCK;
+                context.modulus = (context.modulus + 1) % 
BYTES_PER_UNENCODED_BLOCK;
                 int b = in[inPos++];
                 if (b < 0) {
                     b += 256;
                 }
-                context.ibitWorkArea = (context.ibitWorkArea << 8) + b; //  
BITS_PER_BYTE
+                context.ibitWorkArea = (context.ibitWorkArea << 8) + b; // 
BITS_PER_BYTE
                 if (0 == context.modulus) { // 3 bytes = 24 bits = 4 * 6 bits 
to extract
                     buffer[context.pos++] = encodeTable[context.ibitWorkArea 
>> 18 & MASK_6BITS];
                     buffer[context.pos++] = encodeTable[context.ibitWorkArea 
>> 12 & MASK_6BITS];
diff --git a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java 
b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
index 56870c66..b0e64622 100644
--- a/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
+++ b/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java
@@ -515,13 +515,15 @@ public abstract class BaseNCodec implements 
BinaryEncoder, BinaryDecoder {
     /**
      * Encodes a byte[] containing binary data, into a String containing 
characters in the appropriate alphabet.
      * Uses UTF8 encoding.
+     * <p>
+     * This is a duplicate of {@link #encodeToString(byte[])}; it was merged 
during refactoring.
+     * </p>
      *
      * @param pArray a byte array containing binary data
      * @return String containing only character data in the appropriate 
alphabet.
      * @since 1.5
-     * This is a duplicate of {@link #encodeToString(byte[])}; it was merged 
during refactoring.
     */
-    public String encodeAsString(final byte[] pArray){
+    public String encodeAsString(final byte[] pArray) {
         return StringUtils.newStringUtf8(encode(pArray));
     }
 
@@ -544,14 +546,14 @@ public abstract class BaseNCodec implements 
BinaryEncoder, BinaryDecoder {
      * @param context the context to be used
      * @return the buffer
      */
-    protected byte[] ensureBufferSize(final int size, final Context context){
+    protected byte[] ensureBufferSize(final int size, final Context context) {
         if (context.buffer == null) {
             context.buffer = new byte[Math.max(size, getDefaultBufferSize())];
             context.pos = 0;
             context.readPos = 0;
 
             // Overflow-conscious:
-            // x + y > z  ==  x + y - z > 0
+            // x + y > z == x + y - z > 0
         } else if (context.pos + size - context.buffer.length > 0) {
             return resizeBuffer(context, context.pos + size);
         }
@@ -594,10 +596,10 @@ public abstract class BaseNCodec implements 
BinaryEncoder, BinaryDecoder {
     public long getEncodedLength(final byte[] pArray) {
         // Calculate non-chunked size - rounded up to allow for padding
         // cast to long is needed to avoid possibility of overflow
-        long len = (pArray.length + unencodedBlockSize-1)  / 
unencodedBlockSize * (long) encodedBlockSize;
+        long len = (pArray.length + unencodedBlockSize - 1) / 
unencodedBlockSize * (long) encodedBlockSize;
         if (lineLength > 0) { // We're using chunking
             // Round up to nearest multiple
-            len += (len + lineLength-1) / lineLength * chunkSeparatorLength;
+            len += (len + lineLength - 1) / lineLength * chunkSeparatorLength;
         }
         return len;
     }
@@ -634,8 +636,7 @@ public abstract class BaseNCodec implements BinaryEncoder, 
BinaryDecoder {
      */
     public boolean isInAlphabet(final byte[] arrayOctet, final boolean 
allowWSPad) {
         for (final byte octet : arrayOctet) {
-            if (!isInAlphabet(octet) &&
-                    (!allowWSPad || octet != pad && 
!Character.isWhitespace(octet))) {
+            if (!isInAlphabet(octet) && (!allowWSPad || octet != pad && 
!Character.isWhitespace(octet))) {
                 return false;
             }
         }
diff --git a/src/main/java/org/apache/commons/codec/net/PercentCodec.java 
b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
index df623df1..e10c978e 100644
--- a/src/main/java/org/apache/commons/codec/net/PercentCodec.java
+++ b/src/main/java/org/apache/commons/codec/net/PercentCodec.java
@@ -204,9 +204,9 @@ public class PercentCodec implements BinaryEncoder, 
BinaryDecoder {
 
     private int expectedDecodingBytes(final byte[] bytes) {
         int byteCount = 0;
-        for (int i = 0; i < bytes.length; ) {
+        for (int i = 0; i < bytes.length;) {
             final byte b = bytes[i];
-            i += b == ESCAPE_CHAR ? 3: 1;
+            i += b == ESCAPE_CHAR ? 3 : 1;
             byteCount++;
         }
         return byteCount;
@@ -215,7 +215,7 @@ public class PercentCodec implements BinaryEncoder, 
BinaryDecoder {
     private int expectedEncodingBytes(final byte[] bytes) {
         int byteCount = 0;
         for (final byte b : bytes) {
-            byteCount += canEncode(b) ? 3: 1;
+            byteCount += canEncode(b) ? 3 : 1;
         }
         return byteCount;
     }
diff --git a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java 
b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
index 887d0127..dbe93916 100644
--- a/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/BaseNCodecTest.java
@@ -137,8 +137,9 @@ public class BaseNCodecTest {
         return Runtime.getRuntime().maxMemory() - allocatedMemory;
     }
 
-BaseNCodec codec;
-@BeforeEach
+    BaseNCodec codec;
+    @BeforeEach
+
     public void setUp() {
         codec = new BaseNCodec(0, 0, 0, 0) {
             @Override
@@ -151,7 +152,7 @@ BaseNCodec codec;
 
             @Override
             protected boolean isInAlphabet(final byte b) {
-                return b=='O' || b == 'K'; // allow OK
+                return b == 'O' || b == 'K'; // allow OK
             }
         };
     }
diff --git 
a/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java 
b/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
index d1e580fa..93d3aba4 100644
--- a/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/CharSequenceUtilsTest.java
@@ -58,7 +58,8 @@ public class CharSequenceUtilsTest {
     // Note: The commented out tests fail due to the CharSequenceUtils method
     // being based on Lang 3.3.2 and the tests are from 3.11.
 
-    static class TestData{
+    static class TestData {
+
         final String source;
         final boolean ignoreCase;
         final int toffset;
@@ -67,8 +68,9 @@ public class CharSequenceUtilsTest {
         final int len;
         final boolean expected;
         final Class<? extends Throwable> throwable;
-        TestData(final String source, final boolean ignoreCase, final int 
toffset,
-                final String other, final int ooffset, final int len, final 
boolean expected) {
+
+        TestData(final String source, final boolean ignoreCase, final int 
toffset, final String other, final int ooffset, final int len,
+                final boolean expected) {
             this.source = source;
             this.ignoreCase = ignoreCase;
             this.toffset = toffset;
@@ -78,8 +80,9 @@ public class CharSequenceUtilsTest {
             this.expected = expected;
             this.throwable = null;
         }
-        TestData(final String source, final boolean ignoreCase, final int 
toffset,
-                final String other, final int ooffset, final int len, final 
Class<? extends Throwable> throwable) {
+
+        TestData(final String source, final boolean ignoreCase, final int 
toffset, final String other, final int ooffset, final int len,
+                final Class<? extends Throwable> throwable) {
             this.source = source;
             this.ignoreCase = ignoreCase;
             this.toffset = toffset;
@@ -89,11 +92,12 @@ public class CharSequenceUtilsTest {
             this.expected = false;
             this.throwable = throwable;
         }
+
         @Override
         public String toString() {
             final StringBuilder sb = new StringBuilder();
             sb.append(source).append("[").append(toffset).append("]");
-            sb.append(ignoreCase? " caseblind ":" samecase ");
+            sb.append(ignoreCase ? " caseblind " : " samecase ");
             sb.append(other).append("[").append(ooffset).append("]");
             sb.append(" ").append(len).append(" => ");
             if (throwable != null) {
diff --git a/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java 
b/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
index 4940e989..6958d442 100644
--- a/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
+++ b/src/test/java/org/apache/commons/codec/digest/DigestUtilsTest.java
@@ -154,17 +154,13 @@ public class DigestUtilsTest {
 
         assertEquals("4e8ddff3650292ab5a4108c3aa47940b", 
DigestUtils.md2Hex("abcdefghijklmnopqrstuvwxyz"));
 
-        assertEquals(
-            "da33def2a42df13975352846c30338cd",
-            DigestUtils.md2Hex("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
"abcdefghijklmnopqrstuvwxyz" + "0123456789"));
+        assertEquals("da33def2a42df13975352846c30338cd", 
DigestUtils.md2Hex("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" 
+ "0123456789"));
 
-        assertEquals(
-            "d5976f79d83d3a0dc9806c3c66f3efd8",
-            DigestUtils.md2Hex("1234567890123456789012345678901234567890" + 
"1234567890123456789012345678901234567890"));
+        assertEquals("d5976f79d83d3a0dc9806c3c66f3efd8",
+                DigestUtils.md2Hex("1234567890123456789012345678901234567890" 
+ "1234567890123456789012345678901234567890"));
 
-        assertEquals(DigestUtils.md2Hex(testData),
-                DigestUtils.md2Hex(new ByteArrayInputStream(testData)));
-}
+        assertEquals(DigestUtils.md2Hex(testData), DigestUtils.md2Hex(new 
ByteArrayInputStream(testData)));
+    }
 
     /**
      * An MD2 hash converted to hexadecimal should always be 32 characters.
@@ -207,16 +203,12 @@ public class DigestUtilsTest {
 
         assertEquals("c3fcd3d76192e4007dfb496cca67e13b", 
DigestUtils.md5Hex("abcdefghijklmnopqrstuvwxyz"));
 
-        assertEquals(
-            "d174ab98d277d9f5a5611c2c9f419d9f",
-            DigestUtils.md5Hex("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + 
"abcdefghijklmnopqrstuvwxyz" + "0123456789"));
+        assertEquals("d174ab98d277d9f5a5611c2c9f419d9f", 
DigestUtils.md5Hex("ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" 
+ "0123456789"));
 
-        assertEquals(
-            "57edf4a22be3c955ac49da2e2107b67a",
-            DigestUtils.md5Hex("1234567890123456789012345678901234567890" + 
"1234567890123456789012345678901234567890"));
+        assertEquals("57edf4a22be3c955ac49da2e2107b67a",
+                DigestUtils.md5Hex("1234567890123456789012345678901234567890" 
+ "1234567890123456789012345678901234567890"));
 
-        assertEquals(DigestUtils.md5Hex(testData),
-                DigestUtils.md5Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.md5Hex(testData), DigestUtils.md5Hex(new 
ByteArrayInputStream(testData)));
     }
 
     /**
@@ -254,15 +246,12 @@ public class DigestUtilsTest {
 
         assertEquals("a9993e364706816aba3e25717850c26c9cd0d89d", 
DigestUtils.sha1Hex(getBytesUtf8("abc")));
 
-        assertEquals(
-            "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
-            DigestUtils.sha1Hex("abcdbcdecdefdefgefghfghighij" + 
"hijkijkljklmklmnlmnomnopnopq"));
-        assertEquals(DigestUtils.sha1Hex(testData),
-                DigestUtils.sha1Hex(new ByteArrayInputStream(testData)));
+        assertEquals("84983e441c3bd26ebaae4aa1f95129e5e54670f1", 
DigestUtils.sha1Hex("abcdbcdecdefdefgefghfghighij" + 
"hijkijkljklmklmnlmnomnopnopq"));
+        assertEquals(DigestUtils.sha1Hex(testData), DigestUtils.sha1Hex(new 
ByteArrayInputStream(testData)));
     }
 
     @Test
-    public void testSha1UpdateWithByteArray(){
+    public void testSha1UpdateWithByteArray() {
         final String d1 = "C'est un homme qui rentre dans un café, et plouf";
         final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un 
cadeau: 'oh... encore un chapeau!'";
 
@@ -280,7 +269,7 @@ public class DigestUtilsTest {
     }
 
     @Test
-    public void testSha1UpdateWithByteBuffer(){
+    public void testSha1UpdateWithByteBuffer() {
         final String d1 = "C'est un homme qui rentre dans un café, et plouf";
         final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un 
cadeau: 'oh... encore un chapeau!'";
 
@@ -298,7 +287,7 @@ public class DigestUtilsTest {
     }
 
     @Test
-    public void testSha1UpdateWithString(){
+    public void testSha1UpdateWithString() {
         final String d1 = "C'est un homme qui rentre dans un café, et plouf";
         final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un 
cadeau: 'oh... encore un chapeau!'";
 
@@ -341,8 +330,7 @@ public class DigestUtilsTest {
     @Test
     public void testSha224_StringAsHex() {
         assumeJava8();
-        
assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f",
-                new 
DigestUtils(MessageDigestAlgorithms.SHA_224).digestAsHex(EMPTY_STRING));
+        
assertEquals("d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f", new 
DigestUtils(MessageDigestAlgorithms.SHA_224).digestAsHex(EMPTY_STRING));
         
assertEquals("730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525",
                 new 
DigestUtils(MessageDigestAlgorithms.SHA_224).digestAsHex("The quick brown fox 
jumps over the lazy dog"));
 
@@ -351,22 +339,18 @@ public class DigestUtilsTest {
 
     @Test
     public void testSha256() throws IOException {
-    // Examples from FIPS 180-2
-    
assertEquals("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
-             DigestUtils.sha256Hex("abc"));
-    
assertEquals("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
-             DigestUtils.sha256Hex(getBytesUtf8("abc")));
-    
assertEquals("248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
-             
DigestUtils.sha256Hex("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"));
+        // Examples from FIPS 180-2
+        
assertEquals("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
 DigestUtils.sha256Hex("abc"));
+        
assertEquals("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
 DigestUtils.sha256Hex(getBytesUtf8("abc")));
+        
assertEquals("248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1",
+                
DigestUtils.sha256Hex("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"));
 
-    assertEquals(DigestUtils.sha256Hex(testData),
-            DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha256Hex(testData), 
DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
     public void testSha256HexInputStream() throws IOException {
-        assertEquals(DigestUtils.sha256Hex(testData),
-                DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha256Hex(testData), 
DigestUtils.sha256Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
@@ -375,16 +359,13 @@ public class DigestUtilsTest {
         // Examples from 
https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
         //
         // 
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-224_Msg0.pdf
-        assertEquals(
-                "6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7",
-                DigestUtils.sha3_224Hex(EMPTY_STRING));
+        
assertEquals("6b4e03423667dbb73b6e15454f0eb1abd4597f9a1b078e3f5b5a6bc7", 
DigestUtils.sha3_224Hex(EMPTY_STRING));
     }
 
     @Test
     public void testSha3_224HexInputStream() throws IOException {
         assumeJava9();
-        assertEquals(DigestUtils.sha3_224Hex(testData),
-                DigestUtils.sha3_224Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha3_224Hex(testData), 
DigestUtils.sha3_224Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
@@ -393,16 +374,13 @@ public class DigestUtilsTest {
         // Examples from 
https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
         //
         // 
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-256_Msg0.pdf
-        assertEquals(
-                
"a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
-                DigestUtils.sha3_256Hex(EMPTY_STRING));
+        
assertEquals("a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a",
 DigestUtils.sha3_256Hex(EMPTY_STRING));
     }
 
     @Test
     public void testSha3_256HexInputStream() throws IOException {
         assumeJava9();
-        assertEquals(DigestUtils.sha3_256Hex(testData),
-                DigestUtils.sha3_256Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha3_256Hex(testData), 
DigestUtils.sha3_256Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
@@ -411,16 +389,13 @@ public class DigestUtilsTest {
         // Examples from 
https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
         //
         // 
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-384_Msg0.pdf
-        assertEquals(
-                
"0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004",
-                DigestUtils.sha3_384Hex(EMPTY_STRING));
+        
assertEquals("0c63a75b845e4f7d01107d852e4c2485c51a50aaaa94fc61995e71bbee983a2ac3713831264adb47fb6bd1e058d5f004",
 DigestUtils.sha3_384Hex(EMPTY_STRING));
     }
 
     @Test
     public void testSha3_384HexInputStream() throws IOException {
         assumeJava9();
-        assertEquals(DigestUtils.sha3_384Hex(testData),
-                DigestUtils.sha3_384Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha3_384Hex(testData), 
DigestUtils.sha3_384Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
@@ -429,54 +404,41 @@ public class DigestUtilsTest {
         // Examples from 
https://csrc.nist.gov/projects/cryptographic-standards-and-guidelines/example-values
         //
         // 
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA3-512_Msg0.pdf
-        assertEquals(
-                
"a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26",
+        
assertEquals("a69f73cca23a9ac5c8b567dc185a756e97c982164fe25859e0d1dcc1475c80a615b2123af1f5f94c11e3e9402c3ac558f500199d95b6d3e301758586281dcd26",
                 DigestUtils.sha3_512Hex(EMPTY_STRING));
     }
 
     @Test
     public void testSha3_512HexInputStream() throws IOException {
         assumeJava9();
-        assertEquals(DigestUtils.sha3_512Hex(testData),
-                DigestUtils.sha3_512Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha3_512Hex(testData), 
DigestUtils.sha3_512Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
     public void testSha384() throws IOException {
-    // Examples from FIPS 180-2
-    
assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" 
+
-             "8086072ba1e7cc2358baeca134c825a7",
-             DigestUtils.sha384Hex("abc"));
-    
assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" 
+
-             "8086072ba1e7cc2358baeca134c825a7",
-             DigestUtils.sha384Hex(getBytesUtf8("abc")));
-    
assertEquals("09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712" 
+
-            "fcc7c71a557e2db966c3e9fa91746039",
-             
DigestUtils.sha384Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 +
-                       
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
-    assertEquals(DigestUtils.sha384Hex(testData),
-            DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
+        // Examples from FIPS 180-2
+        
assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" 
+ "8086072ba1e7cc2358baeca134c825a7", DigestUtils.sha384Hex("abc"));
+        
assertEquals("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed" 
+ "8086072ba1e7cc2358baeca134c825a7",
+                DigestUtils.sha384Hex(getBytesUtf8("abc")));
+        
assertEquals("09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712" 
+ "fcc7c71a557e2db966c3e9fa91746039",
+                
DigestUtils.sha384Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 + "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
+        assertEquals(DigestUtils.sha384Hex(testData), 
DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
     public void testSha384HexInputStream() throws IOException {
-        assertEquals(DigestUtils.sha384Hex(testData),
-                DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha384Hex(testData), 
DigestUtils.sha384Hex(new ByteArrayInputStream(testData)));
     }
 
     @Test
     public void testSha512() {
-    // Examples from FIPS 180-2
-    
assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" 
+
-            "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
-             DigestUtils.sha512Hex("abc"));
-    
assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" 
+
-             
"2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
-             DigestUtils.sha512Hex(getBytesUtf8("abc")));
-    
assertEquals("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018" 
+
-             
"501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909",
-             
DigestUtils.sha512Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 +
-                       
"hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
+        // Examples from FIPS 180-2
+        
assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" 
+ "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
+                DigestUtils.sha512Hex("abc"));
+        
assertEquals("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a" 
+ "2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f",
+                DigestUtils.sha512Hex(getBytesUtf8("abc")));
+        
assertEquals("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018" 
+ "501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909",
+                
DigestUtils.sha512Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmn"
 + "hijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
     }
 
     @Test
@@ -498,8 +460,7 @@ public class DigestUtilsTest {
         assertEquals(resultString, DigestUtils.sha512_224Hex(stringInput));
         // Example 2
         
assertEquals("23FEC5BB94D60B23308192640B0C453335D664734FE40E7268674AF9".toLowerCase(Locale.ROOT),
-            DigestUtils.sha512_224Hex(
-                
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
+                
DigestUtils.sha512_224Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
     }
 
     @Test
@@ -509,8 +470,7 @@ public class DigestUtilsTest {
         // 
https://csrc.nist.gov/CSRC/media/Projects/Cryptographic-Standards-and-Guidelines/documents/examples/SHA512_256.pdf
         final String stringInput = "abc";
         final byte[] bytesInput = getBytesUtf8(stringInput);
-        final String resultString = 
"53048E2681941EF99B2E29B76B4C7DABE4C2D0C634FC6D46E0E2F13107E7AF23"
-            .toLowerCase(Locale.ROOT);
+        final String resultString = 
"53048E2681941EF99B2E29B76B4C7DABE4C2D0C634FC6D46E0E2F13107E7AF23".toLowerCase(Locale.ROOT);
         final byte[] resultBytes = Hex.decodeHex(resultString);
         //
         assertArrayEquals(resultBytes, DigestUtils.sha512_256(bytesInput));
@@ -522,14 +482,12 @@ public class DigestUtilsTest {
         assertEquals(resultString, DigestUtils.sha512_256Hex(stringInput));
         // Example 2
         
assertEquals("3928E184FB8690F840DA3988121D31BE65CB9D3EF83EE6146FEAC861E19B563A".toLowerCase(Locale.ROOT),
-            DigestUtils.sha512_256Hex(
-                
"abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
+                
DigestUtils.sha512_256Hex("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"));
     }
 
     @Test
     public void testSha512HexInputStream() throws IOException {
-        assertEquals(DigestUtils.sha512Hex(testData),
-                DigestUtils.sha512Hex(new ByteArrayInputStream(testData)));
+        assertEquals(DigestUtils.sha512Hex(testData), 
DigestUtils.sha512Hex(new ByteArrayInputStream(testData)));
     }
 
     @SuppressWarnings("deprecation") // deliberate tests of deprecated code
@@ -540,16 +498,13 @@ public class DigestUtilsTest {
 
         assertEquals("a9993e364706816aba3e25717850c26c9cd0d89d", 
DigestUtils.shaHex(getBytesUtf8("abc")));
 
-        assertEquals(
-            "84983e441c3bd26ebaae4aa1f95129e5e54670f1",
-            DigestUtils.shaHex("abcdbcdecdefdefgefghfghighij" + 
"hijkijkljklmklmnlmnomnopnopq"));
-        assertEquals(DigestUtils.shaHex(testData),
-                DigestUtils.shaHex(new ByteArrayInputStream(testData)));
+        assertEquals("84983e441c3bd26ebaae4aa1f95129e5e54670f1", 
DigestUtils.shaHex("abcdbcdecdefdefgefghfghighij" + 
"hijkijkljklmklmnlmnomnopnopq"));
+        assertEquals(DigestUtils.shaHex(testData), DigestUtils.shaHex(new 
ByteArrayInputStream(testData)));
     }
 
     @SuppressWarnings("deprecation") // deliberate tests of deprecated code
     @Test
-    public void testShaUpdateWithByteArray(){
+    public void testShaUpdateWithByteArray() {
         final String d1 = "C'est un homme qui rentre dans un café, et plouf";
         final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un 
cadeau: 'oh... encore un chapeau!'";
 
@@ -568,7 +523,7 @@ public class DigestUtilsTest {
 
     @SuppressWarnings("deprecation") // deliberate tests of deprecated code
     @Test
-    public void testShaUpdateWithString(){
+    public void testShaUpdateWithString() {
         final String d1 = "C'est un homme qui rentre dans un café, et plouf";
         final String d2 = "C'est un homme, c'est qu'une tête, on lui offre un 
cadeau: 'oh... encore un chapeau!'";
 
diff --git 
a/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
 
b/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
index c54a10a5..cf8c6e24 100644
--- 
a/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
+++ 
b/src/test/java/org/apache/commons/codec/language/MatchRatingApproachEncoderTest.java
@@ -47,8 +47,7 @@ public class MatchRatingApproachEncoderTest extends 
AbstractStringEncoderTest<Ma
 
     @Test
     public final void 
testAccentRemoval_ComprehensiveAccentMix_AllSuccessfullyRemoved() {
-        assertEquals("E,E,E,E,U,U,I,I,A,A,O,e,e,e,e,u,u,i,i,a,a,o,c",
-                
this.getStringEncoder().removeAccents("È,É,Ê,Ë,Û,Ù,Ï,Î,À,Â,Ô,è,é,ê,ë,û,ù,ï,î,à,â,ô,ç"));
+        assertEquals("E,E,E,E,U,U,I,I,A,A,O,e,e,e,e,u,u,i,i,a,a,o,c", 
this.getStringEncoder().removeAccents("È,É,Ê,Ë,Û,Ù,Ï,Î,À,Â,Ô,è,é,ê,ë,û,ù,ï,î,à,â,ô,ç"));
     }
 
     @Test
@@ -357,12 +356,12 @@ public class MatchRatingApproachEncoderTest extends 
AbstractStringEncoderTest<Ma
     }
 
     @Test
-    public final void testgetMinRating_10_Returns3_Successfully(){
+    public final void testgetMinRating_10_Returns3_Successfully() {
         assertEquals(3, this.getStringEncoder().getMinRating(10));
     }
 
     @Test
-    public final void testgetMinRating_11_Returns_3_Successfully(){
+    public final void testgetMinRating_11_Returns_3_Successfully() {
         assertEquals(3, this.getStringEncoder().getMinRating(11));
     }
 
@@ -377,17 +376,17 @@ public class MatchRatingApproachEncoderTest extends 
AbstractStringEncoderTest<Ma
     }
 
     @Test
-    public final void testgetMinRating_5_Returns4_Successfully(){
+    public final void testgetMinRating_5_Returns4_Successfully() {
         assertEquals(4, this.getStringEncoder().getMinRating(5));
     }
 
     @Test
-    public final void testgetMinRating_5_Returns4_Successfully2(){
+    public final void testgetMinRating_5_Returns4_Successfully2() {
         assertEquals(4, this.getStringEncoder().getMinRating(5));
     }
 
     @Test
-    public final void testgetMinRating_6_Returns4_Successfully(){
+    public final void testgetMinRating_6_Returns4_Successfully() {
         assertEquals(4, this.getStringEncoder().getMinRating(6));
     }
 
@@ -399,12 +398,12 @@ public class MatchRatingApproachEncoderTest extends 
AbstractStringEncoderTest<Ma
     // ***** Begin Region - Test Get Encoding - Surnames
 
     @Test
-    public final void testgetMinRating_7_Returns4_Successfully(){
+    public final void testgetMinRating_7_Returns4_Successfully() {
         assertEquals(4, this.getStringEncoder().getMinRating(7));
     }
 
     @Test
-    public final void testgetMinRating_8_Returns3_Successfully(){
+    public final void testgetMinRating_8_Returns3_Successfully() {
         assertEquals(3, this.getStringEncoder().getMinRating(8));
     }
 
diff --git a/src/test/java/org/apache/commons/codec/net/PercentCodecTest.java 
b/src/test/java/org/apache/commons/codec/net/PercentCodecTest.java
index a537efba..0424fd86 100644
--- a/src/test/java/org/apache/commons/codec/net/PercentCodecTest.java
+++ b/src/test/java/org/apache/commons/codec/net/PercentCodecTest.java
@@ -74,10 +74,9 @@ public class PercentCodecTest {
         final PercentCodec percentCodec = new PercentCodec();
         final byte[] encoded = 
percentCodec.encode(inputS.getBytes(StandardCharsets.UTF_8));
         try {
-            percentCodec.decode(Arrays.copyOf(encoded, encoded.length-1)); 
//exclude one byte
+            percentCodec.decode(Arrays.copyOf(encoded, encoded.length - 1)); 
// exclude one byte
         } catch (final Exception e) {
-            assertTrue(DecoderException.class.isInstance(e) &&
-                ArrayIndexOutOfBoundsException.class.isInstance(e.getCause()));
+            assertTrue(DecoderException.class.isInstance(e) && 
ArrayIndexOutOfBoundsException.class.isInstance(e.getCause()));
         }
     }
 

Reply via email to