Skip to content
Permalink
Browse files
Fix broken tests.
  • Loading branch information
garydgregory committed May 5, 2022
1 parent aca1074 commit 6518333614a32ba3d1f1766700d2564d449cdbbd
Showing 1 changed file with 11 additions and 8 deletions.
@@ -21,6 +21,7 @@
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 void setUp() throws Exception {
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 void testFromDosTime() {
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));
}
}

0 comments on commit 6518333

Please sign in to comment.