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-compress.git

commit 33241236314b6953e031c200f7a9d65982cedcb7
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Tue Nov 26 10:08:22 2024 -0500

    Sort members
---
 .../archivers/zip/ZipEightByteInteger.java         | 22 ++++++-------
 .../archivers/zip/ZipEightByteIntegerTest.java     | 38 +++++++++++-----------
 .../apache/commons/compress/utils/IOUtilsTest.java | 10 +++---
 3 files changed, 35 insertions(+), 35 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
index 96fd1c54e..61680accb 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipEightByteInteger.java
@@ -35,17 +35,6 @@ public final class ZipEightByteInteger implements 
Serializable {
 
     private static final BigInteger HIGHEST_BIT = BigInteger.ONE.shiftLeft(63);
 
-    /**
-     * package private for tests only.
-     */
-    static BigInteger toUnsignedBigInteger(final long value) {
-        if (value >= 0L) {
-            return BigInteger.valueOf(value);
-        } else {
-            return BigInteger.valueOf(value & Long.MAX_VALUE).add(HIGHEST_BIT);
-        }
-    }
-
     /**
      * Gets value as eight bytes in big-endian byte order.
      *
@@ -110,6 +99,17 @@ public final class ZipEightByteInteger implements 
Serializable {
         return toUnsignedBigInteger(getLongValue(bytes, offset));
     }
 
+    /**
+     * package private for tests only.
+     */
+    static BigInteger toUnsignedBigInteger(final long value) {
+        if (value >= 0L) {
+            return BigInteger.valueOf(value);
+        } else {
+            return BigInteger.valueOf(value & Long.MAX_VALUE).add(HIGHEST_BIT);
+        }
+    }
+
     private final long value;
 
     /**
diff --git 
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
 
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
index 144244cd4..a80cb753a 100644
--- 
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
+++ 
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java
@@ -29,15 +29,6 @@ import org.junit.jupiter.api.Test;
  */
 public class ZipEightByteIntegerTest {
 
-    /**
-     * Test {@link ZipEightByteInteger#toUnsignedBigInteger(long)}.
-     */
-    @Test
-    public void testToUnsignedBigInteger() {
-        assertEquals(BigInteger.valueOf(Long.MAX_VALUE), 
ZipEightByteInteger.toUnsignedBigInteger(Long.MAX_VALUE));
-        assertEquals(BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1), 
ZipEightByteInteger.toUnsignedBigInteger(0XFFFFFFFFFFFFFFFEL));
-    }
-
     /**
      * Test conversion from bytes.
      */
@@ -60,6 +51,16 @@ public class ZipEightByteIntegerTest {
         assertEquals("18446744073709551615", 
zipEightByteInteger.getValue().toString());
     }
 
+    /**
+     * Test conversion from bytes.
+     */
+    @Test
+    public void testBILongFromBytes() {
+        final byte[] val = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 
0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
+        final ZipEightByteInteger zl = new ZipEightByteInteger(val);
+        assertEquals(0XFFFFFFFFFFFFFFFFL, zl.getLongValue(), "longValue from 
bytes");
+    }
+
     /**
      * Test conversion to bytes.
      */
@@ -108,16 +109,6 @@ public class ZipEightByteIntegerTest {
         assertEquals(0xAB12345678L, zl.getLongValue(), "longValue from bytes");
     }
 
-    /**
-     * Test conversion from bytes.
-     */
-    @Test
-    public void testBILongFromBytes() {
-        final byte[] val = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 
0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
-        final ZipEightByteInteger zl = new ZipEightByteInteger(val);
-        assertEquals(0XFFFFFFFFFFFFFFFFL, zl.getLongValue(), "longValue from 
bytes");
-    }
-
     /**
      * Test conversion to bytes.
      */
@@ -155,4 +146,13 @@ public class ZipEightByteIntegerTest {
                 new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 
0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF });
         assertEquals("ZipEightByteInteger value: 18446744073709551615", 
zipEightByteInteger.toString());
     }
+
+    /**
+     * Test {@link ZipEightByteInteger#toUnsignedBigInteger(long)}.
+     */
+    @Test
+    public void testToUnsignedBigInteger() {
+        assertEquals(BigInteger.valueOf(Long.MAX_VALUE), 
ZipEightByteInteger.toUnsignedBigInteger(Long.MAX_VALUE));
+        assertEquals(BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1), 
ZipEightByteInteger.toUnsignedBigInteger(0XFFFFFFFFFFFFFFFEL));
+    }
 }
diff --git a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java 
b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
index 2410dc9f2..442de9b98 100644
--- a/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
+++ b/src/test/java/org/apache/commons/compress/utils/IOUtilsTest.java
@@ -80,6 +80,11 @@ public class IOUtilsTest {
         assertThrows(NullPointerException.class, () -> IOUtils.copy(in, 
(OutputStream) null));
     }
 
+    @Test
+    public void testCopyOnZeroBufferSize() throws IOException {
+        assertEquals(0, IOUtils.copy(new 
ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY), new ByteArrayOutputStream(), 
0));
+    }
+
     @Test
     public void testCopyRangeDoesntCopyMoreThanAskedFor() throws IOException {
         try (ByteArrayInputStream in = new ByteArrayInputStream(new byte[] { 
1, 2, 3, 4, 5 });
@@ -106,11 +111,6 @@ public class IOUtilsTest {
                 () -> IOUtils.copyRange(new 
ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY), 5, new 
ByteArrayOutputStream(), 0));
     }
 
-    @Test
-    public void testCopyOnZeroBufferSize() throws IOException {
-        assertEquals(0, IOUtils.copy(new 
ByteArrayInputStream(ByteUtils.EMPTY_BYTE_ARRAY), new ByteArrayOutputStream(), 
0));
-    }
-
     @Test
     public void testReadFullyOnChannelReadsFully() throws IOException {
         final ByteBuffer b = ByteBuffer.allocate(20);

Reply via email to