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
The following commit(s) were added to refs/heads/master by this push:
new 65183336 Fix broken tests.
65183336 is described below
commit 6518333614a32ba3d1f1766700d2564d449cdbbd
Author: Gary Gregory <[email protected]>
AuthorDate: Thu May 5 15:03:25 2022 -0400
Fix broken tests.
---
.../commons/compress/archivers/zip/ZipUtilTest.java | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git
a/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
b/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
index dcd38392..38724ef0 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipUtilTest.java
@@ -21,6 +21,7 @@ package org.apache.commons.compress.archivers.zip;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThrows;
import static org.junit.Assert.fail;
import java.math.BigInteger;
@@ -43,12 +44,14 @@ public class ZipUtilTest {
cal.setTime(time);
final int year = cal.get(Calendar.YEAR);
final int month = cal.get(Calendar.MONTH) + 1;
- final long value = ((year - 1980) << 25)
- | (month << 21)
- | (cal.get(Calendar.DAY_OF_MONTH) << 16)
- | (cal.get(Calendar.HOUR_OF_DAY) << 11)
- | (cal.get(Calendar.MINUTE) << 5)
- | (cal.get(Calendar.SECOND) >> 1);
+ // @formatter:off
+ final long value = ((year - 1980) << 25)
+ | (month << 21)
+ | (cal.get(Calendar.DAY_OF_MONTH) << 16)
+ | (cal.get(Calendar.HOUR_OF_DAY) << 11)
+ | (cal.get(Calendar.MINUTE) << 5)
+ | (cal.get(Calendar.SECOND) >> 1);
+ // @formatter:on
final byte[] result = new byte[4];
result[0] = (byte) ((value & 0xFF));
@@ -252,13 +255,13 @@ public class ZipUtilTest {
public void testUnsupportedMethod() throws Exception {
final ZipArchiveEntry ze = new ZipArchiveEntry();
ze.setMethod(ZipMethod.EXPANDING_LEVEL_1.getCode());
- ZipUtil.checkRequestedFeatures(ze);
+ assertThrows(UnsupportedZipFeatureException.class, () ->
ZipUtil.checkRequestedFeatures(ze));
}
@Test
public void testUnknownMethod() throws Exception {
final ZipArchiveEntry ze = new ZipArchiveEntry();
ze.setMethod(100);
- ZipUtil.checkRequestedFeatures(ze);
+ assertThrows(UnsupportedZipFeatureException.class, () ->
ZipUtil.checkRequestedFeatures(ze));
}
}