entrySettingsProvider) {
- this.entrySettingsProvider = Optional.ofNullable(entrySettingsProvider).orElse(ZipEntrySettings.DEFAULT_PROVIDER);
+ this.entrySettingsProvider = Optional.ofNullable(entrySettingsProvider)
+ .orElse(ZipEntrySettings.DEFAULT_PROVIDER);
return this;
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/model/src/PkwareSplitSrcZip.java b/src/main/java/ru/olegcherednik/zip4jvm/model/src/PkwareSplitSrcZip.java
index b131e84f2..22b9e6d62 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/model/src/PkwareSplitSrcZip.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/model/src/PkwareSplitSrcZip.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.model.src;
-import org.apache.commons.io.FilenameUtils;
import ru.olegcherednik.zip4jvm.exception.SplitPartNotFoundException;
import ru.olegcherednik.zip4jvm.io.readers.ZipModelReader;
import ru.olegcherednik.zip4jvm.utils.PathUtils;
+import org.apache.commons.io.FilenameUtils;
+
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedList;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/model/src/SevenZipSplitSrcZip.java b/src/main/java/ru/olegcherednik/zip4jvm/model/src/SevenZipSplitSrcZip.java
index 0160f8093..c63235976 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/model/src/SevenZipSplitSrcZip.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/model/src/SevenZipSplitSrcZip.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.model.src;
-import org.apache.commons.io.FilenameUtils;
-import org.apache.commons.lang3.math.NumberUtils;
import ru.olegcherednik.zip4jvm.exception.SplitPartNotFoundException;
import ru.olegcherednik.zip4jvm.utils.PathUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.math.NumberUtils;
+
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.LinkedList;
@@ -30,7 +31,8 @@
import java.util.Set;
/**
- * 7-Zip has not standard split algorithm. It creates the whole zip file first and then split it with required part size. It has following naming
+ * 7-Zip has not standard split algorithm. It creates the whole zip file first and then split it with required part
+ * size. It has following naming
* convention:
*
* filename.zip.001
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/model/src/SrcZip.java b/src/main/java/ru/olegcherednik/zip4jvm/model/src/SrcZip.java
index 5c3a53dea..26fc22476 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/model/src/SrcZip.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/model/src/SrcZip.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.model.src;
+import ru.olegcherednik.zip4jvm.model.ZipModel;
+
import lombok.AccessLevel;
import lombok.Builder;
import lombok.Getter;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.filefilter.RegexFileFilter;
import org.apache.commons.lang3.ArrayUtils;
-import ru.olegcherednik.zip4jvm.model.ZipModel;
import java.io.File;
import java.io.FileFilter;
@@ -75,8 +76,11 @@ private static long calcSize(List disks) {
}
private static long calcSplitSize(List disks) {
- return disks.size() == 1 ? ZipModel.NO_SPLIT :
- disks.stream().mapToLong(Disk::getSize).max().orElse(ZipModel.NO_SPLIT);
+ return disks.size() == 1 ? ZipModel.NO_SPLIT
+ : disks.stream()
+ .mapToLong(Disk::getSize)
+ .max()
+ .orElse(ZipModel.NO_SPLIT);
}
public int getTotalDisks() {
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/BitUtils.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/BitUtils.java
index dafb6e297..a7ac9e99d 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/BitUtils.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/BitUtils.java
@@ -95,6 +95,6 @@ public static int updateBits(int val, int bits, boolean value) {
}
public static byte updateBits(byte val, int bits, boolean value) {
- return (byte)updateBits((int)val, bits, value);
+ return (byte) updateBits((int) val, bits, value);
}
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/EmptyInputStreamSupplier.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/EmptyInputStreamSupplier.java
index e260d2d36..b6f4d01c1 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/EmptyInputStreamSupplier.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/EmptyInputStreamSupplier.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.utils;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.model.entry.ZipEntry;
import ru.olegcherednik.zip4jvm.utils.function.ZipEntryInputStreamSupplier;
import ru.olegcherednik.zip4jvm.utils.quitely.functions.InputStreamSupplier;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
import java.io.IOException;
import java.io.InputStream;
@@ -45,4 +46,5 @@ public InputStream get() throws IOException {
public InputStream get(ZipEntry zipEntry) {
return EmptyInputStream.INSTANCE;
}
+
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/PathUtils.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/PathUtils.java
index 91d03b4cf..9330771dd 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/PathUtils.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/PathUtils.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.utils;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.IOException;
import java.nio.file.Files;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/ValidationUtils.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/ValidationUtils.java
index a4845edc5..8ec3cf19b 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/ValidationUtils.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/ValidationUtils.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.utils;
+import ru.olegcherednik.zip4jvm.exception.PathNotExistsException;
+import ru.olegcherednik.zip4jvm.exception.RealBigZip64NotSupportedException;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
-import ru.olegcherednik.zip4jvm.exception.PathNotExistsException;
-import ru.olegcherednik.zip4jvm.exception.RealBigZip64NotSupportedException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -56,7 +57,8 @@ public static void realBigZip64(long value, String type) {
}
public static T requireNotNull(T obj, String name) {
- return Optional.ofNullable(obj).orElseThrow(() -> new IllegalArgumentException("Parameter should not be null: " + name));
+ return Optional.ofNullable(obj)
+ .orElseThrow(() -> new IllegalArgumentException("Parameter should not be null: " + name));
}
public static void requireExists(Path path) {
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/ZipUtils.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/ZipUtils.java
index c45aa5d6b..279d67922 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/ZipUtils.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/ZipUtils.java
@@ -18,14 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.utils;
+import ru.olegcherednik.zip4jvm.ZipFile;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
-import ru.olegcherednik.zip4jvm.ZipFile;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
-import ru.olegcherednik.zip4jvm.utils.quitely.functions.SupplierWithException;
import java.io.IOException;
import java.io.InputStream;
@@ -76,7 +75,8 @@ public static String getFileNameNoDirectoryMarker(String fileName) {
}
public static long copyLarge(InputStream input, OutputStream output) throws IOException {
- try (InputStream in = input; OutputStream out = output) {
+ try (InputStream in = input;
+ OutputStream out = output) {
return IOUtils.copyLarge(in, out);
}
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/FileReader.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/FileReader.java
index 0b51e3cd3..ed8c68205 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/FileReader.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/FileReader.java
@@ -23,6 +23,7 @@
import java.io.IOException;
/**
+ * @param the type of results supplied by this reader
* @author Oleg Cherednik
* @since 07.09.2019
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/LocalSupplier.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/LocalSupplier.java
index 470c355bd..5fb3db602 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/LocalSupplier.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/LocalSupplier.java
@@ -19,6 +19,7 @@
package ru.olegcherednik.zip4jvm.utils.function;
/**
+ * @param the type of results supplied by this supplier
* @author Oleg Cherednik
* @since 19.10.2019
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/Reader.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/Reader.java
index 678d66c68..53e73bf77 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/function/Reader.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/function/Reader.java
@@ -21,6 +21,7 @@
import ru.olegcherednik.zip4jvm.io.in.data.DataInput;
/**
+ * @param the type of results supplied by this reader
* @author Oleg Cherednik
* @since 20.12.2022
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/Quietly.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/Quietly.java
index fa371bdbc..0e8927cf7 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/Quietly.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/Quietly.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.utils.quitely;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.utils.quitely.functions.IntSupplierWithException;
import ru.olegcherednik.zip4jvm.utils.quitely.functions.SupplierWithException;
import ru.olegcherednik.zip4jvm.utils.quitely.functions.TaskWithException;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
/**
* @author Oleg Cherednik
* @since 15.04.2023
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/functions/SupplierWithException.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/functions/SupplierWithException.java
index 107030390..e9e3132a3 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/functions/SupplierWithException.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/quitely/functions/SupplierWithException.java
@@ -19,6 +19,7 @@
package ru.olegcherednik.zip4jvm.utils.quitely.functions;
/**
+ * @param the type of results supplied by this supplier
* @author Oleg Cherednik
* @since 15.04.2023
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/utils/time/DosTimestampConverterUtils.java b/src/main/java/ru/olegcherednik/zip4jvm/utils/time/DosTimestampConverterUtils.java
index a3d61ea94..3462b58eb 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/utils/time/DosTimestampConverterUtils.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/utils/time/DosTimestampConverterUtils.java
@@ -35,8 +35,12 @@ public final class DosTimestampConverterUtils {
/* @see {@link java.util.zip.ZipUtils#dosToJavaTime(long)} */
@SuppressWarnings({ "deprecation", "MagicConstant" })
public static long dosToJavaTime(int dtime) {
- return new Date(((dtime >> 25) & 0x7F) + 80, ((dtime >> 21) & 0x0F) - 1, (dtime >> 16) & 0x1F, (dtime >> 11) & 0x1F,
- (dtime >> 5) & 0x3F, (dtime << 1) & 0x3E).getTime();
+ return new Date(((dtime >> 25) & 0x7F) + 80,
+ ((dtime >> 21) & 0x0F) - 1,
+ (dtime >> 16) & 0x1F,
+ (dtime >> 11) & 0x1F,
+ (dtime >> 5) & 0x3F,
+ (dtime << 1) & 0x3E).getTime();
}
/* @see {@link java.util.zip.ZipUtils#javaToDosTime(long)} */
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/BaseView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/BaseView.java
index 737e76fa2..749b1be68 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/BaseView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/BaseView.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.view;
+import ru.olegcherednik.zip4jvm.model.block.Block;
+
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
-import ru.olegcherednik.zip4jvm.model.block.Block;
import java.io.PrintStream;
import java.util.Locale;
@@ -129,7 +130,9 @@ public void printValueWithLocation(PrintStream out, String valueName, Block bloc
if (totalDisks > 1)
printLine(out, String.format(" - disk (%04X):", block.getDiskNo()), block.getFileName());
- printLine(out, " - size:", String.format("%d bytes (%d record%s)", block.getSize(), total, total == 1 ? "" : "s"));
+ printLine(out,
+ " - size:",
+ String.format("%d bytes (%d record%s)", block.getSize(), total, total == 1 ? "" : "s"));
}
@Deprecated
@@ -162,10 +165,10 @@ public static String signature(int signature) {
StringBuilder buf = new StringBuilder();
for (int i = 0; i < 4; i++) {
- byte code = (byte)signature;
+ byte code = (byte) signature;
- if (Character.isAlphabetic((char)code) || Character.isDigit((char)code))
- buf.append((char)code);
+ if (Character.isAlphabetic((char) code) || Character.isDigit((char) code))
+ buf.append((char) code);
else
buf.append(code < 10 ? "0" + code : code);
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/CompressionMethodView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/CompressionMethodView.java
index b970cf96a..88eeb5c28 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/CompressionMethodView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/CompressionMethodView.java
@@ -23,8 +23,6 @@
import java.io.PrintStream;
-import static ru.olegcherednik.zip4jvm.utils.ValidationUtils.requireNotNull;
-
/**
* @author Oleg Cherednik
* @since 15.10.2019
@@ -34,15 +32,14 @@ public final class CompressionMethodView extends BaseView {
private final CompressionMethod compressionMethod;
private final GeneralPurposeFlag generalPurposeFlag;
- public CompressionMethodView(int offs, int columnWidth) {
- this(null, null, offs, columnWidth);
- }
-
public CompressionMethodView(CompressionMethod compressionMethod, int offs, int columnWidth) {
this(compressionMethod, null, offs, columnWidth);
}
- public CompressionMethodView(CompressionMethod compressionMethod, GeneralPurposeFlag generalPurposeFlag, int offs, int columnWidth) {
+ public CompressionMethodView(CompressionMethod compressionMethod,
+ GeneralPurposeFlag generalPurposeFlag,
+ int offs,
+ int columnWidth) {
super(offs, columnWidth);
this.compressionMethod = compressionMethod;
this.generalPurposeFlag = generalPurposeFlag;
@@ -53,16 +50,27 @@ public boolean printTextInfo(PrintStream out) {
if (compressionMethod == null)
printLine(out, "compression method (--):", "----");
else {
- printLine(out, String.format("compression method (%02d):", compressionMethod.getCode()), compressionMethod.getTitle());
+ printLine(out,
+ String.format("compression method (%02d):", compressionMethod.getCode()),
+ compressionMethod.getTitle());
if (generalPurposeFlag != null) {
if (compressionMethod == CompressionMethod.FILE_IMPLODED) {
- printLine(out, " size of sliding dictionary (implosion):", generalPurposeFlag.getSlidingDictionarySize().getTitle());
- printLine(out, " number of Shannon-Fano trees (implosion):", generalPurposeFlag.getShannonFanoTreesNumber().getTitle());
+ printLine(out,
+ " size of sliding dictionary (implosion):",
+ generalPurposeFlag.getSlidingDictionarySize().getTitle());
+ printLine(out,
+ " number of Shannon-Fano trees (implosion):",
+ generalPurposeFlag.getShannonFanoTreesNumber().getTitle());
} else if (compressionMethod == CompressionMethod.LZMA)
- printLine(out, " end-of-stream (EOS) marker:", generalPurposeFlag.isLzmaEosMarker() ? "yes" : "no");
- else if (compressionMethod == CompressionMethod.DEFLATE || compressionMethod == CompressionMethod.ENHANCED_DEFLATE)
- printLine(out, " compression sub-type (deflation):", generalPurposeFlag.getCompressionLevel().getTitle());
+ printLine(out,
+ " end-of-stream (EOS) marker:",
+ generalPurposeFlag.isLzmaEosMarker() ? "yes" : "no");
+ else if (compressionMethod == CompressionMethod.DEFLATE
+ || compressionMethod == CompressionMethod.ENHANCED_DEFLATE)
+ printLine(out,
+ " compression sub-type (deflation):",
+ generalPurposeFlag.getCompressionLevel().getTitle());
}
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryView.java
index b787db0fa..e97d2ad0b 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryView.java
@@ -57,7 +57,9 @@ public EndCentralDirectoryView(EndCentralDirectory ecd,
public boolean printTextInfo(PrintStream out) {
printTitle(out, EndCentralDirectory.SIGNATURE, "End of Central directory record", block);
printLine(out, String.format("part number of this part (%04X):", ecd.getTotalDisks()), ecd.getTotalDisks() + 1);
- printLine(out, String.format("part number of start of central dir (%04X):", ecd.getMainDiskNo()), ecd.getMainDiskNo() + 1);
+ printLine(out,
+ String.format("part number of start of central dir (%04X):", ecd.getMainDiskNo()),
+ ecd.getMainDiskNo() + 1);
printLine(out, "number of entries in central dir in this part:", ecd.getDiskEntries());
printTotalEntries(out);
printLine(out, "size of central dir:", String.format("%d bytes", ecd.getCentralDirectorySize()));
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesView.java
index f0dcf2d11..80ecd8ee6 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesView.java
@@ -46,7 +46,9 @@ public boolean printTextInfo(PrintStream out) {
printLine(out, "external file attributes:", String.format("0x%08X", val));
printLine(out, String.format(" WINDOWS (0x%02X):", val & 0xFF), externalFileAttributes.getDetailsWin());
- printLine(out, String.format(" POSIX (0x%06X):", val >> 8 & 0xFFFFFF), externalFileAttributes.getDetailsPosix());
+ printLine(out,
+ String.format(" POSIX (0x%06X):", val >> 8 & 0xFFFFFF),
+ externalFileAttributes.getDetailsPosix());
return true;
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagView.java
index 50416250b..a1fe38d23 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagView.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.apache.commons.lang3.StringUtils;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
+import org.apache.commons.lang3.StringUtils;
+
import java.io.PrintStream;
import java.util.Objects;
@@ -34,7 +35,10 @@ public final class GeneralPurposeFlagView extends BaseView {
private final GeneralPurposeFlag generalPurposeFlag;
private final CompressionMethod compressionMethod;
- public GeneralPurposeFlagView(GeneralPurposeFlag generalPurposeFlag, CompressionMethod compressionMethod, int offs, int columnWidth) {
+ public GeneralPurposeFlagView(GeneralPurposeFlag generalPurposeFlag,
+ CompressionMethod compressionMethod,
+ int offs,
+ int columnWidth) {
super(offs, columnWidth);
this.generalPurposeFlag = generalPurposeFlag;
this.compressionMethod = compressionMethod;
@@ -48,13 +52,17 @@ public boolean printTextInfo(PrintStream out) {
int val = generalPurposeFlag.getAsInt(compressionMethod);
printLine(out, String.format("general purpose bit flag (0x%04X) (bit 15..0):", val),
- String.format("%s.%s %s.%s",
- StringUtils.leftPad(Integer.toBinaryString(val >> 12 & 0xF), 4, '0'),
- StringUtils.leftPad(Integer.toBinaryString(val >> 8 & 0xF), 4, '0'),
- StringUtils.leftPad(Integer.toBinaryString(val >> 4 & 0xF), 4, '0'),
- StringUtils.leftPad(Integer.toBinaryString(val & 0xF), 4, '0')));
- printLine(out, " file security status (bit 0):", generalPurposeFlag.isEncrypted() ? "encrypted" : "not encrypted");
- printLine(out, " data descriptor (bit 3):", generalPurposeFlag.isDataDescriptorAvailable() ? "yes" : "no");
+ String.format("%s.%s %s.%s",
+ StringUtils.leftPad(Integer.toBinaryString(val >> 12 & 0xF), 4, '0'),
+ StringUtils.leftPad(Integer.toBinaryString(val >> 8 & 0xF), 4, '0'),
+ StringUtils.leftPad(Integer.toBinaryString(val >> 4 & 0xF), 4, '0'),
+ StringUtils.leftPad(Integer.toBinaryString(val & 0xF), 4, '0')));
+ printLine(out,
+ " file security status (bit 0):",
+ generalPurposeFlag.isEncrypted() ? "encrypted" : "not encrypted");
+ printLine(out,
+ " data descriptor (bit 3):",
+ generalPurposeFlag.isDataDescriptorAvailable() ? "yes" : "no");
printLine(out, " strong encryption (bit 6):", generalPurposeFlag.isStrongEncryption() ? "yes" : "no");
printLine(out, " UTF-8 names (bit 11):", generalPurposeFlag.isUtf8() ? "yes" : "no");
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/VersionView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/VersionView.java
index ce35ce5b9..355ecbcd0 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/VersionView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/VersionView.java
@@ -52,7 +52,9 @@ private boolean printVersionMadeBy(PrintStream out) {
Version.FileSystem fileSystem = versionMadeBy.getFileSystem();
int zipVersion = versionMadeBy.getZipSpecificationVersion();
- printLine(out, String.format("version made by operating system (%02d):", fileSystem.getCode()), fileSystem.getTitle());
+ printLine(out,
+ String.format("version made by operating system (%02d):", fileSystem.getCode()),
+ fileSystem.getTitle());
printLine(out, String.format("version made by zip software (%02d):", zipVersion), zipVersion / 10.);
return true;
@@ -65,7 +67,9 @@ private boolean printVersionToExtract(PrintStream out) {
Version.FileSystem fileSystem = versionToExtract.getFileSystem();
int zipVersion = versionToExtract.getZipSpecificationVersion();
- printLine(out, String.format("operat. system version needed to extract (%02d):", fileSystem.getCode()), fileSystem.getTitle());
+ printLine(out,
+ String.format("operat. system version needed to extract (%02d):", fileSystem.getCode()),
+ fileSystem.getTitle());
printLine(out, String.format("unzip software version needed to extract (%02d):", zipVersion), zipVersion / 10.);
return true;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureView.java
index 5965b1de1..c6364bef6 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureView.java
@@ -36,7 +36,11 @@ public final class DigitalSignatureView extends BaseView {
private final CentralDirectory.DigitalSignature digitalSignature;
private final Block block;
- public DigitalSignatureView(CentralDirectory.DigitalSignature digitalSignature, Block block, int offs, int columnWidth, long totalDisks) {
+ public DigitalSignatureView(CentralDirectory.DigitalSignature digitalSignature,
+ Block block,
+ int offs,
+ int columnWidth,
+ long totalDisks) {
super(offs, columnWidth, totalDisks);
this.digitalSignature = requireNotNull(digitalSignature, "DigitalSignatureView.centralDirectory");
this.block = requireNotNull(block, "DigitalSignatureView.block");
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryView.java
index 47e22973d..1d674131b 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryView.java
@@ -49,7 +49,9 @@ public boolean printTextInfo(PrintStream out) {
super.printTextInfo(out);
if (extensibleDataSector != null) {
- new CompressionMethodView(extensibleDataSector.getCompressionMethod(), offs, columnWidth).printTextInfo(out);
+ new CompressionMethodView(extensibleDataSector.getCompressionMethod(),
+ offs,
+ columnWidth).printTextInfo(out);
printEncryptionAlgorithm(out);
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedFileHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedFileHeaderView.java
index 3c345b40c..28770a3fa 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedFileHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedFileHeaderView.java
@@ -43,7 +43,9 @@ public EncryptedFileHeaderView(CentralDirectory.FileHeader fileHeader,
@Override
protected void printLocationTitle(PrintStream out, Block block) {
- printLine(out, "- location in central directory:", String.format("%1$d (0x%1$08X) bytes", block.getRelativeOffs()));
+ printLine(out,
+ "- location in central directory:",
+ String.format("%1$d (0x%1$08X) bytes", block.getRelativeOffs()));
}
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderView.java
index ab7a46138..2530baef7 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderView.java
@@ -20,9 +20,9 @@
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
import ru.olegcherednik.zip4jvm.model.block.CentralDirectoryBlock;
+import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.view.BaseView;
import ru.olegcherednik.zip4jvm.view.CompressionMethodView;
import ru.olegcherednik.zip4jvm.view.ExternalFileAttributesView;
@@ -82,20 +82,34 @@ public boolean printTextInfo(PrintStream out) {
}
private void printTitle(PrintStream out) {
- printSubTitle(out, CentralDirectory.FileHeader.SIGNATURE, pos, '[' + charset.name() + "] " + fileHeader.getFileName(), block);
+ printSubTitle(out,
+ CentralDirectory.FileHeader.SIGNATURE,
+ pos,
+ '[' + charset.name() + "] " + fileHeader.getFileName(),
+ block);
}
private void printLocation(PrintStream out) {
- printLine(out, String.format("part number of this part (%04X):", fileHeader.getDiskNo()), String.valueOf(fileHeader.getDiskNo() + 1));
- printLine(out, "relative offset of local header:", String.format("%1$d (0x%1$08X) bytes", fileHeader.getLocalFileHeaderRelativeOffs()));
+ printLine(out,
+ String.format("part number of this part (%04X):", fileHeader.getDiskNo()),
+ String.valueOf(fileHeader.getDiskNo() + 1));
+ printLine(out,
+ "relative offset of local header:",
+ String.format("%1$d (0x%1$08X) bytes", fileHeader.getLocalFileHeaderRelativeOffs()));
}
private void printVersion(PrintStream out) {
- new VersionView(fileHeader.getVersionMadeBy(), fileHeader.getVersionToExtract(), offs, columnWidth).printTextInfo(out);
+ new VersionView(fileHeader.getVersionMadeBy(),
+ fileHeader.getVersionToExtract(),
+ offs,
+ columnWidth).printTextInfo(out);
}
private void printGeneralPurposeFlag(PrintStream out) {
- new GeneralPurposeFlagView(fileHeader.getGeneralPurposeFlag(), fileHeader.getCompressionMethod(), offs, columnWidth).printTextInfo(out);
+ new GeneralPurposeFlagView(fileHeader.getGeneralPurposeFlag(),
+ fileHeader.getCompressionMethod(),
+ offs,
+ columnWidth).printTextInfo(out);
}
private void printCompressionMethod(PrintStream out) {
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderView.java
index c173366d3..7a024194d 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderView.java
@@ -35,7 +35,7 @@ final class AesEncryptionHeaderView extends BaseView {
private final AesEncryptionHeaderBlock block;
private final long pos;
- public AesEncryptionHeaderView(AesEncryptionHeaderBlock block, long pos, int offs, int columnWidth, long totalDisks) {
+ AesEncryptionHeaderView(AesEncryptionHeaderBlock block, long pos, int offs, int columnWidth, long totalDisks) {
super(offs, columnWidth, totalDisks);
this.block = requireNotNull(block, "BlockAesEncryptionHeaderView.centralDirectory");
this.pos = pos;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/EncryptionHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/EncryptionHeaderView.java
index dd4a92bb8..9a5f34800 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/EncryptionHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/EncryptionHeaderView.java
@@ -20,9 +20,9 @@
import ru.olegcherednik.zip4jvm.crypto.strong.DecryptionHeader;
import ru.olegcherednik.zip4jvm.model.block.crypto.AesEncryptionHeaderBlock;
-import ru.olegcherednik.zip4jvm.model.block.crypto.strong.DecryptionHeaderBlock;
import ru.olegcherednik.zip4jvm.model.block.crypto.EncryptionHeaderBlock;
import ru.olegcherednik.zip4jvm.model.block.crypto.PkwareEncryptionHeaderBlock;
+import ru.olegcherednik.zip4jvm.model.block.crypto.strong.DecryptionHeaderBlock;
import ru.olegcherednik.zip4jvm.view.BaseView;
import ru.olegcherednik.zip4jvm.view.crypto.strong.DecryptionHeaderView;
@@ -40,7 +40,11 @@ public final class EncryptionHeaderView extends BaseView {
private final EncryptionHeaderBlock block;
private final long pos;
- public EncryptionHeaderView(DecryptionHeader decryptionHeader, EncryptionHeaderBlock block, long pos, int offs, int columnWidth,
+ public EncryptionHeaderView(DecryptionHeader decryptionHeader,
+ EncryptionHeaderBlock block,
+ long pos,
+ int offs,
+ int columnWidth,
long totalDisks) {
super(offs, columnWidth, totalDisks);
this.decryptionHeader = decryptionHeader;
@@ -51,11 +55,24 @@ public EncryptionHeaderView(DecryptionHeader decryptionHeader, EncryptionHeaderB
@Override
public boolean printTextInfo(PrintStream out) {
if (block instanceof AesEncryptionHeaderBlock)
- new AesEncryptionHeaderView((AesEncryptionHeaderBlock)block, pos, offs, columnWidth, totalDisks).printTextInfo(out);
+ new AesEncryptionHeaderView((AesEncryptionHeaderBlock) block,
+ pos,
+ offs,
+ columnWidth,
+ totalDisks).printTextInfo(out);
else if (block instanceof PkwareEncryptionHeaderBlock)
- new PkwareEncryptionHeaderView((PkwareEncryptionHeaderBlock)block, pos, offs, columnWidth, totalDisks).printTextInfo(out);
+ new PkwareEncryptionHeaderView((PkwareEncryptionHeaderBlock) block,
+ pos,
+ offs,
+ columnWidth,
+ totalDisks).printTextInfo(out);
else if (block instanceof DecryptionHeaderBlock)
- new DecryptionHeaderView(decryptionHeader, (DecryptionHeaderBlock)block, pos, offs, columnWidth, totalDisks).printTextInfo(out);
+ new DecryptionHeaderView(decryptionHeader,
+ (DecryptionHeaderBlock) block,
+ pos,
+ offs,
+ columnWidth,
+ totalDisks).printTextInfo(out);
return true;
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderView.java
index b2c98a581..d711dee66 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderView.java
@@ -35,7 +35,11 @@ final class PkwareEncryptionHeaderView extends BaseView {
private final PkwareEncryptionHeaderBlock block;
private final long pos;
- public PkwareEncryptionHeaderView(PkwareEncryptionHeaderBlock block, long pos, int offs, int columnWidth, long totalDisks) {
+ PkwareEncryptionHeaderView(PkwareEncryptionHeaderBlock block,
+ long pos,
+ int offs,
+ int columnWidth,
+ long totalDisks) {
super(offs, columnWidth, totalDisks);
this.block = requireNotNull(block, "PkwareEncryptionHeaderView.centralDirectory");
this.pos = pos;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/strong/DecryptionHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/strong/DecryptionHeaderView.java
index 79ec77bc3..9ba07656a 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/strong/DecryptionHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/crypto/strong/DecryptionHeaderView.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.crypto.strong;
-import org.apache.commons.lang3.ArrayUtils;
import ru.olegcherednik.zip4jvm.crypto.strong.DecryptionHeader;
import ru.olegcherednik.zip4jvm.crypto.strong.EncryptionAlgorithm;
import ru.olegcherednik.zip4jvm.crypto.strong.Flags;
@@ -30,6 +29,8 @@
import ru.olegcherednik.zip4jvm.view.SizeView;
import ru.olegcherednik.zip4jvm.view.crypto.RecipientView;
+import org.apache.commons.lang3.ArrayUtils;
+
import java.io.PrintStream;
import java.util.Optional;
@@ -101,7 +102,8 @@ private void printFlags(PrintStream out) {
}
private void printEncryptedRandomData(PrintStream out) {
- byte[] encryptedRandomData = Optional.ofNullable(decryptionHeader.getEncryptedRandomData()).orElse(ArrayUtils.EMPTY_BYTE_ARRAY);
+ byte[] encryptedRandomData = Optional.ofNullable(decryptionHeader.getEncryptedRandomData())
+ .orElse(ArrayUtils.EMPTY_BYTE_ARRAY);
printLine(out, "length of encrypted random data:", String.format("%d bytes", encryptedRandomData.length));
new ByteArrayHexView(encryptedRandomData, offs, columnWidth).printTextInfo(out);
}
@@ -113,7 +115,8 @@ private void printHashAlgorithm(PrintStream out) {
}
private void printPasswordValidationData(PrintStream out) {
- byte[] passwordValidationData = Optional.ofNullable(decryptionHeader.getPasswordValidationData()).orElse(ArrayUtils.EMPTY_BYTE_ARRAY);
+ byte[] passwordValidationData = Optional.ofNullable(decryptionHeader.getPasswordValidationData()).orElse(
+ ArrayUtils.EMPTY_BYTE_ARRAY);
printLine(out, "password validation data:", String.format("%d bytes", passwordValidationData.length));
new ByteArrayHexView(passwordValidationData, offs, columnWidth).printTextInfo(out);
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorView.java
index 055337f4d..bec4bbbb0 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorView.java
@@ -36,7 +36,12 @@ public final class DataDescriptorView extends BaseView {
private final Block block;
private final long pos;
- public DataDescriptorView(DataDescriptor dataDescriptor, Block block, long pos, int offs, int columnWidth, long totalDisks) {
+ public DataDescriptorView(DataDescriptor dataDescriptor,
+ Block block,
+ long pos,
+ int offs,
+ int columnWidth,
+ long totalDisks) {
super(offs, columnWidth, totalDisks);
this.dataDescriptor = dataDescriptor;
this.block = block;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/entry/LocalFileHeaderView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/entry/LocalFileHeaderView.java
index 955877a78..e485ce5fb 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/entry/LocalFileHeaderView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/entry/LocalFileHeaderView.java
@@ -18,8 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.entry;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
@@ -38,6 +36,9 @@
import ru.olegcherednik.zip4jvm.view.VersionView;
import ru.olegcherednik.zip4jvm.view.extrafield.ExtraFieldView;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
import java.io.PrintStream;
import java.nio.charset.Charset;
import java.util.Optional;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordView.java
index b293ac853..613bdf89f 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordView.java
@@ -18,11 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
-import ru.olegcherednik.zip4jvm.view.CompressionMethodView;
+import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
import ru.olegcherednik.zip4jvm.view.BaseView;
+import ru.olegcherednik.zip4jvm.view.CompressionMethodView;
/**
* @author Oleg Cherednik
@@ -36,15 +36,18 @@ public static Builder builder() {
private AesExtraFieldRecordView(Builder builder) {
super(builder, (record, view, out) -> {
- view.printLine(out, " Encryption Tag Version:", String.format("%s-%d", record.getVendor(), record.getVersionNumber()));
+ view.printLine(out,
+ " Encryption Tag Version:",
+ String.format("%s-%d", record.getVendor(), record.getVersionNumber()));
view.printLine(out, " Encryption Key Bits:", record.getStrength().getSize());
compressionMethodView(record, view, builder).printTextInfo(out);
});
}
- private static CompressionMethodView compressionMethodView(AesExtraFieldRecord record,
- BaseView view,
- Builder builder) {
+ private static CompressionMethodView compressionMethodView(
+ AesExtraFieldRecord record,
+ BaseView view,
+ Builder builder) {
CompressionMethod compressionMethod = record.getCompressionMethod();
GeneralPurposeFlag generalPurposeFlag = builder.getGeneralPurposeFlag();
int offs = view.getOffs() + 2;
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Builder.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Builder.java
index dca663232..79aaf6d53 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Builder.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Builder.java
@@ -18,16 +18,19 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import lombok.Getter;
-import org.apache.commons.lang3.ArrayUtils;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
+import lombok.Getter;
+import org.apache.commons.lang3.ArrayUtils;
+
import java.util.Objects;
import java.util.function.Function;
/**
+ * @param {@link PkwareExtraField.Record}
+ * @param {@link ExtraFieldRecordView}
* @author Oleg Cherednik
* @since 03.12.2019
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordView.java
index 8f7e61126..ad7f1f67c 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordView.java
@@ -31,7 +31,8 @@ public static Builder(ExtendedTimestampExtraFieldRecordView::new);
}
- private ExtendedTimestampExtraFieldRecordView(Builder builder) {
+ private ExtendedTimestampExtraFieldRecordView(
+ Builder builder) {
super(builder, (record, view, out) -> {
if (record.getFlag().isLastModificationTime() && record.getLastModificationTime() >= 0)
view.printLine(out, " Last Modified Date:", ZipUtils.utcDateTime(record.getLastModificationTime()));
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldRecordView.java
index dfae6e6c8..90c6cdd1a 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldRecordView.java
@@ -18,14 +18,15 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.view.BaseView;
import java.io.PrintStream;
import java.util.regex.Pattern;
/**
+ * @param {@link PkwareExtraField.Record}
* @author Oleg Cherednik
* @since 24.11.2019
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldView.java
index b63b54b57..c44395804 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtraFieldView.java
@@ -20,7 +20,6 @@
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
import ru.olegcherednik.zip4jvm.model.Zip64;
-import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.block.ExtraFieldBlock;
import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
@@ -48,21 +47,21 @@ public final class ExtraFieldView extends BaseView {
private final Function> createView = record -> {
if (record instanceof NtfsTimestampExtraFieldRecord)
- return createView((NtfsTimestampExtraFieldRecord)record);
+ return createView((NtfsTimestampExtraFieldRecord) record);
if (record instanceof InfoZipOldUnixExtraFieldRecord)
- return createView((InfoZipOldUnixExtraFieldRecord)record);
+ return createView((InfoZipOldUnixExtraFieldRecord) record);
if (record instanceof InfoZipNewUnixExtraFieldRecord)
- return createView((InfoZipNewUnixExtraFieldRecord)record);
+ return createView((InfoZipNewUnixExtraFieldRecord) record);
if (record instanceof ExtendedTimestampExtraFieldRecord)
- return createView((ExtendedTimestampExtraFieldRecord)record);
+ return createView((ExtendedTimestampExtraFieldRecord) record);
if (record instanceof Zip64.ExtendedInfo)
- return createView((Zip64.ExtendedInfo)record);
+ return createView((Zip64.ExtendedInfo) record);
if (record instanceof AesExtraFieldRecord)
- return createView((AesExtraFieldRecord)record);
+ return createView((AesExtraFieldRecord) record);
if (record instanceof StrongEncryptionHeaderExtraFieldRecord)
- return createView((StrongEncryptionHeaderExtraFieldRecord)record);
+ return createView((StrongEncryptionHeaderExtraFieldRecord) record);
if (record instanceof AlignmentExtraFieldRecord)
- return createView((AlignmentExtraFieldRecord)record);
+ return createView((AlignmentExtraFieldRecord) record);
return createView(record);
};
@@ -159,11 +158,9 @@ private AlignmentExtraFieldRecordView createView(AlignmentExtraFieldRecord recor
}
private UnknownExtraFieldRecordView createView(PkwareExtraField.Record record) {
- Block block = this.block.getRecord(record.getSignature());
-
return UnknownExtraFieldRecordView.builder()
.record(record)
- .block(block)
+ .block(this.block.getRecord(record.getSignature()))
.position(offs, columnWidth, totalDisks).build();
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordView.java
index 4709f761f..f60753d8a 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordView.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.apache.commons.lang3.StringUtils;
import ru.olegcherednik.zip4jvm.model.extrafield.records.InfoZipNewUnixExtraFieldRecord;
-import ru.olegcherednik.zip4jvm.view.ByteArrayHexView;
import ru.olegcherednik.zip4jvm.view.BaseView;
+import ru.olegcherednik.zip4jvm.view.ByteArrayHexView;
+
+import org.apache.commons.lang3.StringUtils;
import java.io.PrintStream;
@@ -35,21 +36,24 @@ public static Builder(InfoZipNewUnixExtraFieldRecordView::new);
}
- private InfoZipNewUnixExtraFieldRecordView(Builder builder) {
+ private InfoZipNewUnixExtraFieldRecordView(
+ Builder builder) {
super(builder, new PrintConsumer() {
@Override
public void print(InfoZipNewUnixExtraFieldRecord record, BaseView view, PrintStream out) {
InfoZipNewUnixExtraFieldRecord.Payload payload = record.getPayload();
if (payload instanceof InfoZipNewUnixExtraFieldRecord.VersionOnePayload)
- print((InfoZipNewUnixExtraFieldRecord.VersionOnePayload)record.getPayload(), view, out);
+ print((InfoZipNewUnixExtraFieldRecord.VersionOnePayload) record.getPayload(), view, out);
else if (payload instanceof InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload)
- print((InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload)record.getPayload(), view, out);
+ print((InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload) record.getPayload(), view, out);
// TODO add final else
}
- private void print(InfoZipNewUnixExtraFieldRecord.VersionOnePayload payload, BaseView view, PrintStream out) {
+ private void print(InfoZipNewUnixExtraFieldRecord.VersionOnePayload payload,
+ BaseView view,
+ PrintStream out) {
view.printLine(out, " version:", String.valueOf(payload.getVersion()));
if (StringUtils.isNotBlank(payload.getUid()))
@@ -58,7 +62,9 @@ private void print(InfoZipNewUnixExtraFieldRecord.VersionOnePayload payload, Bas
view.printLine(out, " Group Identifier (GID):", payload.getGid());
}
- private void print(InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload payload, BaseView view, PrintStream out) {
+ private void print(InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload payload,
+ BaseView view,
+ PrintStream out) {
view.printLine(out, " version:", String.format("%d (unknown)", payload.getVersion()));
new ByteArrayHexView(payload.getData(), view.getOffs(), view.getColumnWidth()).printTextInfo(out);
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordView.java
index 89b3a20a8..c9e5425b7 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordView.java
@@ -33,7 +33,8 @@ public static Builder(InfoZipOldUnixExtraFieldRecordView::new);
}
- private InfoZipOldUnixExtraFieldRecordView(Builder builder) {
+ private InfoZipOldUnixExtraFieldRecordView(
+ Builder builder) {
super(builder, (record, view, out) -> {
view.printLine(out, " Last Modified Date:", ZipUtils.utcDateTime(record.getLastModificationTime()));
view.printLine(out, " Last Accessed Date:", ZipUtils.utcDateTime(record.getLastAccessTime()));
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordView.java
index db1590271..7421807e1 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordView.java
@@ -20,8 +20,8 @@
import ru.olegcherednik.zip4jvm.model.extrafield.records.NtfsTimestampExtraFieldRecord;
import ru.olegcherednik.zip4jvm.utils.ZipUtils;
-import ru.olegcherednik.zip4jvm.view.ByteArrayHexView;
import ru.olegcherednik.zip4jvm.view.BaseView;
+import ru.olegcherednik.zip4jvm.view.ByteArrayHexView;
import java.io.PrintStream;
@@ -35,7 +35,8 @@ public static Builder(NtfsTimestampExtraFieldRecordView::new);
}
- private NtfsTimestampExtraFieldRecordView(Builder builder) {
+ private NtfsTimestampExtraFieldRecordView(
+ Builder builder) {
super(builder, new PrintConsumer() {
@Override
public void print(NtfsTimestampExtraFieldRecord record, BaseView view, PrintStream out) {
@@ -43,22 +44,26 @@ public void print(NtfsTimestampExtraFieldRecord record, BaseView view, PrintStre
for (NtfsTimestampExtraFieldRecord.Tag tag : record.getTags()) {
if (tag instanceof NtfsTimestampExtraFieldRecord.OneTag)
- print((NtfsTimestampExtraFieldRecord.OneTag)tag, view, out);
+ print((NtfsTimestampExtraFieldRecord.OneTag) tag, view, out);
else if (tag instanceof NtfsTimestampExtraFieldRecord.UnknownTag)
- print((NtfsTimestampExtraFieldRecord.UnknownTag)tag, view, out);
+ print((NtfsTimestampExtraFieldRecord.UnknownTag) tag, view, out);
// TODO tag could be unknown for view
}
}
private void print(NtfsTimestampExtraFieldRecord.OneTag tag, BaseView view, PrintStream out) {
- view.printLine(out, String.format(" (0x%04X) Tag1:", tag.getSignature()), String.format("%d bytes", tag.getSize()));
+ view.printLine(out,
+ String.format(" (0x%04X) Tag1:", tag.getSignature()),
+ String.format("%d bytes", tag.getSize()));
view.printLine(out, " Creation Date:", ZipUtils.utcDateTime(tag.getCreationTime()));
view.printLine(out, " Last Modified Date:", ZipUtils.utcDateTime(tag.getLastModificationTime()));
view.printLine(out, " Last Accessed Date:", ZipUtils.utcDateTime(tag.getLastAccessTime()));
}
private void print(NtfsTimestampExtraFieldRecord.UnknownTag tag, BaseView view, PrintStream out) {
- view.printLine(out, String.format(" (0x%04X) Unknown Tag:", tag.getSignature()), String.format("%d bytes", tag.getSize()));
+ view.printLine(out,
+ String.format(" (0x%04X) Unknown Tag:", tag.getSignature()),
+ String.format("%d bytes", tag.getSize()));
new ByteArrayHexView(tag.getData(), view.getOffs(), view.getColumnWidth()).printTextInfo(out);
}
});
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/PrintConsumer.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/PrintConsumer.java
index 3b8eb703f..321a33739 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/PrintConsumer.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/PrintConsumer.java
@@ -24,6 +24,8 @@
import java.io.PrintStream;
/**
+ * @param {@link PkwareExtraField.Record}
+ * @param {@link BaseView}
* @author Oleg Cherednik
* @since 02.12.2019
*/
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/StrongEncryptionHeaderExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/StrongEncryptionHeaderExtraFieldRecordView.java
index 3ef7c7039..20fb78991 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/StrongEncryptionHeaderExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/StrongEncryptionHeaderExtraFieldRecordView.java
@@ -27,19 +27,24 @@
* @author Oleg Cherednik
* @since 16.02.2020
*/
-final class StrongEncryptionHeaderExtraFieldRecordView extends ExtraFieldRecordView {
+final class StrongEncryptionHeaderExtraFieldRecordView
+ extends ExtraFieldRecordView {
- public static Builder builder() {
+ public static Builder builder() {
return new Builder<>(StrongEncryptionHeaderExtraFieldRecordView::new);
}
- private StrongEncryptionHeaderExtraFieldRecordView(Builder builder) {
+ private StrongEncryptionHeaderExtraFieldRecordView(
+ Builder builder) {
super(builder, (record, view, out) -> {
EncryptionAlgorithm encryptionAlgorithm = record.getEncryptionAlgorithm();
Flags flags = record.getFlags();
view.printLine(out, " format:", record.getFormat());
- view.printLine(out, String.format(" encryption algorithm (0x%04X):", encryptionAlgorithm.getCode()), encryptionAlgorithm.getTitle());
+ view.printLine(out,
+ String.format(" encryption algorithm (0x%04X):", encryptionAlgorithm.getCode()),
+ encryptionAlgorithm.getTitle());
view.printLine(out, " encryption key bits:", record.getBitLength());
view.printLine(out, String.format(" flags (0x%02X):", flags.getCode()), flags.getTitle());
view.printLine(out, " encryption variable data:", String.format("%d bytes", record.getUnknown().length));
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordView.java
index 69715befd..298921dab 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordView.java
@@ -32,7 +32,11 @@ public static Builder buil
}
private UnknownExtraFieldRecordView(Builder builder) {
- super(builder, (record, view, out) -> new ByteArrayHexView(builder.getData(), view.getOffs(), view.getColumnWidth()).printTextInfo(out));
+ super(builder,
+ (record, view, out) -> new ByteArrayHexView(builder.getData(),
+ view.getOffs(),
+ view.getColumnWidth()).printTextInfo(out));
}
+
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoView.java
index a223df395..d7eca0145 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoView.java
@@ -18,8 +18,8 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.Zip64;
+import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
/**
* @author Oleg Cherednik
@@ -34,14 +34,21 @@ public static Builder builder() {
private Zip64ExtendedInfoView(Builder builder) {
super(builder, (record, view, out) -> {
if (record.getUncompressedSize() != PkwareExtraField.NO_DATA)
- view.printLine(out, " original compressed size:", String.format("%d bytes", record.getUncompressedSize()));
+ view.printLine(out,
+ " original compressed size:",
+ String.format("%d bytes", record.getUncompressedSize()));
if (record.getCompressedSize() != PkwareExtraField.NO_DATA)
- view.printLine(out, " original uncompressed size:", String.format("%d bytes", record.getCompressedSize()));
+ view.printLine(out,
+ " original uncompressed size:",
+ String.format("%d bytes", record.getCompressedSize()));
if (record.getLocalFileHeaderRelativeOffs() != PkwareExtraField.NO_DATA)
view.printLine(out, " original relative offset of local header:",
- String.format("%1$d (0x%1$08X) bytes", record.getLocalFileHeaderRelativeOffs()));
+ String.format("%1$d (0x%1$08X) bytes", record.getLocalFileHeaderRelativeOffs()));
if (record.getDiskNo() != PkwareExtraField.NO_DATA)
- view.printLine(out, String.format(" original part number of this part (%04X):", record.getDiskNo()), record.getDiskNo());
+ view.printLine(out,
+ String.format(" original part number of this part (%04X):", record.getDiskNo()),
+ record.getDiskNo());
});
}
+
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorView.java
index 55e9ded76..60f261f2e 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorView.java
@@ -48,7 +48,9 @@ public EndCentralDirectoryLocatorView(Zip64.EndCentralDirectoryLocator locator,
@Override
public boolean printTextInfo(PrintStream out) {
printTitle(out, Zip64.EndCentralDirectoryLocator.SIGNATURE, "ZIP64 End of Central directory locator", block);
- printLine(out, String.format("part number of new-end-of-central-dir (%04X):", locator.getMainDiskNo()), locator.getMainDiskNo() + 1);
+ printLine(out,
+ String.format("part number of new-end-of-central-dir (%04X):", locator.getMainDiskNo()),
+ locator.getMainDiskNo() + 1);
printLine(out, "relative offset of new-end-of-central-dir:",
String.format("%1$d (0x%1$08X) bytes", locator.getEndCentralDirectoryRelativeOffs()));
printLine(out, "total number of parts in archive:", locator.getTotalDisks());
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryView.java
index cc5727770..8235f09d0 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryView.java
@@ -49,14 +49,20 @@ public EndCentralDirectoryView(Zip64.EndCentralDirectory ecd,
@Override
public boolean printTextInfo(PrintStream out) {
printTitle(out, Zip64.EndCentralDirectory.SIGNATURE, "ZIP64 End of Central directory record", block);
- printLine(out, "number of bytes in rest of record:", String.format("%d bytes", ecd.getEndCentralDirectorySize()));
+ printLine(out,
+ "number of bytes in rest of record:",
+ String.format("%d bytes", ecd.getEndCentralDirectorySize()));
printVersion(out);
printLine(out, String.format("part number of this part (%04d):", ecd.getDiskNo()), ecd.getDiskNo() + 1);
- printLine(out, String.format("part number of start of central dir (%04d):", ecd.getMainDiskNo()), ecd.getMainDiskNo() + 1);
+ printLine(out,
+ String.format("part number of start of central dir (%04d):", ecd.getMainDiskNo()),
+ ecd.getMainDiskNo() + 1);
printLine(out, "number of entries in central dir in this part:", ecd.getDiskEntries());
printLine(out, "total number of entries in central dir:", ecd.getTotalEntries());
printLine(out, "size of central dir:", String.format("%d bytes", ecd.getCentralDirectorySize()));
- printLine(out, "relative offset of central dir:", String.format("%1$d (0x%1$08X) bytes", ecd.getCentralDirectoryRelativeOffs()));
+ printLine(out,
+ "relative offset of central dir:",
+ String.format("%1$d (0x%1$08X) bytes", ecd.getCentralDirectoryRelativeOffs()));
return true;
}
diff --git a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorView.java b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorView.java
index c45adc73f..8d4eeff1c 100644
--- a/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorView.java
+++ b/src/main/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorView.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.zip64;
-import org.apache.commons.lang3.ArrayUtils;
import ru.olegcherednik.zip4jvm.crypto.strong.EncryptionAlgorithm;
import ru.olegcherednik.zip4jvm.crypto.strong.Flags;
import ru.olegcherednik.zip4jvm.crypto.strong.HashAlgorithm;
@@ -30,6 +29,8 @@
import ru.olegcherednik.zip4jvm.view.CompressionMethodView;
import ru.olegcherednik.zip4jvm.view.SizeView;
+import org.apache.commons.lang3.ArrayUtils;
+
import java.io.PrintStream;
import java.util.Optional;
@@ -49,7 +50,8 @@ public ExtensibleDataSectorView(Zip64.ExtensibleDataSector extensibleDataSector,
int offs,
int columnWidth) {
super(offs, columnWidth);
- this.extensibleDataSector = requireNotNull(extensibleDataSector, "ExtensibleDataSectorView.extensibleDataSector");
+ this.extensibleDataSector = requireNotNull(extensibleDataSector,
+ "ExtensibleDataSectorView.extensibleDataSector");
this.block = requireNotNull(block, "ExtensibleDataSectorView.block");
}
@@ -72,8 +74,12 @@ private void printCompressionMethod(PrintStream out) {
}
private void printSize(PrintStream out) {
- new SizeView("compressed size:", extensibleDataSector.getCompressedSize(), offs, columnWidth).printTextInfo(out);
- new SizeView("uncompressed size:", extensibleDataSector.getUncompressedSize(), offs, columnWidth).printTextInfo(out);
+ new SizeView("compressed size:",
+ extensibleDataSector.getCompressedSize(),
+ offs,
+ columnWidth).printTextInfo(out);
+ new SizeView("uncompressed size:", extensibleDataSector.getUncompressedSize(), offs, columnWidth).printTextInfo(
+ out);
}
private void printEncryptionAlgorithm(PrintStream out) {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/Foo.java b/src/test/java/ru/olegcherednik/zip4jvm/Foo.java
index 1a43231d0..6defd9532 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/Foo.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/Foo.java
@@ -18,8 +18,6 @@
*/
package ru.olegcherednik.zip4jvm;
-import ru.olegcherednik.zip4jvm.model.password.PasswordProvider;
-import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipInfoSettings;
import java.io.IOException;
@@ -27,12 +25,11 @@
import java.nio.file.Paths;
import java.util.concurrent.TimeUnit;
-import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.password;
-
/**
* @author Oleg Cherednik
* @since 19.10.2022
*/
+@SuppressWarnings("all")
public class Foo {
public static void main(String[] args) throws IOException {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ModifyCommentTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ModifyCommentTest.java
index 0b0e52957..fef3439de 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ModifyCommentTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ModifyCommentTest.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.apache.commons.lang3.StringUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.ZipModel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.apache.commons.lang3.StringUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -59,12 +60,14 @@ public static void removeDir() throws IOException {
}
public void shouldCreateNewZipWithComment() throws IOException {
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
- .build())
- .comment("Oleg Cherednik - Олег Чередник").build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .comment("Oleg Cherednik - Олег Чередник").build();
ZipIt.zip(zip).settings(settings).add(fileOlegCherednik);
assertThatZipFile(zip).exists().hasComment("Oleg Cherednik - Олег Чередник");
}
@@ -90,20 +93,20 @@ public void shouldAddCommentToEncryptedZip() throws IOException {
}
public void shouldSetCommentWithMaxLength() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- Files.createDirectories(zip.getParent());
- Files.copy(zipDeflateSolid, zip);
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
+ Files.createDirectories(srcZip.getParent());
+ Files.copy(zipDeflateSolid, srcZip);
- ZipMisc.zip(zip).setComment(StringUtils.repeat("_", ZipModel.MAX_COMMENT_SIZE));
- assertThatZipFile(zip).hasCommentSize(ZipModel.MAX_COMMENT_SIZE);
+ ZipMisc.zip(srcZip).setComment(StringUtils.repeat("_", ZipModel.MAX_COMMENT_SIZE));
+ assertThatZipFile(srcZip).hasCommentSize(ZipModel.MAX_COMMENT_SIZE);
}
public void shouldThrowExceptionWhenCommentIsOverMaxLength() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- Files.createDirectories(zip.getParent());
- Files.copy(zipDeflateSolid, zip);
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
+ Files.createDirectories(srcZip.getParent());
+ Files.copy(zipDeflateSolid, srcZip);
- assertThatThrownBy(() -> ZipMisc.zip(zip).setComment(StringUtils.repeat("_", ZipModel.MAX_COMMENT_SIZE + 1)))
+ assertThatThrownBy(() -> ZipMisc.zip(srcZip).setComment(StringUtils.repeat("_", ZipModel.MAX_COMMENT_SIZE + 1)))
.isInstanceOf(IllegalArgumentException.class);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/TestData.java b/src/test/java/ru/olegcherednik/zip4jvm/TestData.java
index f8dd55f0b..b8b3cdd2b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/TestData.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/TestData.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.IOException;
import java.nio.file.Files;
@@ -39,9 +40,9 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class TestData {
- public static final Path dirRoot = createTempDirectory("zip4jvm");
-// public static final Path dirRoot = Paths.get("/Users/o.cherednik/Documents/zip4jvm/foo");
-// public static final Path dirRoot = Paths.get("d:/zip4jvm/foo");
+ //public static final Path dirRoot = createTempDirectory("zip4jvm");
+ // public static final Path dirRoot = Paths.get("/Users/o.cherednik/Documents/zip4jvm/foo");
+ public static final Path dirRoot = Paths.get("d:/zip4jvm/foo");
public static final String dirNameSrcData = "data";
@@ -150,60 +151,65 @@ public final class TestData {
public static final Path zipDeflateSolidAes = dirRoot.resolve("deflate/solid/aes/src.zip");
// winrar
- public static final Path winRarStoreSolidZip = Paths.get("src/test/resources/winrar/store_solid_off.zip").toAbsolutePath();
- public static final Path winRarStoreSolidPkwareZip = Paths.get("src/test/resources/winrar/store_solid_pkware.zip").toAbsolutePath();
- public static final Path winRarStoreSolidAesZip = Paths.get("src/test/resources/winrar/store_solid_aes.zip").toAbsolutePath();
- public static final Path winRarDeflateSolidZip = Paths.get("src/test/resources/winrar/deflate_solid_off.zip").toAbsolutePath();
- public static final Path winRarDeflateSolidPkwareZip = Paths.get("src/test/resources/winrar/deflate_solid_pkware.zip").toAbsolutePath();
- public static final Path winRarDeflateSolidAesZip = Paths.get("src/test/resources/winrar/deflate_solid_aes.zip").toAbsolutePath();
+ private static final Path dirWinRar = Paths.get("src/test/resources/winrar").toAbsolutePath();
+ public static final Path winRarStoreSolidZip = dirWinRar.resolve("store_solid_off.zip");
+ public static final Path winRarStoreSolidPkwareZip = dirWinRar.resolve("store_solid_pkware.zip");
+ public static final Path winRarStoreSolidAesZip = dirWinRar.resolve("store_solid_aes.zip");
+ public static final Path winRarDeflateSolidZip = dirWinRar.resolve("deflate_solid_off.zip");
+ public static final Path winRarDeflateSolidPkwareZip = dirWinRar.resolve("deflate_solid_pkware.zip");
+ public static final Path winRarDeflateSolidAesZip = dirWinRar.resolve("deflate_solid_aes.zip");
// 7-Zip
- public static final Path sevenZipStoreSplitZip = Paths.get("src/test/resources/seven-zip/store_split_off/src.zip.001").toAbsolutePath();
- public static final Path sevenZipStoreSolidPkwareZip = Paths.get("src/test/resources/seven-zip/lzma_solid_aes.zip").toAbsolutePath();
- public static final Path sevenZipLzmaSolidZip = Paths.get("src/test/resources/seven-zip/lzma_solid_off.zip").toAbsolutePath();
- public static final Path sevenZipLzmaSolidAesZip = Paths.get("src/test/resources/seven-zip/lzma_solid_aes.zip").toAbsolutePath();
- public static final Path sevenZipZstdSolidZip = Paths.get("src/test/resources/seven-zip/zstd_solid_off.zip").toAbsolutePath();
- public static final Path sevenZipZstdSolidAesZip = Paths.get("src/test/resources/seven-zip/zstd_solid_aes.zip").toAbsolutePath();
+ private static final Path dirSevenZip = Paths.get("src/test/resources/seven-zip").toAbsolutePath();
+ public static final Path sevenZipStoreSplitZip = dirSevenZip.resolve("store_split_off/src.zip.001");
+ public static final Path sevenZipStoreSolidPkwareZip = dirSevenZip.resolve("lzma_solid_aes.zip");
+ public static final Path sevenZipLzmaSolidZip = dirSevenZip.resolve("lzma_solid_off.zip");
+ public static final Path sevenZipLzmaSolidAesZip = dirSevenZip.resolve("lzma_solid_aes.zip");
+ public static final Path sevenZipZstdSolidZip = dirSevenZip.resolve("zstd_solid_off.zip");
+ public static final Path sevenZipZstdSolidAesZip = dirSevenZip.resolve("zstd_solid_aes.zip");
// secure-zip
- public static final Path secureZipStoreSolidAesZip = Paths.get("src/test/resources/secure-zip/store_solid_aes.zip").toAbsolutePath();
- public static final Path secureZipStoreSplitZip = Paths.get("src/test/resources/secure-zip/store_split_off/src.zip").toAbsolutePath();
- public static final Path secureZipLzmaSolidZip = Paths.get("src/test/resources/secure-zip/lzma_solid_off.zip").toAbsolutePath();
- public static final Path secureZipBzip2SolidZip = Paths.get("src/test/resources/secure-zip/bzip2_solid_off.zip").toAbsolutePath();
- public static final Path secureZipBzip2SolidPkwareZip = Paths.get("src/test/resources/secure-zip/bzip2_solid_pkware.zip").toAbsolutePath();
- public static final Path secureZipEnhancedDeflateSolidZip = Paths.get("src/test/resources/secure-zip/ed_solid_off.zip").toAbsolutePath();
+ private static final Path dirSecureZip = Paths.get("src/test/resources/secure-zip").toAbsolutePath();
+ public static final Path secureZipStoreSolidAesZip = dirSecureZip.resolve("store_solid_aes.zip");
+ public static final Path secureZipStoreSplitZip = dirSecureZip.resolve("store_split_off/src.zip");
+ public static final Path secureZipLzmaSolidZip = dirSecureZip.resolve("lzma_solid_off.zip");
+ public static final Path secureZipBzip2SolidZip = dirSecureZip.resolve("bzip2_solid_off.zip");
+ public static final Path secureZipBzip2SolidPkwareZip = dirSecureZip.resolve("bzip2_solid_pkware.zip");
+ public static final Path secureZipEnhancedDeflateSolidZip = dirSecureZip.resolve("ed_solid_off.zip");
// strong
+ private static final Path dirSecureZipStrong = dirSecureZip.resolve("strong");
public static final Path secureZipStoreSolidAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/store_solid_aes256_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("store_solid_aes256_strong.zip");
public static final Path secureZipStoreSolidAes192StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/store_solid_aes192_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("store_solid_aes192_strong.zip");
public static final Path secureZipStoreSolidAes128StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/store_solid_aes128_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("store_solid_aes128_strong.zip");
public static final Path secureZipDeflateSolidAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/deflate_solid_aes256_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("deflate_solid_aes256_strong.zip");
public static final Path secureZipBzip2SolidAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/bzip2_solid_aes256_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("bzip2_solid_aes256_strong.zip");
public static final Path secureZipDeflate64SolidAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/deflate64_solid_aes256_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("deflate64_solid_aes256_strong.zip");
public static final Path secureZipLzmaSolidAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/lzma_solid_aes256_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("lzma_solid_aes256_strong.zip");
public static final Path secureZipBzip2SplitAes256StrongZip =
- Paths.get("src/test/resources/secure-zip/strong/bzip2_split_aes_strong/split_bzip2_aes_strong.zip").toAbsolutePath();
+ dirSecureZipStrong.resolve("bzip2_split_aes_strong/split_bzip2_aes_strong.zip");
// encrypted central directory
+ private static final Path dirSecureZipEcd = dirSecureZipStrong.resolve("ecd");
public static final Path secureZipStoreSolidAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/store_solid_aes256_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("store_solid_aes256_strong_ecd.zip");
public static final Path secureZipDeflateSolidAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/deflate_solid_aes256_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("deflate_solid_aes256_strong_ecd.zip");
public static final Path secureZipDeflate64SolidAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/deflate64_solid_aes256_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("deflate64_solid_aes256_strong_ecd.zip");
public static final Path secureZipBzip2SolidAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/bzip2_solid_aes256_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("bzip2_solid_aes256_strong_ecd.zip");
public static final Path secureZipLzmaSolidAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/lzma_solid_aes256_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("lzma_solid_aes256_strong_ecd.zip");
public static final Path secureZipBzip2SplitAes256StrongEcdZip =
- Paths.get("src/test/resources/secure-zip/strong/ecd/bzip2_split_aes_strong_ecd/split_bzip2_aes_strong_ecd.zip").toAbsolutePath();
+ dirSecureZipEcd.resolve("bzip2_split_aes_strong_ecd/split_bzip2_aes_strong_ecd.zip");
// apk
public static final Path appApk = Paths.get("src/test/resources/apk/app.apk").toAbsolutePath();
@@ -229,7 +235,7 @@ private static String getSymlinkName(String fileName, String prefix) {
private static Path createTempDirectory(String prefix) {
try {
return Files.createTempDirectory(prefix);
- } catch(IOException e) {
+ } catch (IOException e) {
throw new Zip4jvmException(e);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/TestDataAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/TestDataAssert.java
index d73cdf8d7..4c3e0c25d 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/TestDataAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/TestDataAssert.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.assertj.IDirectoryAssert;
import ru.olegcherednik.zip4jvm.assertj.IRegularFileAssert;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.utils.ZipUtils;
-import java.io.FileOutputStream;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.function.Consumer;
@@ -65,14 +66,19 @@ public final class TestDataAssert {
TestDataAssert.fileSaintPetersburgAssert.accept(dir.regularFile(fileNameSaintPetersburg));
TestDataAssert.fileSigSauerAssert.accept(dir.regularFile(fileNameSigSauer));
TestDataAssert.fileEmptyAssert.accept(dir.regularFile(fileNameEmpty));
-// TestDataAssert.zipFileOlegCherednikAssert.accept(dir.file(fileNameOlegCherednik));
+ // TestDataAssert.zipFileOlegCherednikAssert.accept(dir.file(fileNameOlegCherednik));
};
- public static final Consumer> fileMcdonnelDouglasAssert = file -> file.exists().isImage().hasSize(624_746);
- public static final Consumer> fileSaintPetersburgAssert = file -> file.exists().isImage().hasSize(1_074_836);
- public static final Consumer> fileSigSauerAssert = file -> file.exists().isImage().hasSize(431_478);
- public static final Consumer> fileEmptyAssert = file -> file.exists().hasSize(0);
- public static final Consumer> zipFileOlegCherednikAssert = file -> file.exists().hasSize(1_395_362);
+ public static final Consumer> fileMcdonnelDouglasAssert =
+ file -> file.exists().isImage().hasSize(624_746);
+ public static final Consumer> fileSaintPetersburgAssert =
+ file -> file.exists().isImage().hasSize(1_074_836);
+ public static final Consumer> fileSigSauerAssert =
+ file -> file.exists().isImage().hasSize(431_478);
+ public static final Consumer> fileEmptyAssert =
+ file -> file.exists().hasSize(0);
+ // public static final Consumer> zipFileOlegCherednikAssert =
+ // file -> file.exists().hasSize(1_395_362);
public static final Consumer> dirBikesAssert = dir -> {
dir.exists().hasEntries(4).hasRegularFiles(4);
@@ -82,10 +88,14 @@ public final class TestDataAssert {
TestDataAssert.fileSuzukiAssert.accept(dir.regularFile(fileNameSuzuki));
};
- public static final Consumer> fileDucatiAssert = file -> file.exists().isImage().hasSize(293_823);
- public static final Consumer> fileHondaAssert = file -> file.exists().isImage().hasSize(154_591);
- public static final Consumer> fileKawasakiAssert = file -> file.exists().isImage().hasSize(167_026);
- public static final Consumer> fileSuzukiAssert = file -> file.exists().isImage().hasSize(287_349);
+ public static final Consumer> fileDucatiAssert =
+ file -> file.exists().isImage().hasSize(293_823);
+ public static final Consumer> fileHondaAssert =
+ file -> file.exists().isImage().hasSize(154_591);
+ public static final Consumer> fileKawasakiAssert =
+ file -> file.exists().isImage().hasSize(167_026);
+ public static final Consumer> fileSuzukiAssert =
+ file -> file.exists().isImage().hasSize(287_349);
public static final Consumer> dirCarsAssert = dir -> {
dir.exists().hasEntries(3).hasRegularFiles(3);
@@ -94,14 +104,17 @@ public final class TestDataAssert {
TestDataAssert.fileWiesmannAssert.accept(dir.regularFile(fileNameWiesmann));
};
- public static final Consumer> fileBentleyAssert = file -> file.exists().isImage().hasSize(1_395_362);
- public static final Consumer> fileFerrariAssert = file -> file.exists().isImage().hasSize(320_894);
- public static final Consumer> fileWiesmannAssert = file -> file.exists().isImage().hasSize(729_633);
+ public static final Consumer> fileBentleyAssert =
+ file -> file.exists().isImage().hasSize(1_395_362);
+ public static final Consumer> fileFerrariAssert =
+ file -> file.exists().isImage().hasSize(320_894);
+ public static final Consumer> fileWiesmannAssert =
+ file -> file.exists().isImage().hasSize(729_633);
public static final Consumer> dirEmptyAssert = dir -> dir.exists().hasEntries(0);
public static void copyLarge(InputStream in, Path dst) throws IOException {
- ZipUtils.copyLarge(in, new FileOutputStream(dst.toFile()));
+ ZipUtils.copyLarge(in, Files.newOutputStream(dst.toFile().toPath()));
}
public static String getMethodName() {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSolidTest.java b/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSolidTest.java
index 1f9787fe0..1d4d930af 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSolidTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSolidTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm;
+import ru.olegcherednik.zip4jvm.model.Charsets;
+import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
+
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.model.Charsets;
-import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -107,11 +108,9 @@ public void shouldExtractZipArchiveWhenZipWasCreatedUnderMac() throws IOExceptio
UnzipIt.zip(zip).destDir(destDir).extract();
- int a = 0;
- a++;
-// TODO commented tests
-// assertThatDirectory(destDir).hasDirectories(0).hasFiles(2);
-// assertThatDirectory(destDir).file("fff - 副本.txt").exists();
+ // TODO commented tests
+ // assertThatDirectory(destDir).hasDirectories(0).hasFiles(2);
+ // assertThatDirectory(destDir).file("fff - 副本.txt").exists();
}
public void shouldExtractZipArchiveWhenUtf8Charset() throws IOException {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSplitTest.java
index 1cd385020..f755b86dc 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/UnzipItSplitTest.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.SplitPartNotFoundException;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -77,7 +78,8 @@ public void shouldUnzipRequiredFilesWhenSplit() throws IOException {
}
public void shouldThrowFileNotFoundExceptionAndNotExtractPartialFilesWhenZipPartMissing() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder()
.entrySettingsProvider(fileName -> entrySettings)
.splitSize(SIZE_1MB)
@@ -94,7 +96,8 @@ public void shouldThrowFileNotFoundExceptionAndNotExtractPartialFilesWhenZipPart
Path unzipDir = destDir.resolve("unzip");
Files.createDirectory(unzipDir);
- assertThatThrownBy(() -> UnzipIt.zip(zip).destDir(unzipDir).extract()).isExactlyInstanceOf(SplitPartNotFoundException.class);
+ assertThatThrownBy(() -> UnzipIt.zip(zip).destDir(unzipDir).extract()).isExactlyInstanceOf(
+ SplitPartNotFoundException.class);
assertThatDirectory(unzipDir).isEmpty();
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/Zip4jvmSuite.java b/src/test/java/ru/olegcherednik/zip4jvm/Zip4jvmSuite.java
index 8ced27295..fba566b38 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/Zip4jvmSuite.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/Zip4jvmSuite.java
@@ -18,13 +18,6 @@
*/
package ru.olegcherednik.zip4jvm;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import net.lingala.zip4j.ZipFile;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.FilenameUtils;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.BeforeSuite;
import ru.olegcherednik.zip4jvm.data.DefalteZipData;
import ru.olegcherednik.zip4jvm.data.StoreZipData;
import ru.olegcherednik.zip4jvm.data.SymlinkData;
@@ -33,6 +26,14 @@
import ru.olegcherednik.zip4jvm.utils.ZipUtils;
import ru.olegcherednik.zip4jvm.view.View;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import net.lingala.zip4j.ZipFile;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
@@ -128,7 +129,8 @@ public static Path copy(Path destDir, Path zip) throws IOException {
final String fileName = FilenameUtils.getBaseName(zip.getFileName().toString());
List parts = Files.walk(zip.getParent()).filter(Files::isRegularFile).filter(
- path -> FilenameUtils.getBaseName(path.getFileName().toString()).equals(fileName)).collect(Collectors.toList());
+ path -> FilenameUtils.getBaseName(path.getFileName().toString()).equals(fileName)).collect(
+ Collectors.toList());
for (Path part : parts)
Files.copy(part, destDir.resolve(part.getFileName()));
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipFileTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipFileTest.java
index 49dc3350b..7ce952d58 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipFileTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipFileTest.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.Encryption;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -75,7 +76,9 @@ public static void removeDir() throws IOException {
}
public void shouldCreateZipFileWhenUseZipFileAndAddFiles() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder()
+ .compression(Compression.STORE, CompressionLevel.NORMAL)
+ .build();
try (ZipFile.Writer zipFile = ZipIt.zip(file).entrySettings(entrySettings).open()) {
zipFile.add(fileBentley);
@@ -92,7 +95,9 @@ public void shouldCreateZipFileWhenUseZipFileAndAddFiles() throws IOException {
@Test(dependsOnMethods = "shouldCreateZipFileWhenUseZipFileAndAddFiles")
public void shouldAddFilesToExistedZipWhenUseZipFile() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder()
+ .compression(Compression.STORE, CompressionLevel.NORMAL)
+ .build();
try (ZipFile.Writer zipFile = ZipIt.zip(file).entrySettings(entrySettings).open()) {
zipFile.add(fileDucati);
@@ -113,29 +118,38 @@ public void shouldAddFilesToExistedZipWhenUseZipFile() throws IOException {
}
public void shouldCreateZipFileWithEntryCommentWhenUseZipFile() throws IOException {
- Path file = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
+ Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
Function entrySettingsProvider = fileName -> {
if ("bentley-continental.jpg".equals(fileName))
- return ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).comment("bentley-continental").build();
+ return ZipEntrySettings.builder()
+ .compression(Compression.STORE, CompressionLevel.NORMAL)
+ .comment("bentley-continental").build();
if ("ferrari-458-italia.jpg".equals(fileName))
- return ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).comment("ferrari-458-italia").build();
+ return ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
+ .comment("ferrari-458-italia").build();
if ("wiesmann-gt-mf5.jpg".equals(fileName))
- return ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).comment("wiesmann-gt-mf5").build();
+ return ZipEntrySettings.builder()
+ .compression(Compression.STORE, CompressionLevel.NORMAL)
+ .comment("wiesmann-gt-mf5").build();
return ZipEntrySettings.DEFAULT;
};
- try (ZipFile.Writer zipFile = ZipIt.zip(file).entrySettings(entrySettingsProvider).open()) {
+ try (ZipFile.Writer zipFile = ZipIt.zip(zip).entrySettings(entrySettingsProvider).open()) {
zipFile.add(fileBentley);
zipFile.add(fileFerrari);
zipFile.add(fileWiesmann);
}
- assertThatDirectory(file.getParent()).exists().hasOnlyRegularFiles(1);
- assertThatZipFile(file).exists().root().hasOnlyRegularFiles(3);
- assertThatZipFile(file).regularFile("bentley-continental.jpg").exists().hasSize(1_395_362).hasComment("bentley-continental");
- assertThatZipFile(file).regularFile("ferrari-458-italia.jpg").exists().hasSize(320_894).hasComment("ferrari-458-italia");
- assertThatZipFile(file).regularFile("wiesmann-gt-mf5.jpg").exists().hasSize(729_633).hasComment("wiesmann-gt-mf5");
+ assertThatDirectory(zip.getParent()).exists().hasOnlyRegularFiles(1);
+ assertThatZipFile(zip).exists().root().hasOnlyRegularFiles(3);
+ assertThatZipFile(zip).regularFile("bentley-continental.jpg")
+ .exists().hasSize(1_395_362).hasComment("bentley-continental");
+ assertThatZipFile(zip).regularFile("ferrari-458-italia.jpg")
+ .exists().hasSize(320_894).hasComment("ferrari-458-italia");
+ assertThatZipFile(zip).regularFile("wiesmann-gt-mf5.jpg")
+ .exists().hasSize(729_633).hasComment("wiesmann-gt-mf5");
}
// TODO add unzip tests for such ZipFile
@@ -155,20 +169,23 @@ public void shouldCreateZipFileWithEntryDifferentEncryptionAndPasswordWhenUseZip
return ZipEntrySettings.DEFAULT.toBuilder().password(Zip4jvmSuite.password).build();
};
- Path file = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
+ Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- try (ZipFile.Writer zipFile = ZipIt.zip(file).entrySettings(entrySettingsProvider).open()) {
+ try (ZipFile.Writer zipFile = ZipIt.zip(zip).entrySettings(entrySettingsProvider).open()) {
zipFile.add(fileBentley);
zipFile.add(fileFerrari);
zipFile.add(fileWiesmann);
}
- assertThatDirectory(file.getParent()).exists().hasOnlyRegularFiles(1);
+ assertThatDirectory(zip.getParent()).exists().hasOnlyRegularFiles(1);
// TODO commented test
-// assertThatZipFile(file).exists().rootEntry().hasSubDirectories(0).hasFiles(3);
-// assertThatZipFile(file).file("bentley-continental.jpg").exists().isImage().hasSize(1_395_362).hasComment("bentley-continental");
-// assertThatZipFile(file).file("ferrari-458-italia.jpg").exists().isImage().hasSize(320_894).hasComment("ferrari-458-italia");
-// assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists().isImage().hasSize(729_633).hasComment("wiesmann-gt-mf5");
+ // assertThatZipFile(file).exists().rootEntry().hasSubDirectories(0).hasFiles(3);
+ // assertThatZipFile(file).file("bentley-continental.jpg").exists()
+ // .isImage().hasSize(1_395_362).hasComment("bentley-continental");
+ // assertThatZipFile(file).file("ferrari-458-italia.jpg").exists()
+ // .isImage().hasSize(320_894).hasComment("ferrari-458-italia");
+ // assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists()
+ // .isImage().hasSize(729_633).hasComment("wiesmann-gt-mf5");
}
public void shouldCreateZipFileWithContentWhenUseZipFile() throws IOException {
@@ -198,11 +215,11 @@ public void shouldCreateZipFileWithContentWhenUseZipFile() throws IOException {
}
// TODO commented test
-// assertThatDirectory(file.getParent()).exists().hasSubDirectories(0).hasFiles(1);
-// assertThatZipFile(file).exists().rootEntry().hasSubDirectories(0).hasFiles(3);
-// assertThatZipFile(file).file("bentley-continental.jpg").exists().isImage().hasSize(1_395_362);
-// assertThatZipFile(file).file("ferrari-458-italia.jpg").exists().isImage().hasSize(320_894);
-// assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists().isImage().hasSize(729_633);
+ // assertThatDirectory(file.getParent()).exists().hasSubDirectories(0).hasFiles(1);
+ // assertThatZipFile(file).exists().rootEntry().hasSubDirectories(0).hasFiles(3);
+ // assertThatZipFile(file).file("bentley-continental.jpg").exists().isImage().hasSize(1_395_362);
+ // assertThatZipFile(file).file("ferrari-458-italia.jpg").exists().isImage().hasSize(320_894);
+ // assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists().isImage().hasSize(729_633);
}
public void shouldCreateZipFileWithEmptyDirectoryWhenAddEmptyDirectory() throws IOException {
@@ -219,8 +236,8 @@ public void shouldCreateZipFileWithEmptyDirectoryWhenAddEmptyDirectory() throws
assertThatDirectory(zip.getParent()).exists().hasOnlyRegularFiles(1);
assertThatZipFile(zip).exists().root().hasEntries(1).hasDirectories(1);
// TODO commented test
-// assertThatZipFile(file).file("bentley-continental.jpg").exists().isImage().hasSize(1_395_362);
-// assertThatZipFile(file).file("ferrari-458-italia.jpg").exists().isImage().hasSize(320_894);
-// assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists().isImage().hasSize(729_633);
+ // assertThatZipFile(file).file("bentley-continental.jpg").exists().isImage().hasSize(1_395_362);
+ // assertThatZipFile(file).file("ferrari-458-italia.jpg").exists().isImage().hasSize(320_894);
+ // assertThatZipFile(file).file("wiesmann-gt-mf5.jpg").exists().isImage().hasSize(729_633);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesNoSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesNoSplitTest.java
index 506afb836..d8b31adf8 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesNoSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesNoSplitTest.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.assertj.Zip4jvmAssertions;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -59,12 +60,14 @@ public static void removeDir() throws IOException {
}
public void shouldCreateNewZipWithFiles() throws IOException {
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
- .build())
- .build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .build();
List files = Arrays.asList(fileBentley, fileFerrari, fileWiesmann);
ZipIt.zip(zip).settings(settings).add(files);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesSplitTest.java
index fc5e1f113..2339ddb3a 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipFilesSplitTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.io.readers.ZipModelReader;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
@@ -31,6 +28,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -65,28 +66,33 @@ public static void removeDir() throws IOException {
public void shouldCreateNewSplitZipWithFiles() throws IOException {
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL).build())
- .splitSize(SIZE_1MB).build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build())
+ .splitSize(SIZE_1MB).build();
List files = Arrays.asList(fileBentley, fileFerrari, fileWiesmann);
ZipIt.zip(zip).settings(settings).add(files);
-// TODO commented tests
-// assertThatDirectory(zipFile.getParent()).exists().hasSubDirectories(0).hasFiles(1);
-// assertThatZipFile(zipFile).exists().rootEntry().hasSubDirectories(1).hasFiles(0);
-// assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipCarsDirAssert);
+ // TODO commented tests
+ // assertThatDirectory(zipFile.getParent()).exists().hasSubDirectories(0).hasFiles(1);
+ // assertThatZipFile(zipFile).exists().rootEntry().hasSubDirectories(1).hasFiles(0);
+ // assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipCarsDirAssert);
}
@SuppressWarnings("LocalVariableNamingConvention")
public void shouldSetTotalDiskWhenSplitZip64() throws IOException {
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- ZipSettings settings = ZipSettings.builder()
- .zip64(true)
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL).build())
- .splitSize(SIZE_1MB).build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .zip64(true)
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .splitSize(SIZE_1MB).build();
List files = Arrays.asList(fileBentley, fileFerrari, fileWiesmann);
ZipIt.zip(zip).settings(settings).add(files);
@@ -95,7 +101,8 @@ public void shouldSetTotalDiskWhenSplitZip64() throws IOException {
reader.readCentralData();
EndCentralDirectory endCentralDirectory = reader.getEndCentralDirectory();
- Zip64.EndCentralDirectoryLocator zip64EndCentralDirectoryLocator = reader.getZip64().getEndCentralDirectoryLocator();
+ Zip64.EndCentralDirectoryLocator zip64EndCentralDirectoryLocator = reader.getZip64()
+ .getEndCentralDirectoryLocator();
assertThat(endCentralDirectory.getMainDiskNo()).isEqualTo(ZipModel.MAX_TOTAL_DISKS);
assertThat(endCentralDirectory.getTotalDisks()).isEqualTo(ZipModel.MAX_TOTAL_DISKS);
@@ -107,11 +114,14 @@ public void shouldSetTotalDiskWhenSplitZip64() throws IOException {
public void shouldSetTotalDiskWhenSplit() throws IOException {
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL).build())
- .splitSize(SIZE_1MB).build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .splitSize(SIZE_1MB).build();
List files = Arrays.asList(fileBentley, fileFerrari, fileWiesmann);
ZipIt.zip(zip).settings(settings).add(files);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderNoSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderNoSplitTest.java
index 6262e7980..33e78a437 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderNoSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderNoSplitTest.java
@@ -18,17 +18,18 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.assertj.core.api.Assertions;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Ignore;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.assertj.Zip4jvmAssertions;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.assertj.core.api.Assertions;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Ignore;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -58,12 +59,13 @@ public static void removeDir() throws IOException {
@Test
public void shouldCreateNewZipWithFolder() throws IOException {
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
- .build())
- .build();
+ ZipSettings settings = ZipSettings
+ .builder().entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .build();
ZipIt.zip(zip).settings(settings).add(dirCars);
Zip4jvmAssertions.assertThatDirectory(zip.getParent()).exists().hasOnlyRegularFiles(1);
@@ -71,28 +73,31 @@ public void shouldCreateNewZipWithFolder() throws IOException {
Zip4jvmAssertions.assertThatZipFile(zip).directory("cars/").matches(TestDataAssert.dirCarsAssert);
}
- @Test(dependsOnMethods = "shouldCreateNewZipWithFolder")
- @Ignore
- public void shouldAddFolderToExistedZip() throws IOException {
- Assertions.assertThat(Files.exists(zip)).isTrue();
- Assertions.assertThat(Files.isRegularFile(zip)).isTrue();
-
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
- .build())
- .build();
-
-
- // TODO commented test
-// ZipIt.add(zip, Zip4jvmSuite.starWarsDir, settings);
-//
-// Zip4jvmAssertions.assertThatDirectory(ZipFolderNoSplitTest.zip.getParent()).exists().hasSubDirectories(0).hasFiles(1);
-// Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).exists().rootEntry().hasSubDirectories(2).hasFiles(0);
-// Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).directory("cars/").matches(TestDataAssert.zipCarsDirAssert);
-// Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).directory("Star Wars/").matches(TestDataAssert.zipStarWarsDirAssert);
- }
+ // @Test(dependsOnMethods = "shouldCreateNewZipWithFolder")
+ // @Ignore
+ // public void shouldAddFolderToExistedZip() throws IOException {
+ // Assertions.assertThat(Files.exists(zip)).isTrue();
+ // Assertions.assertThat(Files.isRegularFile(zip)).isTrue();
+ //
+ // ZipSettings settings = ZipSettings.builder()
+ // .entrySettingsProvider(fileName ->
+ // ZipEntrySettings.builder()
+ // .compression(Compression.DEFLATE,
+ // CompressionLevel.NORMAL)
+ // .build())
+ // .build();
+ // TODO commented test
+ // ZipIt.add(zip, Zip4jvmSuite.starWarsDir, settings);
+ //
+ // Zip4jvmAssertions.assertThatDirectory(ZipFolderNoSplitTest.zip.getParent()).exists()
+ // .hasSubDirectories(0).hasFiles(1);
+ // Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).exists().rootEntry()
+ // .hasSubDirectories(2).hasFiles(0);
+ // Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).directory("cars/")
+ // .matches(TestDataAssert.zipCarsDirAssert);
+ // Zip4jvmAssertions.assertThatZipFile(ZipFolderNoSplitTest.zip).directory("Star Wars/")
+ // .matches(TestDataAssert.zipStarWarsDirAssert);
+ //}
@Test(dependsOnMethods = "shouldAddFolderToExistedZip")
@Ignore
@@ -100,19 +105,22 @@ public void shouldAddEmptyDirectoryToExistedZip() throws IOException {
Assertions.assertThat(Files.exists(zip)).isTrue();
Assertions.assertThat(Files.isRegularFile(zip)).isTrue();
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
- .build())
- .build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build())
+ .build();
ZipIt.zip(zip).settings(settings).add(dirEmpty);
Zip4jvmAssertions.assertThatDirectory(zip.getParent()).exists().hasOnlyRegularFiles(1);
Zip4jvmAssertions.assertThatZipFile(zip).exists().root().hasEntries(3).hasDirectories(3);
Zip4jvmAssertions.assertThatZipFile(zip).directory("cars/").matches(TestDataAssert.dirCarsAssert);
// TODO commented test
-// Zip4jvmAssertions.assertThatZipFile(zip).directory("Star Wars/").matches(TestDataAssert.zipStarWarsDirAssert);
+ // Zip4jvmAssertions.assertThatZipFile(zip).directory("Star Wars/")
+ // =.matches(TestDataAssert.zipStarWarsDirAssert);
Zip4jvmAssertions.assertThatZipFile(zip).directory("empty_dir/").matches(TestDataAssert.dirEmptyAssert);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderSplitTest.java
index c9e87ce9d..c48f10e47 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipFolderSplitTest.java
@@ -18,14 +18,15 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -57,25 +58,32 @@ public static void removeDir() throws IOException {
@Test
public void shouldCreateNewZipWithFolder() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE, CompressionLevel.NORMAL)
+ .build();
+ ZipSettings settings = ZipSettings.builder()
+ .entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB)
+ .build();
ZipIt.zip(zip).settings(settings).add(contentDirSrc);
assertThatDirectory(zip.getParent()).exists().hasEntries(6).hasRegularFiles(6);
assertThat(Files.exists(zip)).isTrue();
assertThat(Files.isRegularFile(zip)).isTrue();
// TODO ZipFile does not read split archive
-// assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipRootDirAssert);
+ // assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipRootDirAssert);
}
-// TODO commented tests
-// @Test(dependsOnMethods = "shouldCreateNewZipWithFolder")
-// public void shouldThrowExceptionWhenModifySplitZip() {
-// ZipFileWriterSettings settings = ZipFileWriterSettings.builder()
-// .entrySettings(
-// ZipEntrySettings.builder()
-// .compression(Compression.DEFLATE, CompressionLevel.NORMAL).build())
-// .splitSize(2014 * 1024).build();
-//
-// assertThatThrownBy(() -> ZipIt.add(zip, Zip4jSuite.starWarsDir, settings)).isExactlyInstanceOf(Zip4jvmException.class);
-// }
+ // TODO commented tests
+ // @Test(dependsOnMethods = "shouldCreateNewZipWithFolder")
+ // public void shouldThrowExceptionWhenModifySplitZip() {
+ // ZipFileWriterSettings settings = ZipFileWriterSettings.builder()
+ // .entrySettings(
+ // ZipEntrySettings.builder()
+ // .compression(Compression.DEFLATE,
+ // CompressionLevel.NORMAL).build())
+ // .splitSize(2014 * 1024).build();
+ //
+ // assertThatThrownBy(() -> ZipIt.add(zip, Zip4jSuite.starWarsDir, settings))
+ // .isExactlyInstanceOf(Zip4jvmException.class);
+ // }
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoDecomposeTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoDecomposeTest.java
index 03dc5f448..1aede9610 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoDecomposeTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoDecomposeTest.java
@@ -21,12 +21,10 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.model.settings.ZipInfoSettings;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.password;
import static ru.olegcherednik.zip4jvm.assertj.Zip4jvmAssertions.assertThatDirectory;
@@ -184,34 +182,4 @@ public void shouldDecomposeWhenStrongBzip2AesSplitEcd() throws IOException {
assertThatDirectory(dir).matchesResourceDirectory("/decompose/strong/ecd/strong_bzip2_aes_split_ecd");
}
- private static ZipInfo zipInfo() {
- Path path = Paths.get("d:/zip4jvm/tmp/aes.zip");
-// Files.deleteIfExists(path);
-
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/lzma_16mb.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/lzma_1mb_32.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/enc/lzma-ultra.zip"));
-// res = res.settings(ZipInfoSettings.builder().readEntries(false).build());
-// ZipInfo res = ZipInfo.zip(sevenZipLzmaSolidZip);
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/3des/3des_store_168.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/bzip2/bzip2.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/bzip2/min.zip"));
- ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/ZIpCrypto/src.zip"));
-
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes128.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes192.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes256.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("D:\\zip4jvm\\foo\\compression\\1581465466689\\CompressionLzmaTest\\shouldCreateSingleZipWithFilesWhenLzmaCompressionAndAesEncryption/src.zip"));
-// ZipInfo res = ZipInfo.zip(
-// Paths.get("D:\\zip4jvm\\foo\\encryption\\1581466463189\\EncryptionAesTest\\shouldCreateNewZipWithFolderAndAes256Encryption/src.zip"));
-
- return res;
- }
-
- @Test(enabled = false)
- public void decompose() throws IOException {
- ZipInfoSettings settings = ZipInfoSettings.builder().copyPayload(true).build();
- zipInfo().settings(settings).decompose(Zip4jvmSuite.subDirNameAsMethodName(rootDir));
- }
-
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoPrintShortInfoTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoPrintShortInfoTest.java
index afe601e9e..3d2229be1 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoPrintShortInfoTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipInfoPrintShortInfoTest.java
@@ -21,13 +21,11 @@
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.model.settings.ZipInfoSettings;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import static ru.olegcherednik.zip4jvm.assertj.Zip4jvmAssertions.assertThatFile;
@@ -127,34 +125,4 @@ public void shouldPrintShortInfoWhenSingleItemZip() throws IOException {
assertThatFile(file).matchesTextLines("/info/single_item.txt");
}
- private static ZipInfo zipInfo() {
- Path path = Paths.get("d:/zip4jvm/tmp/aes.zip");
-// Files.deleteIfExists(path);
-
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/lzma_16mb.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/lzma_1mb_32.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/tmp/lzma/enc/lzma-ultra.zip"));
-// res = res.settings(ZipInfoSettings.builder().readEntries(false).build());
-// ZipInfo res = ZipInfo.zip(sevenZipLzmaSolidZip);
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/3des/3des_store_168.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/bzip2/bzip2.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/bzip2/min.zip"));
- ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/ZIpCrypto/src.zip"));
-
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes128.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes192.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("d:/zip4jvm/securezip/aes/aes256.zip"));
-// ZipInfo res = ZipInfo.zip(Paths.get("D:\\zip4jvm\\foo\\compression\\1581465466689\\CompressionLzmaTest\\shouldCreateSingleZipWithFilesWhenLzmaCompressionAndAesEncryption/src.zip"));
-// ZipInfo res = ZipInfo.zip(
-// Paths.get("D:\\zip4jvm\\foo\\encryption\\1581466463189\\EncryptionAesTest\\shouldCreateNewZipWithFolderAndAes256Encryption/src.zip"));
-
- return res;
- }
-
- @Test(enabled = false)
- public void printShortInfo() throws IOException {
- ZipInfoSettings settings = ZipInfoSettings.builder().copyPayload(true).build();
- zipInfo().settings(settings).printShortInfo(System.out);
- }
-
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipIt64Test.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipIt64Test.java
index 203b4eb1f..ecc1205fb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipIt64Test.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipIt64Test.java
@@ -18,13 +18,7 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.apache.commons.io.IOUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Charsets;
-import ru.olegcherednik.zip4jvm.model.Compression;
-import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.Encryption;
import ru.olegcherednik.zip4jvm.model.ExternalFileAttributes;
import ru.olegcherednik.zip4jvm.model.ZipModel;
@@ -33,17 +27,18 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+import org.apache.commons.io.IOUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
-import java.io.RandomAccessFile;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.util.Arrays;
import java.util.stream.IntStream;
import static org.assertj.core.api.Assertions.assertThat;
import static ru.olegcherednik.zip4jvm.TestData.contentDirSrc;
-import static ru.olegcherednik.zip4jvm.TestData.fileBentley;
-import static ru.olegcherednik.zip4jvm.TestData.fileNameBentley;
import static ru.olegcherednik.zip4jvm.TestDataAssert.rootAssert;
import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.SIZE_1MB;
import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.password;
@@ -120,8 +115,8 @@ public void shouldZipWhenZip64AndSplit() throws IOException {
ZipIt.zip(zipSplit).settings(settings).add(contentDirSrc);
// TODO it seems it could be checked with commons-compress
-// assertThatDirectory(zipFile.getParent()).exists().hasSubDirectories(0).hasFiles(1);
-// assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipRootDirAssert);
+ // assertThatDirectory(zipFile.getParent()).exists().hasSubDirectories(0).hasFiles(1);
+ // assertThatZipFile(zipFile).directory("/").matches(TestUtils.zipRootDirAssert);
}
@Test(dependsOnMethods = "shouldZipWhenZip64AndSplit")
@@ -131,6 +126,7 @@ public void shouldUnzipWhenZip64AndSplit() throws IOException {
assertThatDirectory(destDir).matches(rootAssert);
}
+ @SuppressWarnings("AbbreviationAsWordInName")
public void shouldUseZip64WhenTotalEntriesOverFFFF() throws IOException {
Path zipManyEntries = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -152,34 +148,36 @@ public void shouldUseZip64WhenTotalEntriesOverFFFF() throws IOException {
assertThat(zipModel.isZip64()).isTrue();
}
-// // TODO it works but it's too slow
-// @Test(dependsOnMethods = "shouldUseZip64WhenTotalEntriesOverFFFF")
-// public void shouldUnzipZip64WhenTotalEntriesOverFFFF() throws IOException {
-// Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
-// UnzipIt.extract(zipManyEntries, destDir);
-// assertThatDirectory(destDir).hasDirectories(0).hasFiles(ZipModel.MAX_TOTAL_ENTRIES + 1);
-// }
-
-// public void shouldUseZip64WhenEntrySizeOverFFFFFFFF() throws IOException {
-// Path dir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
-// Files.createDirectories(dir);
-//
-// Path file = dir.resolve("file.txt");
-//
-// try (RandomAccessFile f = new RandomAccessFile(file.toFile(), "rw")) {
-// f.setLength(ZipModel.MAX_ENTRY_SIZE + 1);
-// }
-//
-// Path zipHugeEntry = dir.resolve("src.zip");
-// ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
-// ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileNam -> entrySettings).build();
-// ZipIt.zip(zipHugeEntry).settings(settings).add(Arrays.asList(file, fileBentley));
-//
-// ZipModel zipModel = ZipModelBuilder.read(SrcZip.of(zipHugeEntry));
-// assertThat(zipModel.getZipEntryByFileName("file.txt").getUncompressedSize()).isEqualTo(ZipModel.MAX_ENTRY_SIZE + 1);
-// assertThat(zipModel.getZipEntryByFileName(fileNameBentley).getUncompressedSize()).isEqualTo(1_395_362);
-//
-// // TODO asserts in zip should be using
-// }
+ // // TODO it works but it's too slow
+ // @Test(dependsOnMethods = "shouldUseZip64WhenTotalEntriesOverFFFF")
+ // public void shouldUnzipZip64WhenTotalEntriesOverFFFF() throws IOException {
+ // Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
+ // UnzipIt.extract(zipManyEntries, destDir);
+ // assertThatDirectory(destDir).hasDirectories(0).hasFiles(ZipModel.MAX_TOTAL_ENTRIES + 1);
+ // }
+
+ // public void shouldUseZip64WhenEntrySizeOverFFFFFFFF() throws IOException {
+ // Path dir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
+ // Files.createDirectories(dir);
+ //
+ // Path file = dir.resolve("file.txt");
+ //
+ // try (RandomAccessFile f = new RandomAccessFile(file.toFile(), "rw")) {
+ // f.setLength(ZipModel.MAX_ENTRY_SIZE + 1);
+ // }
+ //
+ // Path zipHugeEntry = dir.resolve("src.zip");
+ // ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ // CompressionLevel.NORMAL).build();
+ // ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileNam -> entrySettings).build();
+ // ZipIt.zip(zipHugeEntry).settings(settings).add(Arrays.asList(file, fileBentley));
+ //
+ // ZipModel zipModel = ZipModelBuilder.read(SrcZip.of(zipHugeEntry));
+ // assertThat(zipModel.getZipEntryByFileName("file.txt").getUncompressedSize())
+ // .isEqualTo(ZipModel.MAX_ENTRY_SIZE + 1);
+ // assertThat(zipModel.getZipEntryByFileName(fileNameBentley).getUncompressedSize()).isEqualTo(1_395_362);
+ //
+ // // TODO asserts in zip should be using
+ // }
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipItTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipItTest.java
index 21b555d8f..07765731c 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipItTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipItTest.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
import ru.olegcherednik.zip4jvm.utils.ReflectionUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -129,17 +130,21 @@ public void shouldAddRegularFilesAndDirectoriesWhenZipExistsDefaultSettings() th
}
public void shouldThrowExceptionWhenAddNullPathAndDefaultSettings() {
- assertThatThrownBy(() -> ZipIt.zip(defSingleZip).add((Path)null)).isExactlyInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> ZipIt.zip(defSingleZip)
+ .add((Path) null)).isExactlyInstanceOf(IllegalArgumentException.class);
}
public void shouldThrowExceptionWhenAddNullPathAndCustomSettings() {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
- assertThatThrownBy(() -> ZipIt.zip(customSingleZip).settings(settings).add((Path)null)).isExactlyInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> ZipIt.zip(customSingleZip).settings(settings).add((Path) null)).isExactlyInstanceOf(
+ IllegalArgumentException.class);
}
public void shouldCreateZipWhenAddRegularFileAndCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(customSingleZip).settings(settings).add(fileBentley);
@@ -149,7 +154,8 @@ public void shouldCreateZipWhenAddRegularFileAndCustomSettings() throws IOExcept
}
public void shouldCreateZipWhenAddDirectoryAndCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -162,7 +168,8 @@ public void shouldCreateZipWhenAddDirectoryAndCustomSettings() throws IOExceptio
@Test(dependsOnMethods = "shouldCreateZipWhenAddRegularFileAndCustomSettings")
public void shouldAddRegularFileWhenZipExistsCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(customSingleZip).settings(settings).add(fileSaintPetersburg);
@@ -174,7 +181,8 @@ public void shouldAddRegularFileWhenZipExistsCustomSettings() throws IOException
@Test(dependsOnMethods = "shouldAddRegularFileWhenZipExistsCustomSettings")
public void shouldAddDirectoryWhenZipExistsCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(customSingleZip).settings(settings).add(dirCars);
@@ -186,7 +194,8 @@ public void shouldAddDirectoryWhenZipExistsCustomSettings() throws IOException {
}
public void shouldCreateZipWhenAddRegularFilesAndDirectoriesAndCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(customMultiZip).settings(settings).add(Arrays.asList(fileHonda, dirCars));
@@ -198,7 +207,8 @@ public void shouldCreateZipWhenAddRegularFilesAndDirectoriesAndCustomSettings()
@Test(dependsOnMethods = "shouldCreateZipWhenAddRegularFilesAndDirectoriesAndCustomSettings")
public void shouldAddRegularFilesAndDirectoriesWhenZipExistsCustomSettings() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(customMultiZip).settings(settings).add(Arrays.asList(fileSaintPetersburg, dirBikes));
@@ -236,11 +246,12 @@ public void shouldUseDefaultZipEntrySettingsWhenSetNull() throws NoSuchFieldExce
ZipIt zipIt = ZipIt.zip(defEntryZip);
assertThat(getSettings(zipIt).getEntrySettingsProvider()).isSameAs(ZipEntrySettings.DEFAULT_PROVIDER);
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
zipIt.entrySettings(entrySettings);
assertThat(getSettings(zipIt).getEntrySettingsProvider().apply("aa")).isSameAs(entrySettings);
- zipIt.entrySettings((ZipEntrySettings)null);
+ zipIt.entrySettings((ZipEntrySettings) null);
assertThat(getSettings(zipIt).getEntrySettingsProvider()).isSameAs(ZipEntrySettings.DEFAULT_PROVIDER);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/ZipMiscTest.java b/src/test/java/ru/olegcherednik/zip4jvm/ZipMiscTest.java
index 8cb9e0036..4a3a7b266 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/ZipMiscTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/ZipMiscTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.EntryDuplicationException;
import ru.olegcherednik.zip4jvm.exception.EntryNotFoundException;
import ru.olegcherednik.zip4jvm.exception.PathNotExistsException;
@@ -29,6 +26,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -91,19 +92,22 @@ public void shouldRetrieveAllEntryNamesForExistedEncryptedZip() throws IOExcepti
}
public void shouldThrowExceptionWhenAddedFileNotExists() throws IOException {
- ZipSettings settings = ZipSettings.builder()
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.STORE, CompressionLevel.NORMAL)
- .build())
- .build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.STORE,
+ CompressionLevel.NORMAL)
+ .build())
+ .build();
Path notExisted = dirCars.resolve(UUID.randomUUID().toString());
List files = Arrays.asList(fileBentley, fileFerrari, fileWiesmann, notExisted);
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
- assertThatThrownBy(() -> ZipIt.zip(zip).settings(settings).add(files)).isExactlyInstanceOf(PathNotExistsException.class);
+ assertThatThrownBy(() -> ZipIt.zip(zip).settings(settings).add(files)).isExactlyInstanceOf(
+ PathNotExistsException.class);
}
public void shouldMergeSplitZip() throws IOException {
@@ -114,7 +118,8 @@ public void shouldMergeSplitZip() throws IOException {
@Test(dependsOnMethods = "shouldMergeSplitZip")
public void shouldThrowExceptionWhenMergeWithDuplicatedEntries() throws IOException {
- assertThatThrownBy(() -> ZipMisc.zip(zipDeflateSplit).merge(zipMerge)).isExactlyInstanceOf(EntryDuplicationException.class);
+ assertThatThrownBy(() -> ZipMisc.zip(zipDeflateSplit).merge(zipMerge)).isExactlyInstanceOf(
+ EntryDuplicationException.class);
}
public void shouldRetrieveTrueWhenSplitZipWithMultipleDisks() throws IOException {
@@ -122,13 +127,15 @@ public void shouldRetrieveTrueWhenSplitZipWithMultipleDisks() throws IOException
}
public void shouldRetrieveTrueWhenSplitZipWithOneDisk() throws IOException {
- ZipSettings settings = ZipSettings.builder()
- .splitSize(SIZE_1MB)
- .entrySettingsProvider(fileName ->
- ZipEntrySettings.builder()
- .compression(Compression.STORE, CompressionLevel.NORMAL)
- .build())
- .build();
+ ZipSettings settings = ZipSettings
+ .builder()
+ .splitSize(SIZE_1MB)
+ .entrySettingsProvider(fileName ->
+ ZipEntrySettings.builder()
+ .compression(Compression.STORE,
+ CompressionLevel.NORMAL)
+ .build())
+ .build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
ZipIt.zip(zip).settings(settings).add(Collections.singleton(fileOlegCherednik));
@@ -171,7 +178,8 @@ public void shouldThrowExceptionWhenRemovedEntryWithExactNameDoesNotExists() thr
ZipMisc zipFile = ZipMisc.zip(zip);
assertThat(zipFile.getEntries()).hasSize(13);
- assertThatThrownBy(() -> ZipMisc.zip(zip).removeEntryByName(dirNameCars)).isExactlyInstanceOf(EntryNotFoundException.class);
+ assertThatThrownBy(() -> ZipMisc.zip(zip).removeEntryByName(dirNameCars)).isExactlyInstanceOf(
+ EntryNotFoundException.class);
assertThat(zipFile.getEntries()).hasSize(13);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/AbstractZipEntryAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/AbstractZipEntryAssert.java
index c04bf7657..11ad162fe 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/AbstractZipEntryAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/AbstractZipEntryAssert.java
@@ -24,10 +24,12 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
/**
+ * @param {@link AbstractZipEntryAssert}
* @author Oleg Cherednik
* @since 25.03.2019
*/
-public abstract class AbstractZipEntryAssert> extends AbstractAssert {
+public abstract class AbstractZipEntryAssert>
+ extends AbstractAssert {
protected final ZipFileDecorator zipFile;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/DirectoryAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/DirectoryAssert.java
index 495614f8b..4bd08c4e7 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/DirectoryAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/DirectoryAssert.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
-import org.apache.commons.io.FilenameUtils;
-import org.assertj.core.api.AbstractFileAssert;
-import org.assertj.core.internal.Failures;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.utils.PathUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.assertj.core.api.AbstractFileAssert;
+import org.assertj.core.internal.Failures;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -72,8 +73,11 @@ public DirectoryAssert hasDirectories(int expected) {
if (actual != expected)
throw Failures.instance().failure(
- String.format("Directory '%s' contains illegal amount of directories: actual - '%d', expected - '%d'",
- this.actual.getAbsolutePath(), actual, expected));
+ String.format(
+ "Directory '%s' contains illegal amount of directories: actual - '%d', expected - '%d'",
+ this.actual.getAbsolutePath(),
+ actual,
+ expected));
return myself;
}
@@ -83,8 +87,11 @@ public DirectoryAssert hasRegularFiles(int expected) {
int actual = getRegularFiles(this.actual.toPath()).size();
if (actual != expected)
- throw Failures.instance().failure(String.format("Directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
- this.actual.getAbsolutePath(), actual, expected));
+ throw Failures.instance().failure(String.format(
+ "Directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
+ this.actual.getAbsolutePath(),
+ actual,
+ expected));
return myself;
}
@@ -94,8 +101,11 @@ public DirectoryAssert hasSymlinks(int expected) {
int actual = getSymlinks(this.actual.toPath()).size();
if (actual != expected)
- throw Failures.instance().failure(String.format("Directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
- this.actual.getAbsolutePath(), actual, expected));
+ throw Failures.instance().failure(String.format(
+ "Directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
+ this.actual.getAbsolutePath(),
+ actual,
+ expected));
return myself;
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/IDirectoryAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/IDirectoryAssert.java
index 1066be9fd..2843f1ad2 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/IDirectoryAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/IDirectoryAssert.java
@@ -21,9 +21,11 @@
import java.util.function.Consumer;
/**
+ * @param {@link IDirectoryAssert}
* @author Oleg Cherednik
* @since 03.10.2019
*/
+@SuppressWarnings("AbbreviationAsWordInName")
public interface IDirectoryAssert> {
S exists();
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/IRegularFileAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/IRegularFileAssert.java
index 6063a81e0..daeec8a09 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/IRegularFileAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/IRegularFileAssert.java
@@ -21,9 +21,11 @@
import java.util.function.Consumer;
/**
+ * @param {@link IRegularFileAssert}
* @author Oleg Cherednik
* @since 03.10.2019
*/
+@SuppressWarnings("AbbreviationAsWordInName")
public interface IRegularFileAssert> {
S exists();
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ISymlinkAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ISymlinkAssert.java
index 9142ac5f7..494ccef2b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ISymlinkAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ISymlinkAssert.java
@@ -19,9 +19,11 @@
package ru.olegcherednik.zip4jvm.assertj;
/**
+ * @param {@link ISymlinkAssert}
* @author Oleg Cherednik
* @since 17.03.2023
*/
+@SuppressWarnings("AbbreviationAsWordInName")
public interface ISymlinkAssert> {
S exists();
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/RegularFileAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/RegularFileAssert.java
index b08f88613..aca07c9f8 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/RegularFileAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/RegularFileAssert.java
@@ -18,11 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.api.AbstractPathAssert;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import javax.imageio.ImageIO;
import java.io.BufferedReader;
import java.io.InputStream;
import java.nio.file.Files;
@@ -31,6 +31,7 @@
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import javax.imageio.ImageIO;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
@@ -40,7 +41,8 @@
* @author Oleg Cherednik
* @since 28.03.2019
*/
-public class RegularFileAssert extends AbstractPathAssert implements IRegularFileAssert {
+public class RegularFileAssert extends AbstractPathAssert
+ implements IRegularFileAssert {
private static final Pattern REGEX = Pattern.compile("<--\\sregexp\\((?.+)\\)\\s-->.+");
@@ -124,11 +126,11 @@ public RegularFileAssert matchesTextLines(String resourceFile) {
continue;
throw new AssertionError(
- String.format(
- "(line %d)\r\nExpecting:\r\n<\"%s\">\r\nto be match the pattern:\r\n<\"%s\">\r\nbut was not.",
- pos,
- actual,
- regex));
+ String.format("(line %d)\r\nExpecting:\r\n<\"%s\">\r\nto be match"
+ + " the pattern:\r\n<\"%s\">\r\nbut was not.",
+ pos,
+ actual,
+ regex));
} else
assertThatStringLine(this.actual, pos, actual).isEqualTo(expected);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/StringLineAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/StringLineAssert.java
index 684bd8d65..61e5e19c3 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/StringLineAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/StringLineAssert.java
@@ -41,7 +41,7 @@ public StringLineAssert(Path path, int pos, String actual) {
public StringLineAssert isEqualTo(Object expected) {
try {
return super.isEqualTo(expected);
- } catch(AssertionError e) {
+ } catch (AssertionError e) {
throw new AssertionError(String.format("%s (line %d) %s", path.toAbsolutePath(), pos, e.getMessage()), e);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/Zip4jvmAssertions.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/Zip4jvmAssertions.java
index 30ca018d7..edf5e40c7 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/Zip4jvmAssertions.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/Zip4jvmAssertions.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.assertj.core.api.Assertions;
-import ru.olegcherednik.zip4jvm.model.src.SrcZip;
import java.io.IOException;
import java.nio.file.Files;
@@ -36,11 +37,13 @@
public final class Zip4jvmAssertions extends Assertions {
public static ZipFileAssert assertThatZipFile(Path zip) throws IOException {
- return new ZipFileAssert(isSplit(zip) ? new ZipFileSplitDecorator(zip) : new ZipFileSolidNoEncryptedDecorator(zip));
+ return new ZipFileAssert(isSplit(zip) ? new ZipFileSplitDecorator(zip)
+ : new ZipFileSolidNoEncryptedDecorator(zip));
}
public static ZipFileAssert assertThatZipFile(Path zip, char[] password) throws IOException {
- return new ZipFileAssert(isSplit(zip) ? new ZipFileSplitDecorator(zip, password) : new ZipFileEncryptedDecoder(zip, password));
+ return new ZipFileAssert(isSplit(zip) ? new ZipFileSplitDecorator(zip, password)
+ : new ZipFileEncryptedDecoder(zip, password));
}
public static DirectoryAssert assertThatDirectory(Path path) {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryDirectoryAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryDirectoryAssert.java
index ae69a097f..9117f0981 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryDirectoryAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryDirectoryAssert.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.utils.ZipUtils;
+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.assertj.core.internal.Failures;
-import ru.olegcherednik.zip4jvm.utils.ZipUtils;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -29,7 +30,8 @@
* @author Oleg Cherednik
* @since 25.03.2019
*/
-public class ZipEntryDirectoryAssert extends AbstractZipEntryAssert implements IDirectoryAssert {
+public class ZipEntryDirectoryAssert extends AbstractZipEntryAssert
+ implements IDirectoryAssert {
public ZipEntryDirectoryAssert(ZipArchiveEntry actual, ZipFileDecorator zipFile) {
super(actual, ZipEntryDirectoryAssert.class, zipFile);
@@ -41,8 +43,11 @@ public ZipEntryDirectoryAssert hasEntries(int expected) {
if (actual != expected)
throw Failures.instance().failure(
- String.format("Zip directory '%s' contains illegal amount of entries: actual - '%d', expected - '%d'",
- this.actual, actual, expected));
+ String.format(
+ "Zip directory '%s' contains illegal amount of entries: actual - '%d', expected - '%d'",
+ this.actual,
+ actual,
+ expected));
return myself;
}
@@ -53,8 +58,11 @@ public ZipEntryDirectoryAssert hasDirectories(int expected) {
if (actual != expected)
throw Failures.instance().failure(
- String.format("Zip directory '%s' contains illegal amount of directories: actual - '%d', expected - '%d'",
- this.actual, actual, expected));
+ String.format(
+ "Zip directory '%s' contains illegal amount of directories: actual - '%d', expected - '%d'",
+ this.actual,
+ actual,
+ expected));
return myself;
}
@@ -64,8 +72,11 @@ public ZipEntryDirectoryAssert hasRegularFiles(int expected) {
long actual = getZipEntriesAmount(ZipEntryUtils::isRegularFile);
if (actual != expected)
- throw Failures.instance().failure(String.format("Zip directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
- this.actual, actual, expected));
+ throw Failures.instance().failure(String.format(
+ "Zip directory '%s' contains illegal amount of files: actual - '%d', expected - '%d'",
+ this.actual,
+ actual,
+ expected));
return myself;
}
@@ -75,8 +86,11 @@ public ZipEntryDirectoryAssert hasSymlinks(int expected) {
long actual = getZipEntriesAmount(ZipEntryUtils::isSymlink);
if (actual != expected)
- throw Failures.instance().failure(String.format("Zip directory '%s' contains illegal amount of symlinks: actual - '%d', expected - '%d'",
- this.actual, actual, expected));
+ throw Failures.instance().failure(String.format(
+ "Zip directory '%s' contains illegal amount of symlinks: actual - '%d', expected - '%d'",
+ this.actual,
+ actual,
+ expected));
return myself;
}
@@ -119,14 +133,14 @@ private int getEntriesAmount() {
}
private int getZipEntriesAmount(Predicate predicate) {
- return (int)zipFile.getSubEntries(actual.getName()).stream()
- .map(ZipUtils::getFileNameNoDirectoryMarker)
- .map(entryName -> {
- String parent = "/".equals(actual.getName()) ? "" : actual.getName();
- return zipFile.getEntry(parent + entryName);
- })
- .filter(predicate)
- .count();
+ return (int) zipFile.getSubEntries(actual.getName()).stream()
+ .map(ZipUtils::getFileNameNoDirectoryMarker)
+ .map(entryName -> {
+ String parent = "/".equals(actual.getName()) ? "" : actual.getName();
+ return zipFile.getEntry(parent + entryName);
+ })
+ .filter(predicate)
+ .count();
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryRegularFileAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryRegularFileAssert.java
index 4bb79f02f..6db3812bb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryRegularFileAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryRegularFileAssert.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.model.Charsets;
+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ArrayUtils;
-import ru.olegcherednik.zip4jvm.model.Charsets;
-import javax.imageio.ImageIO;
import java.io.InputStream;
import java.util.List;
import java.util.function.Consumer;
import java.util.regex.Pattern;
+import javax.imageio.ImageIO;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
@@ -36,7 +37,8 @@
* @author Oleg Cherednik
* @since 25.03.2019
*/
-public class ZipEntryRegularFileAssert extends AbstractZipEntryAssert implements IRegularFileAssert {
+public class ZipEntryRegularFileAssert extends AbstractZipEntryAssert
+ implements IRegularFileAssert {
private static final Pattern NEW_LINE = Pattern.compile("\\r?\\n");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntrySymlinkAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntrySymlinkAssert.java
index 92de6ac38..4ef7d7b1d 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntrySymlinkAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntrySymlinkAssert.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.model.Charsets;
+
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.io.IOUtils;
-import ru.olegcherednik.zip4jvm.model.Charsets;
import java.io.IOException;
import java.io.InputStream;
@@ -32,7 +33,8 @@
* @author Oleg Cherednik
* @since 17.03.2023
*/
-public class ZipEntrySymlinkAssert extends AbstractZipEntryAssert implements ISymlinkAssert {
+public class ZipEntrySymlinkAssert extends AbstractZipEntryAssert
+ implements ISymlinkAssert {
public ZipEntrySymlinkAssert(ZipArchiveEntry actual, ZipFileDecorator zipFile) {
super(actual, ZipEntrySymlinkAssert.class, zipFile);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryUtils.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryUtils.java
index 421276be4..95a036795 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryUtils.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipEntryUtils.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.model.ExternalFileAttributes;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import ru.olegcherednik.zip4jvm.model.ExternalFileAttributes;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
final class ZipEntryUtils {
@@ -43,10 +44,10 @@ private static ExternalFileAttributes getExternalAttributes(ZipArchiveEntry entr
long attr = entry.getExternalAttributes();
return new ExternalFileAttributes(new byte[] {
- (byte)(attr & 0xFF),
- (byte)((attr >> 8) & 0xFF),
- (byte)((attr >> 16) & 0xFF),
- (byte)((attr >> 24) & 0xFF)
+ (byte) (attr & 0xFF),
+ (byte) ((attr >> 8) & 0xFF),
+ (byte) ((attr >> 16) & 0xFF),
+ (byte) ((attr >> 24) & 0xFF)
});
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileAssert.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileAssert.java
index fb5659ff4..45e330209 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileAssert.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileAssert.java
@@ -46,7 +46,8 @@ public ZipEntryDirectoryAssert directory(String name) {
if (!entry.isDirectory())
throw Failures.instance().failure(
- String.format("Zip file does not contain directory entry '%s' (directory entry should end with '/'", name));
+ String.format("Zip file does not contain directory entry '%s' (directory entry should end with '/'",
+ name));
return new ZipEntryDirectoryAssert(entry, actual);
}
@@ -60,7 +61,8 @@ public ZipEntryRegularFileAssert regularFile(String name) {
if (entry.isDirectory())
throw Failures.instance().failure(
- String.format("Zip file does not contain file entry '%s' (file entry should not end with '/'", name));
+ String.format("Zip file does not contain file entry '%s' (file entry should not end with '/'",
+ name));
return new ZipEntryRegularFileAssert(entry, actual);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileDecorator.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileDecorator.java
index 10d605d61..0b03b9b39 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileDecorator.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileDecorator.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import lombok.Getter;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.InputStream;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileEncryptedDecoder.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileEncryptedDecoder.java
index 18ccfebca..9afeacd1d 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileEncryptedDecoder.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileEncryptedDecoder.java
@@ -18,6 +18,8 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import net.sf.sevenzipjbinding.ArchiveFormat;
import net.sf.sevenzipjbinding.ExtractOperationResult;
import net.sf.sevenzipjbinding.IInArchive;
@@ -31,7 +33,6 @@
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
@@ -52,7 +53,7 @@ class ZipFileEncryptedDecoder extends ZipFileDecorator {
private final String password;
@SuppressWarnings("MethodCanBeVariableArityMethod")
- public ZipFileEncryptedDecoder(Path zipFile, char[] password) {
+ ZipFileEncryptedDecoder(Path zipFile, char[] password) {
super(zipFile, entries(zipFile));
this.password = password == null ? null : new String(password);
}
@@ -67,9 +68,9 @@ public InputStream getInputStream(ZipEntry entry) {
return getInputStream(item);
throw new Zip4jvmException("Entry '" + entry + "' was not found");
- } catch(Zip4jvmException e) {
+ } catch (Zip4jvmException e) {
throw e;
- } catch(Exception e) {
+ } catch (Exception e) {
throw new Zip4jvmException(e);
}
}
@@ -86,9 +87,9 @@ public String getComment() {
IInArchive zip = SevenZip.openInArchive(ArchiveFormat.ZIP, in)) {
String str = zip.getStringArchiveProperty(PropID.COMMENT);
return StringUtils.length(str) == 0 ? null : str;
- } catch(Zip4jvmException e) {
+ } catch (Zip4jvmException e) {
throw e;
- } catch(Exception e) {
+ } catch (Exception e) {
throw new Zip4jvmException(e);
}
}
@@ -132,9 +133,9 @@ private static Map entries(Path path) {
}
return map;
- } catch(Zip4jvmException e) {
+ } catch (Zip4jvmException e) {
throw e;
- } catch(Exception e) {
+ } catch (Exception e) {
throw new Zip4jvmException(e);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSolidNoEncryptedDecorator.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSolidNoEncryptedDecorator.java
index 638caea1b..b13c08614 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSolidNoEncryptedDecorator.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSolidNoEncryptedDecorator.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.ZipInfo;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+import ru.olegcherednik.zip4jvm.model.CentralDirectory;
+
import com.github.luben.zstd.Zstd;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipFile;
import org.apache.commons.compress.archivers.zip.ZipMethod;
import org.apache.commons.io.IOUtils;
import org.tukaani.xz.LZMAInputStream;
-import ru.olegcherednik.zip4jvm.ZipInfo;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
-import ru.olegcherednik.zip4jvm.model.CentralDirectory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -42,12 +43,12 @@
* @author Oleg Cherednik
* @since 03.10.2019
*/
-@SuppressWarnings("MagicConstant")
+@SuppressWarnings({ "MagicConstant", "AnonInnerLength" })
class ZipFileSolidNoEncryptedDecorator extends ZipFileDecorator {
private static final int METHOD_ZSTD = 93;
- public ZipFileSolidNoEncryptedDecorator(Path zip) {
+ ZipFileSolidNoEncryptedDecorator(Path zip) {
super(zip);
}
@@ -67,12 +68,13 @@ else if (zipEntry.getMethod() == ZipMethod.LZMA.getCode()) {
InputStream in = zipFile.getRawInputStream(zipEntry);
ByteBuffer buffer = ByteBuffer.wrap(IOUtils.readFully(in, 9)).order(ByteOrder.LITTLE_ENDIAN);
- int majorVersion = buffer.get();
- int minorVersion = buffer.get();
+ buffer.get(); // majorVersion
+ buffer.get(); // minorVersion
int size = buffer.getShort() & 0xFFFF;
if (size != 5)
- throw new UnsupportedOperationException("ZipEntry LZMA should have size 5 in header: " + zipEntry.getName());
+ throw new UnsupportedOperationException(
+ "ZipEntry LZMA should have size 5 in header: " + zipEntry.getName());
CentralDirectory.FileHeader fileHeader = ZipInfo.zip(zip).getFileHeader(zipEntry.getName());
boolean lzmaEosMarker = fileHeader.getGeneralPurposeFlag().isLzmaEosMarker();
@@ -83,8 +85,13 @@ else if (zipEntry.getMethod() == ZipMethod.LZMA.getCode()) {
} else if (zipEntry.getMethod() == METHOD_ZSTD) {
InputStream in = zipFile.getRawInputStream(zipEntry);
byte[] compressed = IOUtils.toByteArray(in);
- byte[] decompressed = new byte[(int)zipEntry.getSize()];
- long total = Zstd.decompressByteArray(decompressed, 0, decompressed.length, compressed, 0, compressed.length);
+ byte[] decompressed = new byte[(int) zipEntry.getSize()];
+ long total = Zstd.decompressByteArray(decompressed,
+ 0,
+ decompressed.length,
+ compressed,
+ 0,
+ compressed.length);
assertThat(total).isEqualTo(decompressed.length);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSplitDecorator.java b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSplitDecorator.java
index 4b5b840ab..13d725f83 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSplitDecorator.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/assertj/ZipFileSplitDecorator.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.assertj;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import net.lingala.zip4j.ZipFile;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.ArrayUtils;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.FileInputStream;
import java.io.InputStream;
@@ -43,11 +44,11 @@ class ZipFileSplitDecorator extends ZipFileDecorator {
private final char[] password;
- public ZipFileSplitDecorator(Path zip) {
+ ZipFileSplitDecorator(Path zip) {
this(zip, null);
}
- public ZipFileSplitDecorator(Path zip, char[] password) {
+ ZipFileSplitDecorator(Path zip, char[] password) {
super(zip, entries(zip));
this.password = ArrayUtils.clone(password);
}
@@ -60,7 +61,7 @@ public InputStream getInputStream(ZipEntry entry) {
zipFile.extractFile(entry.getName(), tmp.getParent().toString(), tmp.getFileName().toString());
return new FileInputStream(tmp.toFile());
- } catch(Exception e) {
+ } catch (Exception e) {
throw new Zip4jvmException(e);
}
}
@@ -76,7 +77,7 @@ private static Map entries(Path path) {
return entry;
})
.collect(Collectors.toMap(ZipEntry::getName, Function.identity()));
- } catch(Exception e) {
+ } catch (Exception e) {
throw new Zip4jvmException(e);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToJdkCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToJdkCompatibilityTest.java
index 4c39db1d4..ab15eccfb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToJdkCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToJdkCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.TestDataAssert;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToWinZipAesCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToWinZipAesCompatibilityTest.java
index 449d2e9d4..10047df94 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToWinZipAesCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/Zip4jvmToWinZipAesCompatibilityTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.compatibility;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.model.Charsets;
+
import de.idyl.winzipaes.AesZipFileDecrypter;
import de.idyl.winzipaes.impl.AESDecrypterJCA;
import de.idyl.winzipaes.impl.ExtZipEntry;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.Charsets;
import java.io.IOException;
import java.nio.file.Files;
@@ -42,7 +43,8 @@
@SuppressWarnings({ "NewClassNamingConvention", "FieldNamingConvention" })
public class Zip4jvmToWinZipAesCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(Zip4jvmToWinZipAesCompatibilityTest.class);
+ private static final Path rootDir =
+ Zip4jvmSuite.generateSubDirNameWithTime(Zip4jvmToWinZipAesCompatibilityTest.class);
public void checkCompatibilityWithWinZipAes() throws IOException, DataFormatException {
Path dstDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/apk/ApkTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/apk/ApkTest.java
index 1fa159801..b5d29ef20 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/apk/ApkTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/apk/ApkTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.apk;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.assertj.DirectoryAssert;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
@@ -48,7 +49,7 @@ public void shouldExtractApk() throws IOException {
assertThatDirectory(destDir).matches(dir -> {
dir.exists().hasDirectories(3).hasRegularFiles(10);
- DirectoryAssert dirKotlin = (DirectoryAssert)dir.directory("kotlin");
+ DirectoryAssert dirKotlin = (DirectoryAssert) dir.directory("kotlin");
dirKotlin.exists().hasDirectories(6).hasRegularFiles(1);
dirKotlin.directory("annotation").exists().hasDirectories(0).hasRegularFiles(1);
dirKotlin.directory("collections").exists().hasDirectories(0).hasRegularFiles(1);
@@ -57,7 +58,7 @@ public void shouldExtractApk() throws IOException {
dirKotlin.directory("ranges").exists().hasDirectories(0).hasRegularFiles(1);
dirKotlin.directory("reflect").exists().hasDirectories(0).hasRegularFiles(1);
- DirectoryAssert dirMetaInf = (DirectoryAssert)dir.directory("META-INF");
+ DirectoryAssert dirMetaInf = (DirectoryAssert) dir.directory("META-INF");
dirMetaInf.exists().hasDirectories(2).hasRegularFiles(39);
dirMetaInf.directory("com").exists().hasDirectories(1).hasRegularFiles(0);
dirMetaInf.directory("com/android").exists().hasDirectories(1).hasRegularFiles(0);
@@ -65,7 +66,7 @@ public void shouldExtractApk() throws IOException {
dirMetaInf.directory("com/android/build/gradle").exists().hasDirectories(0).hasRegularFiles(1);
dirMetaInf.directory("services").exists().hasDirectories(0).hasRegularFiles(2);
- DirectoryAssert dirRes = (DirectoryAssert)dir.directory("res");
+ DirectoryAssert dirRes = (DirectoryAssert) dir.directory("res");
dirRes.exists().hasDirectories(42).hasRegularFiles(0);
dirRes.directory("anim").exists().hasDirectories(0).hasRegularFiles(27);
dirRes.directory("anim-v21").exists().hasDirectories(0).hasRegularFiles(4);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.java
index c9083b39d..9a5d866b6 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.securezip;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
@@ -29,12 +30,8 @@
import static ru.olegcherednik.zip4jvm.TestData.secureZipBzip2SplitAes256StrongEcdZip;
import static ru.olegcherednik.zip4jvm.TestData.secureZipDeflate64SolidAes256StrongEcdZip;
import static ru.olegcherednik.zip4jvm.TestData.secureZipDeflateSolidAes256StrongEcdZip;
-import static ru.olegcherednik.zip4jvm.TestData.secureZipDeflateSolidAes256StrongZip;
import static ru.olegcherednik.zip4jvm.TestData.secureZipLzmaSolidAes256StrongEcdZip;
-import static ru.olegcherednik.zip4jvm.TestData.secureZipStoreSolidAes128StrongZip;
-import static ru.olegcherednik.zip4jvm.TestData.secureZipStoreSolidAes192StrongZip;
import static ru.olegcherednik.zip4jvm.TestData.secureZipStoreSolidAes256StrongEcdZip;
-import static ru.olegcherednik.zip4jvm.TestData.secureZipStoreSolidAes256StrongZip;
import static ru.olegcherednik.zip4jvm.TestDataAssert.dirBikesAssert;
import static ru.olegcherednik.zip4jvm.TestDataAssert.rootAssert;
import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.password;
@@ -48,7 +45,8 @@
@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention" })
public class SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.class);
+ private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(
+ SecureZipEncryptedCentralDirectoryToZip4jvmCompatibilityTest.class);
public void shouldUnzipWhenStoreSolidAes256StrongEncryptedCentralDirectory() throws IOException {
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipStrongToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipStrongToZip4jvmCompatibilityTest.java
index 3844c367f..800741f97 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipStrongToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipStrongToZip4jvmCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.securezip;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
@@ -46,7 +47,8 @@
@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention" })
public class SecureZipStrongToZip4jvmCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(SecureZipStrongToZip4jvmCompatibilityTest.class);
+ private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(
+ SecureZipStrongToZip4jvmCompatibilityTest.class);
public void shouldUnzipWhenStoreSolidAes256Strong() throws IOException {
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipToZip4jvmCompatibilityTest.java
index abba66a28..7cccd865b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/securezip/SecureZipToZip4jvmCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.securezip;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
@@ -44,7 +45,8 @@
@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention" })
public class SecureZipToZip4jvmCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(SecureZipToZip4jvmCompatibilityTest.class);
+ private static final Path rootDir =
+ Zip4jvmSuite.generateSubDirNameWithTime(SecureZipToZip4jvmCompatibilityTest.class);
public void shouldUnzipWhenLzmaSolid() throws IOException {
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/SevenZipToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/SevenZipToZip4jvmCompatibilityTest.java
index 2710984af..0170ec9af 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/SevenZipToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/SevenZipToZip4jvmCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.sevenzip;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
@@ -44,7 +45,8 @@
@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention" })
public class SevenZipToZip4jvmCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(SevenZipToZip4jvmCompatibilityTest.class);
+ private static final Path rootDir =
+ Zip4jvmSuite.generateSubDirNameWithTime(SevenZipToZip4jvmCompatibilityTest.class);
public void shouldUnzipWhenLzmaSolid() throws IOException {
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/Zip4jvmToSevenZipCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/Zip4jvmToSevenZipCompatibilityTest.java
index d82fed798..d8cee9e26 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/Zip4jvmToSevenZipCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/sevenzip/Zip4jvmToSevenZipCompatibilityTest.java
@@ -18,6 +18,9 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.sevenzip;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
+
import net.sf.sevenzipjbinding.ArchiveFormat;
import net.sf.sevenzipjbinding.ExtractOperationResult;
import net.sf.sevenzipjbinding.IInArchive;
@@ -27,8 +30,6 @@
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
import org.apache.commons.lang3.ArrayUtils;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import java.io.IOException;
import java.io.RandomAccessFile;
@@ -49,10 +50,12 @@
* @since 05.04.2019
*/
@Test
-@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention", "LocalVariableNamingConvention", "OverlyNestedMethod" })
+@SuppressWarnings({ "FieldNamingConvention", "NewClassNamingConvention", "LocalVariableNamingConvention",
+ "OverlyNestedMethod" })
public class Zip4jvmToSevenZipCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(Zip4jvmToSevenZipCompatibilityTest.class);
+ private static final Path rootDir =
+ Zip4jvmSuite.generateSubDirNameWithTime(Zip4jvmToSevenZipCompatibilityTest.class);
public void checkCompatibilityWithSevenZip() throws IOException {
Path parentDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winrar/WinRarToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winrar/WinRarToZip4jvmCompatibilityTest.java
index 0c8874747..63dcc7019 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winrar/WinRarToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winrar/WinRarToZip4jvmCompatibilityTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.winrar;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Path;
import java.util.Arrays;
@@ -49,8 +50,12 @@ public class WinRarToZip4jvmCompatibilityTest {
public void checkCompatibilityWithWinRar() throws IOException {
Path dir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
- for (Path zip : Arrays.asList(winRarStoreSolidZip, winRarStoreSolidPkwareZip, winRarStoreSolidAesZip, winRarDeflateSolidZip,
- winRarDeflateSolidPkwareZip, winRarDeflateSolidAesZip)) {
+ for (Path zip : Arrays.asList(winRarStoreSolidZip,
+ winRarStoreSolidPkwareZip,
+ winRarStoreSolidAesZip,
+ winRarDeflateSolidZip,
+ winRarDeflateSolidPkwareZip,
+ winRarDeflateSolidAesZip)) {
Path destDir = Zip4jvmSuite.subDirNameAsRelativePathToRoot(dir, zip);
UnzipIt.zip(zip).destDir(destDir).password(password).extract();
assertThatDirectory(destDir).matches(dirBikesAssert);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winzip/WinZipAesToZip4jvmCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winzip/WinZipAesToZip4jvmCompatibilityTest.java
index 46598775e..b52e74e23 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winzip/WinZipAesToZip4jvmCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compatibility/winzip/WinZipAesToZip4jvmCompatibilityTest.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.compatibility.winzip;
-import de.idyl.winzipaes.AesZipFileEncrypter;
-import de.idyl.winzipaes.impl.AESEncrypterJCA;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.utils.PathUtils;
+import de.idyl.winzipaes.AesZipFileEncrypter;
+import de.idyl.winzipaes.impl.AESEncrypterJCA;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -32,8 +33,8 @@
import java.util.List;
import java.util.stream.Collectors;
-import static ru.olegcherednik.zip4jvm.TestData.dirSrcData;
import static ru.olegcherednik.zip4jvm.TestData.dirNameEmpty;
+import static ru.olegcherednik.zip4jvm.TestData.dirSrcData;
import static ru.olegcherednik.zip4jvm.TestData.fileNameOlegCherednik;
import static ru.olegcherednik.zip4jvm.TestData.fileOlegCherednik;
import static ru.olegcherednik.zip4jvm.TestDataAssert.rootAssert;
@@ -49,7 +50,8 @@
@SuppressWarnings({ "NewClassNamingConvention", "FieldNamingConvention" })
public class WinZipAesToZip4jvmCompatibilityTest {
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(WinZipAesToZip4jvmCompatibilityTest.class);
+ private static final Path rootDir =
+ Zip4jvmSuite.generateSubDirNameWithTime(WinZipAesToZip4jvmCompatibilityTest.class);
public void winZipAesShouldBeReadableForZip4jvm() throws IOException {
Path zip = zipItWithWinZipAes(Zip4jvmSuite.subDirNameAsMethodName(rootDir));
@@ -99,7 +101,7 @@ private static List getDirectoryEntries(Path dir) {
return Files.walk(dir)
.filter(path -> Files.isRegularFile(path) || Files.isDirectory(path))
.collect(Collectors.toList());
- } catch(IOException e) {
+ } catch (IOException e) {
return Collections.emptyList();
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionBzip2Test.java b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionBzip2Test.java
index 99af63945..257c8e788 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionBzip2Test.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionBzip2Test.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.compression;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipInfo;
@@ -32,6 +29,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -97,7 +98,8 @@ public void shouldCreateSingleZipWithFilesWhenBzip2CompressionSuperFast() throws
}
public void shouldUseCompressStoreWhenFileEmpty() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.BZIP2, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.BZIP2,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionDeflateTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionDeflateTest.java
index f99e0bf09..f081981f8 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionDeflateTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionDeflateTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.compression;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipInfo;
@@ -33,6 +30,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -79,7 +80,9 @@ public static void removeDir() throws IOException {
}
public void shouldCreateSingleZipWithFilesWhenDeflateCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -90,8 +93,10 @@ public void shouldCreateSingleZipWithFilesWhenDeflateCompression() throws IOExce
}
public void shouldCreateSplitZipWithFilesWhenDeflateCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -101,7 +106,8 @@ public void shouldCreateSplitZipWithFilesWhenDeflateCompression() throws IOExcep
}
public void shouldCreateSingleZipWithEntireFolderWhenDeflateCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -113,8 +119,10 @@ public void shouldCreateSingleZipWithEntireFolderWhenDeflateCompression() throws
}
public void shouldCreateSplitZipWithEntireFolderWhenStoreCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -151,7 +159,8 @@ public void shouldUnzipWhenWhenDeflateCompressionAndAesEncryption() throws IOExc
}
public void shouldUseCompressStoreWhenFileEmpty() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionLzmaTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionLzmaTest.java
index 7d8fcd444..2f20cdbb1 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionLzmaTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionLzmaTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.compression;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipInfo;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -31,6 +28,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -116,7 +117,8 @@ public void shouldCreateSingleZipWithFilesWhenLzmaCompressionSuperFastLevelNoEos
}
public void shouldUseCompressStoreWhenFileEmpty() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.LZMA, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.LZMA,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionStoreTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionStoreTest.java
index 89ebf4090..ed0bbb39f 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionStoreTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionStoreTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.compression;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -30,6 +27,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -71,7 +72,8 @@ public static void removeDir() throws IOException {
}
public void shouldCreateSingleZipWithFilesWhenStoreCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -82,8 +84,10 @@ public void shouldCreateSingleZipWithFilesWhenStoreCompression() throws IOExcept
}
public void shouldCreateSplitZipWithFilesWhenStoreCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -93,7 +97,8 @@ public void shouldCreateSplitZipWithFilesWhenStoreCompression() throws IOExcepti
}
public void shouldCreateSingleZipWithEntireFolderWhenStoreCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
@@ -105,8 +110,10 @@ public void shouldCreateSingleZipWithEntireFolderWhenStoreCompression() throws I
}
public void shouldCreateSplitZipWithEntireFolderWhenStoreCompression() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionZstdTest.java b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionZstdTest.java
index c7c5847a3..2830b6e66 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionZstdTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/compression/CompressionZstdTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.compression;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipInfo;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -31,6 +28,10 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -77,7 +78,8 @@ public void shouldCreateSingleZipWithFilesWhenZstdCompressionNormalLevel() throw
}
public void shouldUseCompressStoreWhenFileEmpty() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.ZSTD, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.ZSTD,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("src.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesDecoderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesDecoderTest.java
index f13d6b015..e9e0d519f 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesDecoderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesDecoderTest.java
@@ -18,14 +18,15 @@
*/
package ru.olegcherednik.zip4jvm.crypto.aes;
-import org.apache.commons.lang3.ArrayUtils;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.io.in.data.DataInput;
import ru.olegcherednik.zip4jvm.io.in.file.DataInputFile;
import ru.olegcherednik.zip4jvm.model.entry.ZipEntry;
import ru.olegcherednik.zip4jvm.utils.ReflectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.testng.annotations.Test;
+
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.ShortBufferException;
@@ -41,7 +42,6 @@
* @since 03.10.2019
*/
@Test
-@SuppressWarnings("NewMethodNamingConvention")
public class AesDecoderTest {
public void shouldThrowZip4jvmExceptionWhenCreateAndException() {
@@ -52,7 +52,8 @@ public void shouldThrowZip4jvmExceptionWhenCreateAndException() {
public void shouldThrowZip4jvmExceptionWhenDecryptAndException() throws ShortBufferException {
AesDecoder decoder = createAesDecoder(new AesEngine(mock(Cipher.class), mock(Mac.class)), 3);
- assertThatThrownBy(() -> decoder.decrypt(ArrayUtils.EMPTY_BYTE_ARRAY, 0, 10)).isExactlyInstanceOf(Zip4jvmException.class);
+ assertThatThrownBy(() -> decoder.decrypt(ArrayUtils.EMPTY_BYTE_ARRAY, 0, 10)).isExactlyInstanceOf(
+ Zip4jvmException.class);
}
public void shouldThrowExceptionWhenMessageAuthenticationCodeNotMatch() throws Exception {
@@ -70,7 +71,10 @@ public void shouldThrowExceptionWhenMessageAuthenticationCodeNotMatch() throws E
}
private static AesDecoder createAesDecoder(AesEngine engine, long compressedSize) {
- return ReflectionUtils.invokeConstructor(AesDecoder.class, new Class>[] { AesEngine.class, long.class }, engine, compressedSize);
+ return ReflectionUtils.invokeConstructor(AesDecoder.class,
+ new Class>[] { AesEngine.class, long.class },
+ engine,
+ compressedSize);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEncoderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEncoderTest.java
index 123f6b911..d3d0a230e 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEncoderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEncoderTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.crypto.aes;
-import org.apache.commons.lang3.ArrayUtils;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.model.entry.ZipEntry;
import ru.olegcherednik.zip4jvm.utils.ReflectionUtils;
+import org.apache.commons.lang3.ArrayUtils;
+import org.testng.annotations.Test;
+
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.ShortBufferException;
@@ -50,11 +51,16 @@ public void shouldThrowZip4jvmExceptionWhenEncryptAndException() throws ShortBuf
byte[] passwordChecksum = { 0, 0, 0 };
AesEncoder encoder = createAesEncoder(cipher, mac, salt, passwordChecksum);
- assertThatThrownBy(() -> encoder.encrypt(ArrayUtils.EMPTY_BYTE_ARRAY, 0, 10)).isExactlyInstanceOf(Zip4jvmException.class);
+ assertThatThrownBy(() -> encoder.encrypt(ArrayUtils.EMPTY_BYTE_ARRAY, 0, 10)).isExactlyInstanceOf(
+ Zip4jvmException.class);
}
private static AesEncoder createAesEncoder(Cipher cipher, Mac mac, byte[] salt, byte[] passwordChecksum) {
- return ReflectionUtils.invokeConstructor(AesEncoder.class, new Class>[] { Cipher.class, Mac.class, byte[].class, byte[].class },
- cipher, mac, salt, passwordChecksum);
+ return ReflectionUtils.invokeConstructor(AesEncoder.class,
+ new Class>[] { Cipher.class, Mac.class, byte[].class, byte[].class },
+ cipher,
+ mac,
+ salt,
+ passwordChecksum);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEngineTest.java b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEngineTest.java
index 72c6da00a..6a31af58f 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEngineTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/crypto/aes/AesEngineTest.java
@@ -18,11 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.crypto.aes;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.EncryptionMethod;
import ru.olegcherednik.zip4jvm.utils.ReflectionUtils;
+import org.testng.annotations.Test;
+
import javax.crypto.Cipher;
import javax.crypto.Mac;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/data/DefalteZipData.java b/src/test/java/ru/olegcherednik/zip4jvm/data/DefalteZipData.java
index 76d088e26..da7bc3c1c 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/data/DefalteZipData.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/data/DefalteZipData.java
@@ -18,8 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.data;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.ZipIt;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
@@ -27,6 +25,9 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
import java.io.IOException;
import java.nio.file.Files;
import java.util.function.Function;
@@ -58,7 +59,10 @@ public static void createDeflateZip() throws IOException {
}
private static void createDeflateSolidZip() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder()
+ .compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL)
+ .build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(zipDeflateSolid).settings(settings).add(contentDirSrc);
@@ -69,8 +73,10 @@ private static void createDeflateSolidZip() throws IOException {
}
private static void createDeflateSplitZip() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.DEFLATE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
ZipIt.zip(zipDeflateSplit).settings(settings).add(contentDirSrc);
assertThat(Files.exists(zipDeflateSplit)).isTrue();
@@ -86,7 +92,7 @@ private static void createDeflateSolidPkwareZip() throws IOException {
.entrySettingsProvider(fileName -> entrySettings)
// TODO temporary
.comment("abcабвгдеёжзийклмнопрстуфхцчшщъыьэюя").build();
-// .comment("password: " + passwordStr).build();
+ // .comment("password: " + passwordStr).build();
ZipIt.zip(zipDeflateSolidPkware).settings(settings).add(contentDirSrc);
assertThat(Files.exists(zipDeflateSolidPkware)).isTrue();
@@ -100,7 +106,8 @@ private static void createDeflateSolidAesZip() throws IOException {
fileName -> ZipEntrySettings.builder()
.compression(Compression.DEFLATE, CompressionLevel.NORMAL)
.encryption(Encryption.AES_256, fileName.toCharArray()).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(entrySettingsProvider).comment("password: ").build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(entrySettingsProvider).comment(
+ "password: ").build();
ZipIt.zip(zipDeflateSolidAes).settings(settings).add(contentDirSrc);
assertThat(Files.exists(zipDeflateSolidAes)).isTrue();
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/data/StoreZipData.java b/src/test/java/ru/olegcherednik/zip4jvm/data/StoreZipData.java
index 8eb259a21..d0aa81fb2 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/data/StoreZipData.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/data/StoreZipData.java
@@ -18,8 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.data;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
import ru.olegcherednik.zip4jvm.ZipIt;
import ru.olegcherednik.zip4jvm.model.Compression;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
@@ -27,6 +25,9 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
import java.io.IOException;
import java.nio.file.Files;
import java.util.function.Function;
@@ -64,7 +65,8 @@ public static void createStoreZip() throws IOException {
}
private static void createStoreSolidZip() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).build();
ZipIt.zip(zipStoreSolid).settings(settings).add(contentDirSrc);
@@ -76,8 +78,10 @@ private static void createStoreSolidZip() throws IOException {
}
private static void createStoreSplitZip() throws IOException {
- ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE, CompressionLevel.NORMAL).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings).splitSize(SIZE_1MB).build();
+ ZipEntrySettings entrySettings = ZipEntrySettings.builder().compression(Compression.STORE,
+ CompressionLevel.NORMAL).build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(fileName -> entrySettings)
+ .splitSize(SIZE_1MB).build();
ZipIt.zip(zipStoreSplit).settings(settings).add(contentDirSrc);
assertThat(Files.exists(zipStoreSplit)).isTrue();
@@ -106,7 +110,8 @@ private static void createStoreSolidAesZip() throws IOException {
fileName -> ZipEntrySettings.builder()
.compression(Compression.STORE, CompressionLevel.NORMAL)
.encryption(Encryption.AES_192, fileName.toCharArray()).build();
- ZipSettings settings = ZipSettings.builder().entrySettingsProvider(entrySettingsProvider).comment("password: ").build();
+ ZipSettings settings = ZipSettings.builder().entrySettingsProvider(entrySettingsProvider).comment(
+ "password: ").build();
ZipIt.zip(zipStoreSolidAes).settings(settings).add(contentDirSrc);
assertThat(Files.exists(zipStoreSolidAes)).isTrue();
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/data/SymlinkData.java b/src/test/java/ru/olegcherednik/zip4jvm/data/SymlinkData.java
index 69f201807..9bc6e8eed 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/data/SymlinkData.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/data/SymlinkData.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.data;
+import ru.olegcherednik.zip4jvm.engine.ZipSymlinkEngine;
+
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import ru.olegcherednik.zip4jvm.engine.ZipSymlinkEngine;
import java.io.IOException;
import java.nio.file.Files;
@@ -54,10 +55,6 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class SymlinkData {
- public static void main(String... args) throws IOException {
- createSymlinkData();
- }
-
public static void createSymlinkData() throws IOException {
Files.createDirectories(dirSrcSymlink);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptedCentralDirectoryTest.java b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptedCentralDirectoryTest.java
index 66c401014..505c101bb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptedCentralDirectoryTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptedCentralDirectoryTest.java
@@ -18,9 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.encryption;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.exception.EncryptionNotSupportedException;
@@ -28,6 +25,10 @@
import ru.olegcherednik.zip4jvm.model.password.PasswordProvider;
import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -55,17 +56,17 @@ public static void removeDir() throws IOException {
Zip4jvmSuite.removeDir(rootDir);
}
-// public void shouldUnzipWhenStoreSolidAes() throws IOException {
-// Path zip = Zip4jvmSuite.getResourcePath("/encrypted-central-directory/aes128bit.zip");
-// Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
-//
-// UnzipSettings settings = UnzipSettings.builder().password(password).build();
-//
-// UnzipIt.zip(zip).destDir(destDir).settings(settings).extract();
-//// assertThatDirectory(destDir).matches(rootAssert);
-// int a = 0;
-// a++;
-// }
+ // public void shouldUnzipWhenStoreSolidAes() throws IOException {
+ // Path zip = Zip4jvmSuite.getResourcePath("/encrypted-central-directory/aes128bit.zip");
+ // Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
+ //
+ // UnzipSettings settings = UnzipSettings.builder().password(password).build();
+ //
+ // UnzipIt.zip(zip).destDir(destDir).settings(settings).extract();
+ //// assertThatDirectory(destDir).matches(rootAssert);
+ // int a = 0;
+ // a++;
+ // }
public void shouldThrowEncryptionNotSupportedExceptionWhenReadEncryptedCentralDirectory() throws IOException {
Path zip = Zip4jvmSuite.getResourcePath("/encrypted-central-directory/3des168bit.zip");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/encryption/Encryption3DesTest.java b/src/test/java/ru/olegcherednik/zip4jvm/encryption/Encryption3DesTest.java
deleted file mode 100644
index 407214e54..000000000
--- a/src/test/java/ru/olegcherednik/zip4jvm/encryption/Encryption3DesTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package ru.olegcherednik.zip4jvm.encryption;
-
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import ru.olegcherednik.zip4jvm.UnzipIt;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-import static ru.olegcherednik.zip4jvm.TestDataAssert.rootAssert;
-import static ru.olegcherednik.zip4jvm.Zip4jvmSuite.password;
-import static ru.olegcherednik.zip4jvm.assertj.Zip4jvmAssertions.assertThatDirectory;
-
-/**
- * @author Oleg Cherednik
- * @since 16.02.2020
- */
-//@Test
-@SuppressWarnings("FieldNamingConvention")
-public class Encryption3DesTest {
-
- private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(Encryption3DesTest.class);
-
- @BeforeClass
- public static void createDir() throws IOException {
- Files.createDirectories(rootDir);
- }
-
- @AfterClass(enabled = Zip4jvmSuite.clear)
- public static void removeDir() throws IOException {
- Zip4jvmSuite.removeDir(rootDir);
- }
-
- public void shouldUnzipWhenStoreSolidAes() throws IOException {
- Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir);
-
- UnzipSettings settings = UnzipSettings.builder().password(password).build();
-
-// UnzipIt.zip(Paths.get("d:/zip4jvm/3des/3des_lk.zip")).destDir(destDir).settings(settings).extract();
-// UnzipIt.zip(Paths.get("d:/zip4jvm/securezip/aes/aes128.zip")).destDir(destDir).settings(settings).extract();
-// UnzipIt.zip(Paths.get("d:/zip4jvm/securezip/aes/aes192.zip")).destDir(destDir).settings(settings).extract();
- UnzipIt.zip(Paths.get("d:/zip4jvm/securezip/aes/aes256.zip")).destDir(destDir).settings(settings).extract();
- assertThatDirectory(destDir).matches(rootAssert);
- }
-
-}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionAesTest.java b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionAesTest.java
index 619fbe2e8..19170dba4 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionAesTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionAesTest.java
@@ -18,10 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.encryption;
-import org.apache.commons.lang3.ArrayUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -34,6 +30,11 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.apache.commons.lang3.ArrayUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionPkwareTest.java b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionPkwareTest.java
index d47388a0c..9355001cb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionPkwareTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/encryption/EncryptionPkwareTest.java
@@ -18,11 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.encryption;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.ArrayUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -35,6 +30,12 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ArrayUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/engine/UnzipEngineTest.java b/src/test/java/ru/olegcherednik/zip4jvm/engine/UnzipEngineTest.java
index 288b0c81d..96b119ca3 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/engine/UnzipEngineTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/engine/UnzipEngineTest.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm.engine;
-import org.apache.commons.io.FileUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipIt;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
+import org.apache.commons.io.FileUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSolidTest.java b/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSolidTest.java
index 162321d8a..b7783b730 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSolidTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSolidTest.java
@@ -18,10 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.engine;
-import org.apache.commons.io.IOUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipFile;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -35,6 +31,11 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.apache.commons.io.IOUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -133,7 +134,8 @@ private static Function entrySettingsProvider() {
}
public void shouldThrowNullPointerExceptionWhenArgumentIsNull() {
- assertThatThrownBy(() -> new ZipEngine(null, ZipSettings.DEFAULT)).isExactlyInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ZipEngine(null,
+ ZipSettings.DEFAULT)).isExactlyInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> new ZipEngine(zipStoreSolid, null)).isExactlyInstanceOf(NullPointerException.class);
}
@@ -183,7 +185,7 @@ public void shouldThrowExceptionWhenAddNullEntry() throws IOException {
assertThatThrownBy(() -> {
try (ZipFile.Writer zipFile = new ZipEngine(zip, ZipSettings.DEFAULT)) {
- zipFile.add((ZipFile.Entry)null);
+ zipFile.add((ZipFile.Entry) null);
}
}).isExactlyInstanceOf(NullPointerException.class);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSplitTest.java b/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSplitTest.java
index c5ade3f7c..4fc375dd2 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSplitTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/engine/ZipEngineSplitTest.java
@@ -18,10 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.engine;
-import org.apache.commons.io.IOUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipFile;
import ru.olegcherednik.zip4jvm.ZipIt;
@@ -35,6 +31,11 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.apache.commons.io.IOUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -137,7 +138,8 @@ private static Function entrySettingsProvider() {
}
public void shouldThrowNullPointerExceptionWhenArgumentIsNull() {
- assertThatThrownBy(() -> new ZipEngine(null, ZipSettings.DEFAULT)).isExactlyInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ZipEngine(null,
+ ZipSettings.DEFAULT)).isExactlyInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> new ZipEngine(zipStoreSolid, null)).isExactlyInstanceOf(NullPointerException.class);
}
@@ -189,7 +191,7 @@ public void shouldThrowExceptionWhenAddNullEntry() throws IOException {
assertThatThrownBy(() -> {
try (ZipFile.Writer zipFile = new ZipEngine(zip, ZipSettings.DEFAULT)) {
- zipFile.add((ZipFile.Entry)null);
+ zipFile.add((ZipFile.Entry) null);
}
}).isExactlyInstanceOf(NullPointerException.class);
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/io/in/ZipInputStreamTest.java b/src/test/java/ru/olegcherednik/zip4jvm/io/in/ZipInputStreamTest.java
index 089566b0d..6170229fc 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/io/in/ZipInputStreamTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/io/in/ZipInputStreamTest.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm.io.in;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.io.in.file.LittleEndianDataInputFile;
+import ru.olegcherednik.zip4jvm.model.Charsets;
+import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.io.in.file.LittleEndianDataInputFile;
-import ru.olegcherednik.zip4jvm.model.Charsets;
-import ru.olegcherednik.zip4jvm.model.src.SrcZip;
import java.io.IOException;
import java.nio.file.Files;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/io/out/SolidZipOutputStreamTest.java b/src/test/java/ru/olegcherednik/zip4jvm/io/out/SolidZipOutputStreamTest.java
index 986b9b2af..853d386b7 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/io/out/SolidZipOutputStreamTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/io/out/SolidZipOutputStreamTest.java
@@ -18,16 +18,17 @@
*/
package ru.olegcherednik.zip4jvm.io.out;
-import org.apache.commons.io.FileUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
-import ru.olegcherednik.zip4jvm.model.src.SrcZip;
import ru.olegcherednik.zip4jvm.io.out.data.SolidZipOutputStream;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.ZipModel;
+import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+
+import org.apache.commons.io.FileUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import java.io.IOException;
import java.nio.file.Files;
@@ -77,7 +78,7 @@ public void shouldWriteStreamWhenUsingDataOutput() throws IOException {
out.writeBytes("oleg".getBytes(Charsets.UTF_8));
assertThat(out.getRelativeOffs()).isEqualTo(18);
- out.writeBytes((byte)0x11);
+ out.writeBytes((byte) 0x11);
assertThat(out.getRelativeOffs()).isEqualTo(19);
out.writeBytes(new byte[] { 0x12, 0x13, 0x14 });
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/io/out/SplitZipOutputStreamTest.java b/src/test/java/ru/olegcherednik/zip4jvm/io/out/SplitZipOutputStreamTest.java
index d6fe208fa..0d80ef645 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/io/out/SplitZipOutputStreamTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/io/out/SplitZipOutputStreamTest.java
@@ -18,15 +18,16 @@
*/
package ru.olegcherednik.zip4jvm.io.out;
-import org.apache.commons.io.FileUtils;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.src.SrcZip;
import ru.olegcherednik.zip4jvm.io.out.data.SplitZipOutputStream;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.ZipModel;
+import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+
+import org.apache.commons.io.FileUtils;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
import java.io.IOException;
import java.nio.file.Files;
@@ -77,7 +78,7 @@ public void shouldWriteStreamWhenUsingDataOutput() throws IOException {
out.writeBytes("oleg".getBytes(Charsets.UTF_8));
assertThat(out.getRelativeOffs()).isEqualTo(2);
- out.writeBytes((byte)0x11);
+ out.writeBytes((byte) 0x11);
assertThat(out.getRelativeOffs()).isEqualTo(3);
out.writeBytes(new byte[] { 0x12, 0x13, 0x14 });
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/io/out/file/LittleEndianWriteFileTest.java b/src/test/java/ru/olegcherednik/zip4jvm/io/out/file/LittleEndianWriteFileTest.java
index 1a96c4754..5d6790203 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/io/out/file/LittleEndianWriteFileTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/io/out/file/LittleEndianWriteFileTest.java
@@ -18,11 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.io.out.file;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.ZipItTest;
import java.io.IOException;
import java.nio.file.Files;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionMethodTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionMethodTest.java
index d0294d6f3..401541466 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionMethodTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionMethodTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.UnknownCompressionMethodException;
+import org.testng.annotations.Test;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionTest.java
index 1f009000c..b768c03de 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/CompressionTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.CompressionNotSupportedException;
+import org.testng.annotations.Test;
+
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -46,7 +47,7 @@ public void shouldThrowExceptionWhenCompressionMethodNotSupported() {
private static Compression parseCompressionMethod(CompressionMethod compressionMethod) {
try {
return Compression.parseCompressionMethod(compressionMethod);
- } catch(CompressionNotSupportedException ignore) {
+ } catch (CompressionNotSupportedException ignore) {
return null;
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/EncryptionTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/EncryptionTest.java
index f48ff1387..4b8ca7f80 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/EncryptionTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/EncryptionTest.java
@@ -26,16 +26,17 @@
// TODO Should be fix
public class EncryptionTest {
-// public void shouldThrowExceptionWhenStrongEncryptionFlatIsSet() {
-// ExtraField.Record record = mock(ExtraField.Record.class);
-// when(record.isNull()).thenReturn(false);
-// when(record.getSignature()).thenReturn(666);
-//
-// ExtraField extraField = ExtraField.builder().addRecord(record).build();
-//
-// GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
-// generalPurposeFlag.setStrongEncryption(true);
-//
-// assertThatThrownBy(() -> Encryption.get(extraField, generalPurposeFlag)).isExactlyInstanceOf(Zip4jvmException.class);
-// }
+ // public void shouldThrowExceptionWhenStrongEncryptionFlatIsSet() {
+ // ExtraField.Record record = mock(ExtraField.Record.class);
+ // when(record.isNull()).thenReturn(false);
+ // when(record.getSignature()).thenReturn(666);
+ //
+ // ExtraField extraField = ExtraField.builder().addRecord(record).build();
+ //
+ // GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
+ // generalPurposeFlag.setStrongEncryption(true);
+ //
+ // assertThatThrownBy(() -> Encryption.get(extraField, generalPurposeFlag))
+ // .isExactlyInstanceOf(Zip4jvmException.class);
+ // }
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/ExternalFileAttributesTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/ExternalFileAttributesTest.java
index 9f129bca2..de720a88e 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/ExternalFileAttributesTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/ExternalFileAttributesTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.model;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+
import org.mockito.ArgumentCaptor;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import java.io.IOException;
import java.nio.file.FileSystem;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/FileHeaderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/FileHeaderTest.java
index 8934e44fd..3734283db 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/FileHeaderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/FileHeaderTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.model;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
+
import org.apache.commons.lang3.ArrayUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import java.io.IOException;
import java.nio.file.Files;
@@ -31,14 +32,13 @@
import static org.assertj.core.api.Assertions.assertThat;
import static ru.olegcherednik.zip4jvm.TestData.fileBentley;
-import static ru.olegcherednik.zip4jvm.model.ExternalFileAttributes.WIN;
/**
* @author Oleg Cherednik
* @since 15.09.2019
*/
@Test
-@SuppressWarnings("FieldNamingConvention")
+@SuppressWarnings({ "FieldNamingConvention", "VariableDeclarationUsageDistance" })
public class FileHeaderTest {
private static final Path rootDir = Zip4jvmSuite.generateSubDirNameWithTime(FileHeaderTest.class);
@@ -57,11 +57,13 @@ public void shouldUseSettersGettersCorrectly() throws IOException {
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
InternalFileAttributes internalFileAttributes = new InternalFileAttributes(new byte[] { 1, 2 });
ExternalFileAttributes externalFileAttributes = ExternalFileAttributes.regularFile(fileBentley);
- PkwareExtraField extraField = PkwareExtraField.builder().addRecord(Zip64.ExtendedInfo.builder().uncompressedSize(4).build()).build();
+ PkwareExtraField extraField = PkwareExtraField.builder().addRecord(Zip64.ExtendedInfo.builder()
+ .uncompressedSize(4)
+ .build()).build();
-// TODO commented tests
-// assertThat(internalFileAttributes).isNotSameAs(InternalFileAttributes.NULL);
-// assertThat(externalFileAttributes).isNotSameAs(ExternalFileAttributes.NULL);
+ // TODO commented tests
+ // assertThat(internalFileAttributes).isNotSameAs(InternalFileAttributes.NULL);
+ // assertThat(externalFileAttributes).isNotSameAs(ExternalFileAttributes.NULL);
assertThat(extraField).isNotSameAs(PkwareExtraField.NULL);
Version versionMadeBy = Version.of(Version.FileSystem.MS_DOS_OS2_NT_FAT, 20);
@@ -136,7 +138,8 @@ public void shouldRetrieveIsZip64TrueWhenZip64ExtendedInfoIsNotNull() {
assertThat(fileHeader.getExtraField().getExtendedInfo()).isSameAs(Zip64.ExtendedInfo.NULL);
assertThat(fileHeader.isZip64()).isFalse();
- Zip64.ExtendedInfo extendedInfo = Zip64.ExtendedInfo.builder().uncompressedSize(1).compressedSize(2).localFileHeaderRelativeOffs(3)
+ Zip64.ExtendedInfo extendedInfo = Zip64.ExtendedInfo.builder().uncompressedSize(1).compressedSize(2)
+ .localFileHeaderRelativeOffs(3)
.diskNo(4).build();
fileHeader.setExtraField(PkwareExtraField.builder().addRecord(extendedInfo).build());
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/GeneralPurposeFlagTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/GeneralPurposeFlagTest.java
index f2c454416..3ffa2784e 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/GeneralPurposeFlagTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/GeneralPurposeFlagTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.utils.BitUtils;
+import org.testng.annotations.Test;
+
import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
@@ -163,7 +164,8 @@ public void shouldRetrieveLzmaBitsWhenLzma() {
}
public void shouldRetrieveDeflateBitsWhenDeflate() {
- for (CompressionMethod compressionMethod : Arrays.asList(CompressionMethod.DEFLATE, CompressionMethod.ENHANCED_DEFLATE)) {
+ for (CompressionMethod compressionMethod : Arrays.asList(CompressionMethod.DEFLATE,
+ CompressionMethod.ENHANCED_DEFLATE)) {
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
assertThat(generalPurposeFlag.getAsInt(compressionMethod)).isEqualTo(0x0);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/InternalFileAttributesTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/InternalFileAttributesTest.java
index e816d885a..7be8404f1 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/InternalFileAttributesTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/InternalFileAttributesTest.java
@@ -20,10 +20,6 @@
import org.testng.annotations.Test;
-import java.util.Arrays;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
/**
* @author Oleg Cherednik
* @since 25.09.2019
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/LocalFileHeaderBlockTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/LocalFileHeaderBlockTest.java
index b2faac841..245974e86 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/LocalFileHeaderBlockTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/LocalFileHeaderBlockTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model;
+import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
+
import org.apache.commons.lang3.ArrayUtils;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import java.io.IOException;
@@ -35,7 +36,11 @@ public class LocalFileHeaderBlockTest {
public void shouldUseSettersGettersCorrectly() throws IOException {
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
- PkwareExtraField extraField = PkwareExtraField.builder().addRecord(Zip64.ExtendedInfo.builder().uncompressedSize(4).build()).build();
+ PkwareExtraField extraField = PkwareExtraField.builder()
+ .addRecord(Zip64.ExtendedInfo.builder()
+ .uncompressedSize(4)
+ .build())
+ .build();
Version versionToExtract = Version.of(Version.FileSystem.Z_SYSTEM, 15);
@@ -59,7 +64,7 @@ public void shouldUseSettersGettersCorrectly() throws IOException {
assertThat(localFileHeader.getCrc32()).isEqualTo(4);
assertThat(localFileHeader.getCompressedSize()).isEqualTo(5);
assertThat(localFileHeader.getUncompressedSize()).isEqualTo(6);
- assertThat(((PkwareExtraField)localFileHeader.getExtraField()).getExtendedInfo()).isNotNull();
+ assertThat(((PkwareExtraField) localFileHeader.getExtraField()).getExtendedInfo()).isNotNull();
assertThat(localFileHeader.getFileName()).isEqualTo("fileName");
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/Zip64Test.java b/src/test/java/ru/olegcherednik/zip4jvm/model/Zip64Test.java
index 33f360aff..c5987d196 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/Zip64Test.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/Zip64Test.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.io.out.data.DataOutput;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -51,7 +52,9 @@ public void shouldRetrieveNullObjectWhenAllArgumentsAreNull() {
}
public void shouldRetrieveSpecialStringForNullObjectWhenToString() {
- Zip64 zip64 = Zip64.of(new Zip64.EndCentralDirectoryLocator(), new Zip64.EndCentralDirectory(), Zip64.ExtensibleDataSector.builder().build());
+ Zip64 zip64 = Zip64.of(new Zip64.EndCentralDirectoryLocator(),
+ new Zip64.EndCentralDirectory(),
+ Zip64.ExtensibleDataSector.builder().build());
assertThat(zip64.toString()).isNotEqualTo("");
assertThat(Zip64.NULL.toString()).isEqualTo("");
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/FileHeaderBuilderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/FileHeaderBuilderTest.java
index 922562278..e6e7e6b37 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/FileHeaderBuilderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/FileHeaderBuilderTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.model.builders;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.ZipModel;
@@ -26,6 +25,8 @@
import ru.olegcherednik.zip4jvm.model.entry.ZipEntryBuilder;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/LocalFileHeaderBlockBuilderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/LocalFileHeaderBlockBuilderTest.java
index b7ef5bbd9..98cc6dacd 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/LocalFileHeaderBlockBuilderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/LocalFileHeaderBlockBuilderTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.model.builders;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.LocalFileHeader;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.entry.ZipEntry;
@@ -26,6 +25,8 @@
import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
@@ -53,7 +54,7 @@ public void shouldCreateLocalFileHeaderWhenZip64Entry() throws IOException {
assertThat(localFileHeader.getCompressedSize()).isEqualTo(LOOK_IN_EXTRA_FIELD);
assertThat(localFileHeader.getUncompressedSize()).isEqualTo(LOOK_IN_EXTRA_FIELD);
- Zip64.ExtendedInfo extendedInfo = ((PkwareExtraField)localFileHeader.getExtraField()).getExtendedInfo();
+ Zip64.ExtendedInfo extendedInfo = ((PkwareExtraField) localFileHeader.getExtraField()).getExtendedInfo();
assertThat(extendedInfo).isNotSameAs(Zip64.ExtendedInfo.NULL);
assertThat(extendedInfo.getUncompressedSize()).isEqualTo(Files.size(fileDucati));
assertThat(extendedInfo.getCompressedSize()).isEqualTo(0);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/Zip64BuilderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/Zip64BuilderTest.java
index 2ba7194f8..62f5e3aff 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/Zip64BuilderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/Zip64BuilderTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.model.builders;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.ZipModel;
import ru.olegcherednik.zip4jvm.model.entry.ZipEntry;
import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+import org.testng.annotations.Test;
+
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/ZipModelBuilderTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/ZipModelBuilderTest.java
index bbb9db386..64be27959 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/builders/ZipModelBuilderTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/builders/ZipModelBuilderTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.model.builders;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
import ru.olegcherednik.zip4jvm.model.EndCentralDirectory;
@@ -27,6 +26,8 @@
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
import ru.olegcherednik.zip4jvm.model.src.SrcZip;
+import org.testng.annotations.Test;
+
import java.nio.charset.Charset;
import java.util.function.Function;
@@ -43,7 +44,8 @@
public class ZipModelBuilderTest {
public void shouldThrowExceptionWhenCreateModelForExistedFile() {
- assertThatThrownBy(() -> ZipModelBuilder.build(zipStoreSolid, ZipSettings.DEFAULT)).isExactlyInstanceOf(Zip4jvmException.class);
+ assertThatThrownBy(() -> ZipModelBuilder.build(zipStoreSolid, ZipSettings.DEFAULT)).isExactlyInstanceOf(
+ Zip4jvmException.class);
}
public void shouldCreateEmptyZipModelWhenCentralDirectoryNull() {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/entry/ZipEntryTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/entry/ZipEntryTest.java
index f4c98b81b..6fe147bc5 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/entry/ZipEntryTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/entry/ZipEntryTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.model.entry;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.model.settings.ZipEntrySettings;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/ExtraFieldTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/ExtraFieldTest.java
index 07e820224..7b4f784ad 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/ExtraFieldTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/ExtraFieldTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.model.extrafield;
-import org.mockito.InOrder;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.io.out.data.DataOutput;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.extrafield.records.UnknownExtraFieldRecord;
+import org.mockito.InOrder;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -44,9 +45,11 @@ public void shouldRetrieveNullObjectWhenBuildEmptyExtraField() {
}
public void shouldIgnoreNullOrNullObjectRecordWhenBuildExtraField() {
- assertThat(PkwareExtraField.builder().addRecord((PkwareExtraField.Record)null).build()).isSameAs(PkwareExtraField.NULL);
+ assertThat(PkwareExtraField.builder().addRecord((PkwareExtraField.Record) null).build()).isSameAs(
+ PkwareExtraField.NULL);
assertThat(PkwareExtraField.builder().build()).isSameAs(PkwareExtraField.NULL);
- assertThat(PkwareExtraField.builder().addRecord(Zip64.ExtendedInfo.NULL).build()).isSameAs(PkwareExtraField.NULL);
+ assertThat(PkwareExtraField.builder().addRecord(Zip64.ExtendedInfo.NULL)
+ .build()).isSameAs(PkwareExtraField.NULL);
}
public void shouldRetrieveCorrectStringWhenToString() {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/records/AesExtraFieldRecordTest.java b/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/records/AesExtraFieldRecordTest.java
index 0b8bda722..90976d29b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/records/AesExtraFieldRecordTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/model/extrafield/records/AesExtraFieldRecordTest.java
@@ -18,13 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.model.extrafield.records;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.crypto.aes.AesStrength;
import ru.olegcherednik.zip4jvm.exception.Zip4jvmException;
import ru.olegcherednik.zip4jvm.io.out.data.DataOutput;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
-import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
+
+import org.testng.annotations.Test;
import java.io.IOException;
@@ -73,7 +73,8 @@ public void shouldRetrieveNullStringWhenToStringForNullObject() {
}
public void shouldThrowExceptionWhenSetVendorMoreThan2CharactersLength() {
- assertThatThrownBy(() -> AesExtraFieldRecord.builder().vendor("AEAE")).isExactlyInstanceOf(Zip4jvmException.class);
+ assertThatThrownBy(() -> AesExtraFieldRecord.builder()
+ .vendor("AEAE")).isExactlyInstanceOf(Zip4jvmException.class);
}
public void shouldRetrieveNullWhenGetVendorWithGivenCharset() {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/snippets/UnzipItSnippet.java b/src/test/java/ru/olegcherednik/zip4jvm/snippets/UnzipItSnippet.java
index 954091642..76e025159 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/snippets/UnzipItSnippet.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/snippets/UnzipItSnippet.java
@@ -18,16 +18,16 @@
*/
package ru.olegcherednik.zip4jvm.snippets;
+import ru.olegcherednik.zip4jvm.UnzipIt;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
+
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.UnzipIt;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.settings.UnzipSettings;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -35,7 +35,6 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
-import java.util.function.Function;
import static ru.olegcherednik.zip4jvm.TestData.dirNameBikes;
import static ru.olegcherednik.zip4jvm.TestData.dirNameCars;
@@ -85,7 +84,9 @@ public void extractDirectoryIntoGivenDirectory() throws IOException {
}
public void extractSomeEntriesIntoGivenDirectory() throws IOException {
- List fileNames = Arrays.asList(dirNameCars, dirNameBikes + '/' + fileNameDucati, fileNameSaintPetersburg);
+ List fileNames = Arrays.asList(dirNameCars,
+ dirNameBikes + '/' + fileNameDucati,
+ fileNameSaintPetersburg);
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename_content");
UnzipIt.zip(zip).destDir(destDir).extract(fileNames);
}
@@ -94,31 +95,36 @@ public void getStreamForRegularFileEntry() throws IOException {
Path destFile = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("bentley.jpg");
Files.createDirectories(destFile.getParent());
- try (InputStream in = UnzipIt.zip(zip).stream("cars/bentley-continental.jpg"); OutputStream out = new FileOutputStream(destFile.toFile())) {
+ try (InputStream in = UnzipIt.zip(zip).stream("cars/bentley-continental.jpg");
+ OutputStream out = Files.newOutputStream(destFile.toFile().toPath())) {
IOUtils.copyLarge(in, out);
}
}
public void unzipWithSinglePasswordForAllEntries() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolidPkware.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolidPkware.toFile(), srcZip.toFile());
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename_content");
char[] password = passwordStr.toCharArray();
- List fileNames = Arrays.asList(dirNameCars, dirNameBikes + '/' + fileNameDucati, fileNameSaintPetersburg);
- UnzipIt.zip(zip).destDir(destDir).password(password).extract(fileNames);
+ List fileNames = Arrays.asList(dirNameCars,
+ dirNameBikes + '/' + fileNameDucati,
+ fileNameSaintPetersburg);
+ UnzipIt.zip(srcZip).destDir(destDir).password(password).extract(fileNames);
}
public void unzipWithSeparatePasswordForEachEntry() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolidAes.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolidAes.toFile(), srcZip.toFile());
Path destDir = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename_content");
UnzipSettings settings = UnzipSettings.builder().passwordProvider(fileNamePasswordProvider).build();
- List fileNames = Arrays.asList(dirNameCars, dirNameBikes + '/' + fileNameDucati, fileNameSaintPetersburg);
- UnzipIt.zip(zip).destDir(destDir).settings(settings).extract(fileNames);
+ List fileNames = Arrays.asList(dirNameCars,
+ dirNameBikes + '/' + fileNameDucati,
+ fileNameSaintPetersburg);
+ UnzipIt.zip(srcZip).destDir(destDir).settings(settings).extract(fileNames);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipItSnippet.java b/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipItSnippet.java
index 214581fa2..1014a6a87 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipItSnippet.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipItSnippet.java
@@ -18,14 +18,15 @@
*/
package ru.olegcherednik.zip4jvm.snippets;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.ZipFile;
import ru.olegcherednik.zip4jvm.ZipIt;
import ru.olegcherednik.zip4jvm.model.ExternalFileAttributes;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipMiscSnippet.java b/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipMiscSnippet.java
index e9ed20392..5d3225b07 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipMiscSnippet.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/snippets/ZipMiscSnippet.java
@@ -18,21 +18,19 @@
*/
package ru.olegcherednik.zip4jvm.snippets;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import ru.olegcherednik.zip4jvm.ZipMisc;
+
import org.apache.commons.io.FileUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.ZipFile;
-import ru.olegcherednik.zip4jvm.ZipMisc;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.Collection;
-import java.util.List;
-import java.util.stream.Collectors;
import static org.assertj.core.api.Assertions.assertThat;
import static ru.olegcherednik.zip4jvm.TestData.dirNameBikes;
@@ -65,10 +63,10 @@ public static void removeDir() throws IOException {
}
public void modifyZipArchiveComment() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolid.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolid.toFile(), srcZip.toFile());
- ZipMisc zipFile = ZipMisc.zip(zip);
+ ZipMisc zipFile = ZipMisc.zip(srcZip);
assertThat(zipFile.getComment()).isNull();
@@ -85,34 +83,30 @@ public void modifyZipArchiveComment() throws IOException {
assertThat(zipFile.getComment()).isNull();
}
- public void getAllEntries() throws IOException {
- ZipMisc zipFile = ZipMisc.zip(zip);
- List entries = zipFile.getEntries().collect(Collectors.toList());
- }
-
public void removeEntryByName() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolid.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolid.toFile(), srcZip.toFile());
- ZipMisc zipFile = ZipMisc.zip(zip);
+ ZipMisc zipFile = ZipMisc.zip(srcZip);
zipFile.removeEntryByName(dirNameCars + '/' + fileNameFerrari);
}
public void removeSomeEntriesByName() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolid.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolid.toFile(), srcZip.toFile());
- Collection entryNames = Arrays.asList(dirNameCars + '/' + fileNameFerrari, dirNameBikes + '/' + fileNameHonda);
+ Collection entryNames = Arrays.asList(dirNameCars + '/' + fileNameFerrari,
+ dirNameBikes + '/' + fileNameHonda);
- ZipMisc zipFile = ZipMisc.zip(zip);
+ ZipMisc zipFile = ZipMisc.zip(srcZip);
zipFile.removeEntryByName(entryNames);
}
public void removeEntryByNamePrefix() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
- FileUtils.copyFile(zipDeflateSolid.toFile(), zip.toFile());
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ FileUtils.copyFile(zipDeflateSolid.toFile(), srcZip.toFile());
- ZipMisc zipFile = ZipMisc.zip(zip);
+ ZipMisc zipFile = ZipMisc.zip(srcZip);
zipFile.removeEntryByNamePrefix(dirNameCars);
}
@@ -121,8 +115,9 @@ public void checkWhetherZipArchiveSplitOrNot() throws IOException {
}
public void mergeSplitArchiveIntoSolidOne() throws IOException {
- Path zip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
+ Path srcZip = Zip4jvmSuite.subDirNameAsMethodName(rootDir).resolve("filename.zip");
ZipMisc zipFile = ZipMisc.zip(zipDeflateSplit);
- zipFile.merge(zip);
+ zipFile.merge(srcZip);
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/symlink/SymlinkCompatibilityTest.java b/src/test/java/ru/olegcherednik/zip4jvm/symlink/SymlinkCompatibilityTest.java
index 27b3d8ce2..cd7363496 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/symlink/SymlinkCompatibilityTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/symlink/SymlinkCompatibilityTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.symlink;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
import ru.olegcherednik.zip4jvm.UnzipIt;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.assertj.IDirectoryAssert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/symlink/ZipItSymlinkTest.java b/src/test/java/ru/olegcherednik/zip4jvm/symlink/ZipItSymlinkTest.java
index 9bab08b39..023f67fb9 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/symlink/ZipItSymlinkTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/symlink/ZipItSymlinkTest.java
@@ -18,21 +18,19 @@
*/
package ru.olegcherednik.zip4jvm.symlink;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.ZipInfo;
import ru.olegcherednik.zip4jvm.ZipIt;
import ru.olegcherednik.zip4jvm.assertj.IDirectoryAssert;
import ru.olegcherednik.zip4jvm.model.ZipSymlink;
-import ru.olegcherednik.zip4jvm.model.settings.ZipInfoSettings;
import ru.olegcherednik.zip4jvm.model.settings.ZipSettings;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.function.Consumer;
import static ru.olegcherednik.zip4jvm.TestData.dirNameCars;
@@ -161,11 +159,12 @@ public void shouldCreateZipNoSymlinkWhenReplaceSymlinkWithUniqueTarget() throws
Path zip = destDir.resolve("src.zip");
ZipIt.zip(zip).settings(settings).add(dirSrcSymlink);
-// zip = Paths.get("d:/Programming/GitHub/zip4jvm/src/test/resources/symlink/posix/unique-symlink-target.zip");
-// destDir = Paths.get("d:/zip4jvm/bbb/bbb");
-// destDir = Paths.get("d:/zip4jvm/bbb/aaa");
-// Files.deleteIfExists(destDir);
-// ZipInfo.zip(zip).settings(ZipInfoSettings.builder().copyPayload(true).build()).decompose(destDir);
+ // zip = Paths.get("d:/Programming/GitHub/zip4jvm/src/test/resources/
+ // symlink/posix/unique-symlink-target.zip");
+ // destDir = Paths.get("d:/zip4jvm/bbb/bbb");
+ // destDir = Paths.get("d:/zip4jvm/bbb/aaa");
+ // Files.deleteIfExists(destDir);
+ // ZipInfo.zip(zip).settings(ZipInfoSettings.builder().copyPayload(true).build()).decompose(destDir);
assertThatDirectory(zip.getParent()).exists().hasEntries(1).hasRegularFiles(1);
assertThatZipFile(zip).root().hasEntries(10).hasDirectories(2).hasRegularFiles(1).hasSymlinks(7);
@@ -184,9 +183,12 @@ public void shouldCreateZipNoSymlinkWhenReplaceSymlinkWithUniqueTarget() throws
assertThatZipFile(zip).symlink(symlinkTrnDirNameData).hasTarget(symlinkAbsDirNameData + '/');
assertThatZipFile(zip).symlink(symlinkAbsFileNameDucati).hasTarget(fileNameDucati);
assertThatZipFile(zip).symlink(symlinkRelFileNameDucati).hasTarget(fileNameDucati);
- assertThatZipFile(zip).symlink(symlinkAbsFileNameHonda).hasTarget(zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
- assertThatZipFile(zip).symlink(symlinkRelFileNameHonda).hasTarget(zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
- assertThatZipFile(zip).symlink(symlinkTrnFileNameHonda).hasTarget(zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
+ assertThatZipFile(zip).symlink(symlinkAbsFileNameHonda).hasTarget(
+ zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
+ assertThatZipFile(zip).symlink(symlinkRelFileNameHonda).hasTarget(
+ zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
+ assertThatZipFile(zip).symlink(symlinkTrnFileNameHonda).hasTarget(
+ zipSymlinkAbsDirNameData + zipDirNameBikes + fileNameHonda);
}
private static final Consumer> dirSymlinkCarsAssert = dir -> {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/utils/ReflectionUtils.java b/src/test/java/ru/olegcherednik/zip4jvm/utils/ReflectionUtils.java
index 67b08b1c5..34dd8947c 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/utils/ReflectionUtils.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/utils/ReflectionUtils.java
@@ -25,34 +25,20 @@
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import static org.assertj.core.api.Assertions.assertThat;
-/** Class provides set of methods based on java reflections: invoke constructors, static and not static methods, set or read fields. */
+/**
+ * Class provides set of methods based on java reflections: invoke constructors,
+ * static and not static methods, set or read fields.
+ */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ReflectionUtils {
public static T getFieldValue(Object obj, String name) throws NoSuchFieldException, IllegalAccessException {
Field field = getField(obj.getClass(), name);
field.setAccessible(true);
- return (T)field.get(obj);
- }
-
- public static T getStaticFieldValue(Class> cls, String name) throws NoSuchFieldException, IllegalAccessException {
- Field field = getField(cls, name);
- field.setAccessible(true);
- return (T)field.get(cls);
- }
-
- public static T invokeConstructor(Class cls) {
- try {
- Constructor constructor = cls.getDeclaredConstructor();
- constructor.setAccessible(true);
- return constructor.newInstance();
- } catch (Exception ignored) {
- return null;
- }
+ return (T) field.get(obj);
}
public static T invokeConstructor(Class cls, Class>[] types, Object... values) {
@@ -65,7 +51,8 @@ public static T invokeConstructor(Class cls, Class>[] types, Object...
}
}
- public static void setFieldValue(Object obj, String name, Object value) throws NoSuchFieldException, IllegalAccessException {
+ public static void setFieldValue(Object obj, String name, Object value)
+ throws NoSuchFieldException, IllegalAccessException {
Field field = getField(obj.getClass(), name);
boolean accessible = field.isAccessible();
@@ -77,100 +64,38 @@ public static void setFieldValue(Object obj, String name, Object value) throws N
}
}
- public static void setStaticFieldValue(Class> cls, String name, Object value) throws NoSuchFieldException, IllegalAccessException {
- Field field = getField(cls, name);
- boolean accessible = field.isAccessible();
-
- try {
- field.setAccessible(true);
- clearFinalModifier(field);
- setFileValue(field, null, value);
- } finally {
- field.setAccessible(accessible);
- }
- }
-
- private static void clearFinalModifier(Field field) throws NoSuchFieldException, IllegalAccessException {
- Field modifiersField = Field.class.getDeclaredField("modifiers");
- modifiersField.setAccessible(true);
- modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
- }
-
private static void setFileValue(Field field, Object obj, Object value) throws IllegalAccessException {
if (field.getType() == int.class) {
- field.setInt(obj, (Integer)value);
+ field.setInt(obj, (Integer) value);
} else if (field.getType() == boolean.class) {
- field.setBoolean(obj, (Boolean)value);
+ field.setBoolean(obj, (Boolean) value);
} else if (field.getType() == byte.class) {
- field.setByte(obj, (Byte)value);
+ field.setByte(obj, (Byte) value);
} else if (field.getType() == char.class) {
- field.setChar(obj, (Character)value);
+ field.setChar(obj, (Character) value);
} else if (field.getType() == double.class) {
- field.setDouble(obj, (Double)value);
+ field.setDouble(obj, (Double) value);
} else if (field.getType() == long.class) {
- field.setLong(obj, (Long)value);
+ field.setLong(obj, (Long) value);
} else if (field.getType() == short.class) {
- field.setShort(obj, (Short)value);
+ field.setShort(obj, (Short) value);
} else if (field.getType() == float.class) {
- field.setFloat(obj, (Float)value);
+ field.setFloat(obj, (Float) value);
} else {
field.set(obj, value);
}
}
- public static T invokeStaticMethod(Class> cls, String name) throws Throwable {
- return invokeStaticMethod(cls, name, null);
- }
-
- public static T invokeStaticMethod(Class> cls, String name, Class> type, Object value) throws Throwable {
- return invokeStaticMethod(cls, name, new Class>[] { type }, value);
- }
-
- public static T invokeStaticMethod(Class> cls, String name, Class> type1, Class> type2, Object value1, Object value2) throws Throwable {
- return invokeStaticMethod(cls, name, new Class>[] { type1, type2 }, value1, value2);
- }
-
- public static T invokeStaticMethod(Class> cls, String name, Class> type1, Class> type2, Class> type3,
- Object value1, Object value2, Object value3) throws Throwable {
- return invokeStaticMethod(cls, name, new Class>[] { type1, type2, type3 }, value1, value2, value3);
- }
-
- public static T invokeStaticMethod(Class> cls, String name, Class>[] types, Object... values) throws Throwable {
- try {
- Method method = getMethod(cls, name, types);
- method.setAccessible(true);
- return (T)method.invoke(null, values);
- } catch (InvocationTargetException e) {
- throw e.getTargetException();
- }
- }
-
public static T invokeMethod(Object obj, String name) throws Throwable {
assertThat(obj).isNotInstanceOf(Class.class);
return invokeMethod(obj, name, null);
}
- public static T invokeMethod(Object obj, String name, Class> type, Object value) throws Throwable {
- assertThat(obj).isNotInstanceOf(Class.class);
- return invokeMethod(obj, name, new Class>[] { type }, value);
- }
-
- public static T invokeMethod(Object obj, String name, Class> type1, Class> type2, Object value1, Object value2) throws Throwable {
- assertThat(obj).isNotInstanceOf(Class.class);
- return invokeMethod(obj, name, new Class>[] { type1, type2 }, value1, value2);
- }
-
- public static T invokeMethod(Object obj, String name, Class> type1, Class> type2, Class> type3, Object value1, Object value2,
- Object value3) throws Throwable {
- assertThat(obj).isNotInstanceOf(Class.class);
- return invokeMethod(obj, name, new Class>[] { type1, type2, type3 }, value1, value2, value3);
- }
-
public static T invokeMethod(Object obj, String name, Class>[] types, Object... values) throws Throwable {
try {
Method method = getMethod(obj.getClass(), name, types);
method.setAccessible(true);
- return (T)method.invoke(obj, values);
+ return (T) method.invoke(obj, values);
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/ByteArrayHexViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/ByteArrayHexViewTest.java
index 18028e1d6..9f0f0c98c 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/ByteArrayHexViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/ByteArrayHexViewTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.view;
+import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+
import org.apache.commons.lang3.ArrayUtils;
import org.testng.annotations.Test;
-import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import java.io.IOException;
import java.io.PrintStream;
@@ -36,7 +37,9 @@
public class ByteArrayHexViewTest {
public void shouldPrintOneLineWhenLessThanColumnWidth() throws IOException {
- byte[] data = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF };
+ byte[] data = {
+ 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9,
+ 0xA, 0xB, 0xC, 0xD, 0xE, 0xF };
String[] lines = Zip4jvmSuite.execute(new ByteArrayHexView(data, 0, 52));
assertThat(lines).hasSize(1);
@@ -44,8 +47,10 @@ public void shouldPrintOneLineWhenLessThanColumnWidth() throws IOException {
}
public void shouldPrintMoreThanOneLineWhenMoreThanColumnWidth() throws IOException {
- byte[] data = { 0x64, 0x75, 0x63, 0x61, 0x74, 0x69, 0x2D, 0x70, 0x61, 0x6E, 0x69, 0x67, 0x61, 0x6C, 0x65, 0x2D, 0x31, 0x31, 0x39, 0x39, 0x2E,
- 0x6A, 0x70, 0x67 };
+ byte[] data = {
+ 0x64, 0x75, 0x63, 0x61, 0x74, 0x69, 0x2D, 0x70, 0x61, 0x6E,
+ 0x69, 0x67, 0x61, 0x6C, 0x65, 0x2D, 0x31, 0x31, 0x39, 0x39,
+ 0x2E, 0x6A, 0x70, 0x67 };
String[] lines = Zip4jvmSuite.execute(new ByteArrayHexView(data, 0, 52));
assertThat(lines).hasSize(2);
@@ -54,8 +59,10 @@ public void shouldPrintMoreThanOneLineWhenMoreThanColumnWidth() throws IOExcepti
}
public void shouldFillWholeColumnWhenColumnWidthNotStandard() throws IOException {
- byte[] data = { 0x64, 0x75, 0x63, 0x61, 0x74, 0x69, 0x2D, 0x70, 0x61, 0x6E, 0x69, 0x67, 0x61, 0x6C, 0x65, 0x2D, 0x31, 0x31, 0x39, 0x39, 0x2E,
- 0x6A, 0x70, 0x67 };
+ byte[] data = {
+ 0x64, 0x75, 0x63, 0x61, 0x74, 0x69, 0x2D, 0x70, 0x61, 0x6E,
+ 0x69, 0x67, 0x61, 0x6C, 0x65, 0x2D, 0x31, 0x31, 0x39, 0x39,
+ 0x2E, 0x6A, 0x70, 0x67 };
String[] lines = Zip4jvmSuite.execute(new ByteArrayHexView(data, 0, 70));
assertThat(lines).hasSize(2);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/CompressionMethodViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/CompressionMethodViewTest.java
index b9192f11b..5880a47ff 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/CompressionMethodViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/CompressionMethodViewTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
@@ -26,12 +25,12 @@
import ru.olegcherednik.zip4jvm.model.ShannonFanoTreesNumber;
import ru.olegcherednik.zip4jvm.model.SlidingDictionarySize;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.mockito.Mockito.mock;
/**
* @author Oleg Cherednik
@@ -41,7 +40,10 @@
public class CompressionMethodViewTest {
public void shouldRetrieveCompressionMethodTitleWhenSingleLine() throws IOException {
- String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.STORE, new GeneralPurposeFlag(), 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.STORE,
+ new GeneralPurposeFlag(),
+ 0,
+ 52));
assertThat(lines).hasSize(1);
assertThat(lines[0]).isEqualTo("compression method (00): none (stored)");
}
@@ -51,7 +53,10 @@ public void shouldRetrieveThreeLinesWhenFileImplodedMethod() throws IOException
generalPurposeFlag.setSlidingDictionarySize(SlidingDictionarySize.SD_4K);
generalPurposeFlag.setShannonFanoTreesNumber(ShannonFanoTreesNumber.THREE);
- String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.FILE_IMPLODED, generalPurposeFlag, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.FILE_IMPLODED,
+ generalPurposeFlag,
+ 0,
+ 52));
assertThat(lines).hasSize(3);
assertThat(lines[0]).isEqualTo("compression method (06): imploded");
assertThat(lines[1]).isEqualTo(" size of sliding dictionary (implosion): 4K");
@@ -63,10 +68,14 @@ public void shouldRetrieveTwoLinesWhenLzmaMethod() throws IOException {
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setLzmaEosMarker(eosMarker);
- String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.LZMA, generalPurposeFlag, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(CompressionMethod.LZMA,
+ generalPurposeFlag,
+ 0,
+ 52));
assertThat(lines).hasSize(2);
assertThat(lines[0]).isEqualTo("compression method (14): lzma encoding");
- assertThat(lines[1]).isEqualTo(" end-of-stream (EOS) marker: " + (eosMarker ? "yes" : "no"));
+ assertThat(lines[1]).isEqualTo(
+ " end-of-stream (EOS) marker: " + (eosMarker ? "yes" : "no"));
}
}
@@ -74,14 +83,19 @@ public void shouldRetrieveCompressionSubTypeWhenDeflateCompressionMethod() throw
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setCompressionLevel(CompressionLevel.NORMAL);
- for (CompressionMethod compressionMethod : Arrays.asList(CompressionMethod.DEFLATE, CompressionMethod.ENHANCED_DEFLATE)) {
- String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(compressionMethod, generalPurposeFlag, 0, 52));
+ for (CompressionMethod compressionMethod : Arrays.asList(CompressionMethod.DEFLATE,
+ CompressionMethod.ENHANCED_DEFLATE)) {
+ String[] lines = Zip4jvmSuite.execute(new CompressionMethodView(compressionMethod,
+ generalPurposeFlag,
+ 0,
+ 52));
assertThat(lines).hasSize(2);
if (compressionMethod == CompressionMethod.DEFLATE)
assertThat(lines[0]).isEqualTo("compression method (08): deflate");
else if (compressionMethod == CompressionMethod.ENHANCED_DEFLATE)
- assertThat(lines[0]).isEqualTo("compression method (09): deflate (enhanced)");
+ assertThat(lines[0])
+ .isEqualTo("compression method (09): deflate (enhanced)");
assertThat(lines[1]).isEqualTo(" compression sub-type (deflation): normal");
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryViewTest.java
index dfe98ac75..2c75eb438 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/EndCentralDirectoryViewTest.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.Charsets;
import ru.olegcherednik.zip4jvm.model.EndCentralDirectory;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
@@ -47,7 +48,13 @@ public void shouldRetrieveAllLinesWhenEndCentralDirectoryExists() throws IOExcep
EndCentralDirectory endCentralDirectory = createEndCentralDirectory(255533L);
- String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory, block, Charsets.UTF_8, 2, 52, 0, false));
+ String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory,
+ block,
+ Charsets.UTF_8,
+ 2,
+ 52,
+ 0,
+ false));
assertThat(lines).hasSize(13);
assertThat(lines[0]).isEqualTo("(PK0506) End of Central directory record");
assertThat(lines[1]).isEqualTo("========================================");
@@ -72,18 +79,26 @@ public void shouldRetrieveZip64NoteWhenEndCentralDirectoryWithLargeOffs() throws
EndCentralDirectory endCentralDirectory = createEndCentralDirectory(centralDirectoryOffs);
- String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory, block, Charsets.UTF_8, 2, 52, 0, false));
+ String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory,
+ block,
+ Charsets.UTF_8,
+ 2,
+ 52,
+ 0,
+ false));
assertThat(lines).hasSize(14);
assertThat(lines[0]).isEqualTo("(PK0506) End of Central directory record");
assertThat(lines[1]).isEqualTo("========================================");
- assertThat(lines[2]).isEqualTo(" - location: 255614 (0x0003E67E) bytes");
+ assertThat(lines[2]).isEqualTo(
+ " - location: 255614 (0x0003E67E) bytes");
assertThat(lines[3]).isEqualTo(" - size: 33 bytes");
assertThat(lines[4]).isEqualTo(" part number of this part (0001): 2");
assertThat(lines[5]).isEqualTo(" part number of start of central dir (0002): 3");
assertThat(lines[6]).isEqualTo(" number of entries in central dir in this part: 13");
assertThat(lines[7]).isEqualTo(" total number of entries in central dir: 15");
assertThat(lines[8]).isEqualTo(" size of central dir: 81 bytes");
- assertThat(lines[9]).isEqualTo(" relative offset of central dir: 4294967295 (0xFFFFFFFF) bytes");
+ assertThat(lines[9])
+ .isEqualTo(" relative offset of central dir: 4294967295 (0xFFFFFFFF) bytes");
assertThat(lines[10]).isEqualTo(" (see real value in ZIP64 record)");
assertThat(lines[11]).isEqualTo(" zipfile comment length: 11 bytes");
assertThat(lines[12]).isEqualTo(" UTF-8");
@@ -94,9 +109,21 @@ public void shouldRetrieveZip64NoteWhenEndCentralDirectoryWithLargeOffs() throws
public void shouldThrowIllegalArgumentExceptionWhenSomeParametersNull() {
assertThatThrownBy(() -> new EndCentralDirectoryView(null, mock(Block.class), Charsets.UTF_8, 2, 52, 0, false))
.isExactlyInstanceOf(IllegalArgumentException.class);
- assertThatThrownBy(() -> new EndCentralDirectoryView(mock(EndCentralDirectory.class), null, Charsets.UTF_8, 2, 52, 0, false))
+ assertThatThrownBy(() -> new EndCentralDirectoryView(mock(EndCentralDirectory.class),
+ null,
+ Charsets.UTF_8,
+ 2,
+ 52,
+ 0,
+ false))
.isExactlyInstanceOf(IllegalArgumentException.class);
- assertThatThrownBy(() -> new EndCentralDirectoryView(mock(EndCentralDirectory.class), mock(Block.class), null, 2, 52, 0, false))
+ assertThatThrownBy(() -> new EndCentralDirectoryView(mock(EndCentralDirectory.class),
+ mock(Block.class),
+ null,
+ 2,
+ 52,
+ 0,
+ false))
.isExactlyInstanceOf(IllegalArgumentException.class);
}
@@ -109,7 +136,13 @@ public void shouldRetrieveAllLinesWithDiskWhenSplitZip() throws IOException {
EndCentralDirectory endCentralDirectory = createEndCentralDirectory(255533L);
- String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory, block, Charsets.UTF_8, 2, 52, 5, false));
+ String[] lines = Zip4jvmSuite.execute(new EndCentralDirectoryView(endCentralDirectory,
+ block,
+ Charsets.UTF_8,
+ 2,
+ 52,
+ 5,
+ false));
assertThat(lines).hasSize(14);
assertThat(lines[0]).isEqualTo("(PK0506) End of Central directory record");
assertThat(lines[1]).isEqualTo("========================================");
@@ -121,7 +154,8 @@ public void shouldRetrieveAllLinesWithDiskWhenSplitZip() throws IOException {
assertThat(lines[7]).isEqualTo(" number of entries in central dir in this part: 13");
assertThat(lines[8]).isEqualTo(" total number of entries in central dir: 15");
assertThat(lines[9]).isEqualTo(" size of central dir: 81 bytes");
- assertThat(lines[10]).isEqualTo(" relative offset of central dir: 255533 (0x0003E62D) bytes");
+ assertThat(lines[10])
+ .isEqualTo(" relative offset of central dir: 255533 (0x0003E62D) bytes");
assertThat(lines[11]).isEqualTo(" zipfile comment length: 11 bytes");
assertThat(lines[12]).isEqualTo(" UTF-8");
assertThat(lines[13]).isEqualTo(" 70 61 73 73 77 6F 72 64 3A 20 31 password: 1");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesViewTest.java
index 9b9613e37..31ce5db18 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/ExternalFileAttributesViewTest.java
@@ -18,16 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.ExternalFileAttributes;
-import ru.olegcherednik.zip4jvm.model.ExternalFileAttributesTest;
import ru.olegcherednik.zip4jvm.utils.ReflectionUtils;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
-import java.util.Optional;
-import java.util.function.Supplier;
import static org.assertj.core.api.Assertions.assertThat;
import static ru.olegcherednik.zip4jvm.utils.BitUtils.BIT0;
@@ -56,14 +54,15 @@ public class ExternalFileAttributesViewTest {
public void shouldRetrieveWindowsAttributesWhenWin() throws IOException {
ExternalFileAttributes externalFileAttributes = new ExternalFileAttributes(
- new byte[] { (byte)(WINDOWS_READ_ONLY | WINDOWS_SYSTEM | WINDOWS_DIRECTORY), 0x0, 0x0, 0x0 });
+ new byte[] { (byte) (WINDOWS_READ_ONLY | WINDOWS_SYSTEM | WINDOWS_DIRECTORY), 0x0, 0x0, 0x0 });
String[] lines = Zip4jvmSuite.execute(new ExternalFileAttributesView(externalFileAttributes, 0, 52));
assertThat(lines).hasSize(3);
assertThat(lines[0]).isEqualTo("external file attributes: 0x00000015");
assertThat(lines[1]).isEqualTo(" WINDOWS (0x15): rdo sys dir");
- assertThat(lines[2]).isEqualTo(" POSIX (0x000000): " + ExternalFileAttributes.NONE);
+ assertThat(lines[2]).isEqualTo(
+ " POSIX (0x000000): " + ExternalFileAttributes.NONE);
}
public void shouldRetrievePosixAttributesWhenMacOrUnix() throws Exception {
@@ -72,9 +71,9 @@ public void shouldRetrievePosixAttributesWhenMacOrUnix() throws Exception {
ReflectionUtils.invokeConstructor(ExternalFileAttributes.class,
new Class[] { byte[].class, String.class },
new byte[] { 0x0, 0x0,
- (byte)(POSIX_OTHERS_EXECUTE | POSIX_OTHERS_READ | POSIX_GROUP_WRITE |
- POSIX_OWNER_EXECUTE),
- (byte)(POSIX_OWNER_READ | POSIX_REGULAR_FILE) }, osName);
+ (byte) (POSIX_OTHERS_EXECUTE | POSIX_OTHERS_READ
+ | POSIX_GROUP_WRITE | POSIX_OWNER_EXECUTE),
+ (byte) (POSIX_OWNER_READ | POSIX_REGULAR_FILE) }, osName);
String[] lines = Zip4jvmSuite.execute(new ExternalFileAttributesView(externalFileAttributes, 0, 52));
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagViewTest.java
index 2856a112e..63bd9505f 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/GeneralPurposeFlagViewTest.java
@@ -18,12 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.CompressionLevel;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -36,7 +37,10 @@
public class GeneralPurposeFlagViewTest {
public void shouldRetrieveViewWithMultipleLinesWhenNotEncrypted() throws IOException {
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(new GeneralPurposeFlag(), CompressionMethod.STORE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(new GeneralPurposeFlag(),
+ CompressionMethod.STORE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0000) (bit 15..0): 0000.0000 0000.0000");
@@ -50,7 +54,10 @@ public void shouldRetrieveViewWithMultipleLinesWhenEncrypted() throws IOExceptio
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setEncrypted(true);
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag, CompressionMethod.STORE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag,
+ CompressionMethod.STORE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0001) (bit 15..0): 0000.0000 0000.0001");
@@ -64,7 +71,10 @@ public void shouldRetrieveViewWithMultipleLinesWhenDataDescriptorAvailable() thr
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setDataDescriptorAvailable(true);
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag, CompressionMethod.STORE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag,
+ CompressionMethod.STORE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0008) (bit 15..0): 0000.0000 0000.1000");
@@ -78,7 +88,10 @@ public void shouldRetrieveViewWithMultipleLinesWhenStringEncryption() throws IOE
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setStrongEncryption(true);
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag, CompressionMethod.STORE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag,
+ CompressionMethod.STORE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0040) (bit 15..0): 0000.0000 0100.0000");
@@ -92,7 +105,10 @@ public void shouldRetrieveViewWithMultipleLinesWhenUnicode() throws IOException
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setUtf8(true);
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag, CompressionMethod.STORE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag,
+ CompressionMethod.STORE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0800) (bit 15..0): 0000.1000 0000.0000");
@@ -106,7 +122,10 @@ public void shouldRetrieveViewWithMultipleLinesWhenDeflateSuperFast() throws IOE
GeneralPurposeFlag generalPurposeFlag = new GeneralPurposeFlag();
generalPurposeFlag.setCompressionLevel(CompressionLevel.SUPER_FAST);
- String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag, CompressionMethod.DEFLATE, 0, 52));
+ String[] lines = Zip4jvmSuite.execute(new GeneralPurposeFlagView(generalPurposeFlag,
+ CompressionMethod.DEFLATE,
+ 0,
+ 52));
assertThat(lines).hasSize(5);
assertThat(lines[0]).isEqualTo("general purpose bit flag (0x0006) (bit 15..0): 0000.0000 0000.0110");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/InternalFileAttributesViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/InternalFileAttributesViewTest.java
index 2c9a2175e..7b6e95ddc 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/InternalFileAttributesViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/InternalFileAttributesViewTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.InternalFileAttributes;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -34,7 +35,8 @@
public class InternalFileAttributesViewTest {
public void shouldRetrieveWindowsAttributesWhenWin() throws IOException {
- String[] lines = Zip4jvmSuite.execute(new InternalFileAttributesView(new InternalFileAttributes(new byte[] { 0x1, 0x2 }), 0, 52));
+ String[] lines = Zip4jvmSuite.execute(
+ new InternalFileAttributesView(new InternalFileAttributes(new byte[] { 0x1, 0x2 }), 0, 52));
assertThat(lines).hasSize(2);
assertThat(lines[0]).isEqualTo("internal file attributes: 0x0201");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/SizeViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/SizeViewTest.java
index 39a7f8d5e..905bb9a9b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/SizeViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/SizeViewTest.java
@@ -18,9 +18,10 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
@@ -48,6 +49,10 @@ public void shouldPrintByteWhenNameNotBlankAnaOneByte() throws IOException {
public void shouldThrowIllegalArgumentExceptionWhenNameBlank() {
for (String name : Arrays.asList(null, "", " "))
- assertThatThrownBy(() -> new SizeView(name, 666, 4, 52)).isExactlyInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> new SizeView(name,
+ 666,
+ 4,
+ 52)).isExactlyInstanceOf(IllegalArgumentException.class);
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/StringHexViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/StringHexViewTest.java
index 65acf9573..63cb9d715 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/StringHexViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/StringHexViewTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.Charsets;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
@@ -64,7 +65,8 @@ public void shouldFillWholeColumnWhenColumnWidthNotStandard() throws IOException
String[] lines = Zip4jvmSuite.execute(new StringHexView("bikes/honda-cbr600rr.jpg", Charsets.UTF_8, 0, 64));
assertThat(lines).hasSize(3);
assertThat(lines[0]).isEqualTo(" UTF-8");
- assertThat(lines[1]).isEqualTo("62 69 6B 65 73 2F 68 6F 6E 64 61 2D 63 62 72 36 30 30 72 72 2E bikes/honda-cbr600rr.");
+ assertThat(lines[1]).isEqualTo(
+ "62 69 6B 65 73 2F 68 6F 6E 64 61 2D 63 62 72 36 30 30 72 72 2E bikes/honda-cbr600rr.");
assertThat(lines[2]).isEqualTo("6A 70 67 jpg");
}
@@ -83,6 +85,9 @@ public void shouldPrintDotInsteadOfControlCharacterWhenCommentContainsNotPrintab
}
public void shouldThrowIllegalArgumentExceptionWhenCharsetNull() {
- assertThatThrownBy(() -> new StringHexView("oleg", null, 4, 52)).isExactlyInstanceOf(IllegalArgumentException.class);
+ assertThatThrownBy(() -> new StringHexView("oleg",
+ null,
+ 4,
+ 52)).isExactlyInstanceOf(IllegalArgumentException.class);
}
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/VersionViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/VersionViewTest.java
index 85754aa02..5b4dc57d9 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/VersionViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/VersionViewTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.Version;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureViewTest.java
index 5d1919653..0874f311e 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/DigitalSignatureViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.centraldirectory;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryViewTest.java
index f25eda072..037502fbb 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/EncryptedCentralDirectoryViewTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.centraldirectory;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.crypto.strong.EncryptionAlgorithm;
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
@@ -26,6 +25,8 @@
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.CentralDirectoryBlock;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Collections;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderViewTest.java
index 8be3ff0d8..47ec4ad20 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/centraldirectory/FileHeaderViewTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.centraldirectory;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.crypto.aes.AesStrength;
import ru.olegcherednik.zip4jvm.model.CentralDirectory;
@@ -33,6 +32,8 @@
import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -90,7 +91,8 @@ public void shouldRetrieveAllLinesWhenFileHeader() throws IOException {
assertThat(lines[26]).isEqualTo(" apparent file type: binary");
assertThat(lines[27]).isEqualTo(" external file attributes: 0x00000020");
assertThat(lines[28]).isEqualTo(" WINDOWS (0x20): arc");
- assertThat(lines[29]).isEqualTo(" POSIX (0x000000): " + ExternalFileAttributes.NONE);
+ assertThat(lines[29]).isEqualTo(
+ " POSIX (0x000000): " + ExternalFileAttributes.NONE);
}
public void shouldRetrieveExtraFieldLocationAndSizeWhenFileHeaderWithExtraField() throws IOException {
@@ -148,8 +150,10 @@ public void shouldRetrieveExtraFieldLocationAndSizeWhenFileHeaderWithExtraField(
assertThat(lines[26]).isEqualTo(" apparent file type: binary");
assertThat(lines[27]).isEqualTo(" external file attributes: 0x00000020");
assertThat(lines[28]).isEqualTo(" WINDOWS (0x20): arc");
- assertThat(lines[29]).isEqualTo(" POSIX (0x000000): " + ExternalFileAttributes.NONE);
- assertThat(lines[30]).isEqualTo(" extra field: 255603 (0x0003E673) bytes");
+ assertThat(lines[29])
+ .isEqualTo(" POSIX (0x000000): " + ExternalFileAttributes.NONE);
+ assertThat(lines[30])
+ .isEqualTo(" extra field: 255603 (0x0003E673) bytes");
assertThat(lines[31]).isEqualTo(" - size: 11 bytes (1 record)");
}
@@ -198,7 +202,8 @@ public void shouldRetrieveCommentWhenFileHeaderWithComment() throws IOException
assertThat(lines[28]).isEqualTo(" apparent file type: binary");
assertThat(lines[29]).isEqualTo(" external file attributes: 0x00000020");
assertThat(lines[30]).isEqualTo(" WINDOWS (0x20): arc");
- assertThat(lines[31]).isEqualTo(" POSIX (0x000000): " + ExternalFileAttributes.NONE);
+ assertThat(lines[31]).isEqualTo(
+ " POSIX (0x000000): " + ExternalFileAttributes.NONE);
}
private static CentralDirectory.FileHeader createFileHeader(boolean extraField, String comment) {
@@ -220,14 +225,16 @@ private static CentralDirectory.FileHeader createFileHeader(boolean extraField,
fileHeader.setFileName("ducati-panigale-1199.jpg");
if (extraField) {
- fileHeader.setExtraField(PkwareExtraField.builder()
- .addRecord(AesExtraFieldRecord.builder()
- .dataSize(1)
- .versionNumber(2)
- .vendor("AE")
- .strength(AesStrength.S256)
- .compressionMethod(CompressionMethod.DEFLATE).build())
- .build());
+ fileHeader.setExtraField(
+ PkwareExtraField.builder()
+ .addRecord(AesExtraFieldRecord.builder()
+ .dataSize(1)
+ .versionNumber(2)
+ .vendor("AE")
+ .strength(AesStrength.S256)
+ .compressionMethod(CompressionMethod.DEFLATE)
+ .build())
+ .build());
}
fileHeader.setComment(comment);
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderViewTest.java
index bd030db5b..74c51824f 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/AesEncryptionHeaderViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.crypto;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.block.crypto.AesEncryptionHeaderBlock;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -114,7 +115,8 @@ public void shouldRetrieveMultipleLinesWithDiskWhenSplitZip() throws IOException
assertThat(lines[7]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[8]).isEqualTo(" - size: 2 bytes");
assertThat(lines[9]).isEqualTo(" 05 06");
- assertThat(lines[10]).isEqualTo(" mac: 255507 (0x0003E613) bytes");
+ assertThat(lines[10])
+ .isEqualTo(" mac: 255507 (0x0003E613) bytes");
assertThat(lines[11]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[12]).isEqualTo(" - size: 10 bytes");
assertThat(lines[13]).isEqualTo(" 07 08 09 0A 0B 0C 0D 0E 0F");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderBlockViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderBlockViewTest.java
index 2efa45f60..d291a9941 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderBlockViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/crypto/PkwareEncryptionHeaderBlockViewTest.java
@@ -18,10 +18,11 @@
*/
package ru.olegcherednik.zip4jvm.view.crypto;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.crypto.PkwareEncryptionHeaderBlock;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorViewTest.java
index d4fb3a6ef..b6bc13580 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/entry/DataDescriptorViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.entry;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.DataDescriptor;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordViewTest.java
index a80465ef0..ef6d8b327 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AesExtraFieldRecordViewTest.java
@@ -18,13 +18,14 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.crypto.aes.AesStrength;
-import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.GeneralPurposeFlag;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import ru.olegcherednik.zip4jvm.model.extrafield.records.AesExtraFieldRecord;
+
+import org.testng.annotations.Test;
import java.io.IOException;
import java.io.PrintStream;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AlignmentExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AlignmentExtraFieldRecordViewTest.java
index f4823ca66..a0e328d42 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AlignmentExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/AlignmentExtraFieldRecordViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.AlignmentExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordViewTest.java
index a9f2fa5e1..9d7b5fe27 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/ExtendedTimestampExtraFieldRecordViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.ExtendedTimestampExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
@@ -64,7 +65,8 @@ public void shouldRetrieveThreeTimesWhenAllTimesSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(5);
- assertThat(lines[0]).isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
assertThat(lines[1]).isEqualTo(" - size: 17 bytes");
assertThat(lines[2]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
assertThat(lines[3]).isEqualTo(" Last Accessed Date: 2019-10-22 00:13:05");
@@ -76,12 +78,13 @@ public void shouldRetrieveLastModificationTimeWhenOnlyItSet() throws IOException
when(block.getSize()).thenReturn(17L);
when(block.getRelativeOffs()).thenReturn(5296723L);
- ExtendedTimestampExtraFieldRecord record = ExtendedTimestampExtraFieldRecord.builder()
- .dataSize(13)
- .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT0))
- .lastModificationTime(lastModifiedTime)
- .lastAccessTime(lastAccessTime)
- .creationTime(creationTime).build();
+ ExtendedTimestampExtraFieldRecord record =
+ ExtendedTimestampExtraFieldRecord.builder()
+ .dataSize(13)
+ .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT0))
+ .lastModificationTime(lastModifiedTime)
+ .lastAccessTime(lastAccessTime)
+ .creationTime(creationTime).build();
String[] lines = Zip4jvmSuite.execute(ExtendedTimestampExtraFieldRecordView.builder()
.record(record)
@@ -89,7 +92,8 @@ public void shouldRetrieveLastModificationTimeWhenOnlyItSet() throws IOException
.position(0, 52, 0).build());
assertThat(lines).hasSize(3);
- assertThat(lines[0]).isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
assertThat(lines[1]).isEqualTo(" - size: 17 bytes");
assertThat(lines[2]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
}
@@ -99,12 +103,13 @@ public void shouldRetrieveLastAccessTimeWhenOnlyItSet() throws IOException {
when(block.getSize()).thenReturn(17L);
when(block.getRelativeOffs()).thenReturn(5296723L);
- ExtendedTimestampExtraFieldRecord record = ExtendedTimestampExtraFieldRecord.builder()
- .dataSize(13)
- .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT1))
- .lastModificationTime(lastModifiedTime)
- .lastAccessTime(lastAccessTime)
- .creationTime(creationTime).build();
+ ExtendedTimestampExtraFieldRecord record =
+ ExtendedTimestampExtraFieldRecord.builder()
+ .dataSize(13)
+ .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT1))
+ .lastModificationTime(lastModifiedTime)
+ .lastAccessTime(lastAccessTime)
+ .creationTime(creationTime).build();
String[] lines = Zip4jvmSuite.execute(ExtendedTimestampExtraFieldRecordView.builder()
.record(record)
@@ -112,7 +117,8 @@ public void shouldRetrieveLastAccessTimeWhenOnlyItSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(3);
- assertThat(lines[0]).isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
assertThat(lines[1]).isEqualTo(" - size: 17 bytes");
assertThat(lines[2]).isEqualTo(" Last Accessed Date: 2019-10-22 00:13:05");
}
@@ -122,12 +128,13 @@ public void shouldRetrieveCreationTimeWhenOnlyItSet() throws IOException {
when(block.getSize()).thenReturn(17L);
when(block.getRelativeOffs()).thenReturn(5296723L);
- ExtendedTimestampExtraFieldRecord record = ExtendedTimestampExtraFieldRecord.builder()
- .dataSize(13)
- .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT2))
- .lastModificationTime(lastModifiedTime)
- .lastAccessTime(lastAccessTime)
- .creationTime(creationTime).build();
+ ExtendedTimestampExtraFieldRecord record =
+ ExtendedTimestampExtraFieldRecord.builder()
+ .dataSize(13)
+ .flag(new ExtendedTimestampExtraFieldRecord.Flag(BIT2))
+ .lastModificationTime(lastModifiedTime)
+ .lastAccessTime(lastAccessTime)
+ .creationTime(creationTime).build();
String[] lines = Zip4jvmSuite.execute(ExtendedTimestampExtraFieldRecordView.builder()
.record(record)
@@ -135,17 +142,19 @@ public void shouldRetrieveCreationTimeWhenOnlyItSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(3);
- assertThat(lines[0]).isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
assertThat(lines[1]).isEqualTo(" - size: 17 bytes");
assertThat(lines[2]).isEqualTo(" Creation Date: 2019-11-04 21:33:02");
}
public void shouldRetrieveEmptyStringWhenRecordNull() throws IOException {
PrintStream out = mock(PrintStream.class);
- ExtendedTimestampExtraFieldRecordView view = ExtendedTimestampExtraFieldRecordView.builder()
- .record(ExtendedTimestampExtraFieldRecord.NULL)
- .block(mock(Block.class))
- .position(0, 52, 0).build();
+ ExtendedTimestampExtraFieldRecordView view =
+ ExtendedTimestampExtraFieldRecordView.builder()
+ .record(ExtendedTimestampExtraFieldRecord.NULL)
+ .block(mock(Block.class))
+ .position(0, 52, 0).build();
assertThat(view.printTextInfo(out)).isFalse();
}
@@ -170,7 +179,8 @@ public void shouldRetrieveThreeTimesWithDiskWhenSplit() throws IOException {
.position(0, 52, 5).build());
assertThat(lines).hasSize(6);
- assertThat(lines[0]).isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5455) Universal time: 5296723 (0x0050D253) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 17 bytes");
assertThat(lines[3]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordViewTest.java
index 0da044c38..e96c51e2d 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipNewUnixExtraFieldRecordViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.InfoZipNewUnixExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
@@ -45,7 +46,8 @@ public void shouldRetrieveVersionOneRecordWhenVersionOne() throws IOException {
InfoZipNewUnixExtraFieldRecord.Payload payload = InfoZipNewUnixExtraFieldRecord.VersionOnePayload.builder()
.uid("aaa")
- .gid("bbb").build();
+ .gid("bbb")
+ .build();
InfoZipNewUnixExtraFieldRecord record = InfoZipNewUnixExtraFieldRecord.builder()
.dataSize(11)
@@ -57,7 +59,8 @@ public void shouldRetrieveVersionOneRecordWhenVersionOne() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(5);
- assertThat(lines[0]).isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
assertThat(lines[1]).isEqualTo(" - size: 15 bytes");
assertThat(lines[2]).isEqualTo(" version: 1");
assertThat(lines[3]).isEqualTo(" User identifier (UID): aaa");
@@ -69,10 +72,11 @@ public void shouldRetrieveUnknownVersionRecordWhenVersionNotOne() throws IOExcep
when(block.getSize()).thenReturn(15L);
when(block.getRelativeOffs()).thenReturn(5296740L);
- InfoZipNewUnixExtraFieldRecord.Payload payload = InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload.builder()
- .version(2)
- .data(new byte[] { 0x0, 0x1, 0x2, 0x3 })
- .build();
+ InfoZipNewUnixExtraFieldRecord.Payload payload =
+ InfoZipNewUnixExtraFieldRecord.VersionUnknownPayload.builder()
+ .version(2)
+ .data(new byte[] { 0x0, 0x1, 0x2, 0x3 })
+ .build();
InfoZipNewUnixExtraFieldRecord record = InfoZipNewUnixExtraFieldRecord.builder()
.dataSize(11)
@@ -84,7 +88,8 @@ public void shouldRetrieveUnknownVersionRecordWhenVersionNotOne() throws IOExcep
.position(0, 52, 0).build());
assertThat(lines).hasSize(4);
- assertThat(lines[0]).isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
assertThat(lines[1]).isEqualTo(" - size: 15 bytes");
assertThat(lines[2]).isEqualTo(" version: 2 (unknown)");
assertThat(lines[3]).isEqualTo("00 01 02 03");
@@ -92,10 +97,11 @@ public void shouldRetrieveUnknownVersionRecordWhenVersionNotOne() throws IOExcep
public void shouldRetrieveEmptyStringWhenRecordNull() throws IOException {
PrintStream out = mock(PrintStream.class);
- InfoZipNewUnixExtraFieldRecordView view = InfoZipNewUnixExtraFieldRecordView.builder()
- .record(InfoZipNewUnixExtraFieldRecord.NULL)
- .block(mock(Block.class))
- .position(0, 52, 0).build();
+ InfoZipNewUnixExtraFieldRecordView view =
+ InfoZipNewUnixExtraFieldRecordView.builder()
+ .record(InfoZipNewUnixExtraFieldRecord.NULL)
+ .block(mock(Block.class))
+ .position(0, 52, 0).build();
assertThat(view.printTextInfo(out)).isFalse();
}
@@ -108,7 +114,8 @@ public void shouldRetrieveVersionOneRecordWithDiskWhenSplit() throws IOException
InfoZipNewUnixExtraFieldRecord.Payload payload = InfoZipNewUnixExtraFieldRecord.VersionOnePayload.builder()
.uid("aaa")
- .gid("bbb").build();
+ .gid("bbb")
+ .build();
InfoZipNewUnixExtraFieldRecord record = InfoZipNewUnixExtraFieldRecord.builder()
.dataSize(11)
@@ -120,11 +127,13 @@ public void shouldRetrieveVersionOneRecordWithDiskWhenSplit() throws IOException
.position(0, 52, 5).build());
assertThat(lines).hasSize(6);
- assertThat(lines[0]).isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x7875) new InfoZIP Unix/OS2/NT: 5296740 (0x0050D264) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 15 bytes");
assertThat(lines[3]).isEqualTo(" version: 1");
assertThat(lines[4]).isEqualTo(" User identifier (UID): aaa");
assertThat(lines[5]).isEqualTo(" Group Identifier (GID): bbb");
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordViewTest.java
index b0ca7f9e3..0fbd089e7 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/InfoZipOldUnixExtraFieldRecordViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.InfoZipOldUnixExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
@@ -59,7 +60,8 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(6);
- assertThat(lines[0]).isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
assertThat(lines[1]).isEqualTo(" - size: 12 bytes");
assertThat(lines[2]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
assertThat(lines[3]).isEqualTo(" Last Accessed Date: 2019-10-22 00:13:05");
@@ -75,7 +77,8 @@ public void shouldRetrieveTimesOnlyWhenNoUserId() throws IOException {
InfoZipOldUnixExtraFieldRecord record = InfoZipOldUnixExtraFieldRecord.builder()
.dataSize(8)
.lastAccessTime(lastAccessTime)
- .lastModificationTime(lastModifiedTime).build();
+ .lastModificationTime(lastModifiedTime)
+ .build();
String[] lines = Zip4jvmSuite.execute(InfoZipOldUnixExtraFieldRecordView.builder()
.record(record)
@@ -83,7 +86,8 @@ public void shouldRetrieveTimesOnlyWhenNoUserId() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(4);
- assertThat(lines[0]).isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
assertThat(lines[1]).isEqualTo(" - size: 12 bytes");
assertThat(lines[2]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
assertThat(lines[3]).isEqualTo(" Last Accessed Date: 2019-10-22 00:13:05");
@@ -91,10 +95,11 @@ public void shouldRetrieveTimesOnlyWhenNoUserId() throws IOException {
public void shouldRetrieveEmptyStringWhenRecordNull() throws IOException {
PrintStream out = mock(PrintStream.class);
- InfoZipOldUnixExtraFieldRecordView view = InfoZipOldUnixExtraFieldRecordView.builder()
- .record(InfoZipOldUnixExtraFieldRecord.NULL)
- .block(mock(Block.class))
- .position(0, 52, 0).build();
+ InfoZipOldUnixExtraFieldRecordView view =
+ InfoZipOldUnixExtraFieldRecordView.builder()
+ .record(InfoZipOldUnixExtraFieldRecord.NULL)
+ .block(mock(Block.class))
+ .position(0, 52, 0).build();
assertThat(view.printTextInfo(out)).isFalse();
}
@@ -118,7 +123,8 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
.position(0, 52, 5).build());
assertThat(lines).hasSize(7);
- assertThat(lines[0]).isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x5855) old InfoZIP Unix/OS2/NT: 5300395 (0x0050E0AB) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 12 bytes");
assertThat(lines[3]).isEqualTo(" Last Modified Date: 2019-10-24 07:46:22");
@@ -126,4 +132,5 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
assertThat(lines[5]).isEqualTo(" User identifier (UID): 111");
assertThat(lines[6]).isEqualTo(" Group Identifier (GID): 222");
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordViewTest.java
index 0bfd7e8e6..02a1bac8d 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/NtfsTimestampExtraFieldRecordViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.NtfsTimestampExtraFieldRecord;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
@@ -31,7 +32,6 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-
/**
* @author Oleg Cherednik
* @since 09.11.2019
@@ -49,18 +49,24 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
when(block.getSize()).thenReturn(36L);
when(block.getRelativeOffs()).thenReturn(11208273272L);
- NtfsTimestampExtraFieldRecord.Tag tagOne = NtfsTimestampExtraFieldRecord.OneTag.builder()
- .lastModificationTime(lastModifiedTime)
- .lastAccessTime(lastAccessTime)
- .creationTime(creationTime).build();
-
- NtfsTimestampExtraFieldRecord.Tag tagUnknown = NtfsTimestampExtraFieldRecord.UnknownTag.builder()
- .signature(0x0002)
- .data(new byte[] { 0x0, 0x1, 0x2, 0x3 }).build();
-
- NtfsTimestampExtraFieldRecord record = NtfsTimestampExtraFieldRecord.builder()
- .dataSize(32)
- .tags(Arrays.asList(tagOne, tagUnknown)).build();
+ NtfsTimestampExtraFieldRecord.Tag tagOne =
+ NtfsTimestampExtraFieldRecord.OneTag.builder()
+ .lastModificationTime(lastModifiedTime)
+ .lastAccessTime(lastAccessTime)
+ .creationTime(creationTime)
+ .build();
+
+ NtfsTimestampExtraFieldRecord.Tag tagUnknown =
+ NtfsTimestampExtraFieldRecord.UnknownTag.builder()
+ .signature(0x0002)
+ .data(new byte[] { 0x0, 0x1, 0x2, 0x3 })
+ .build();
+
+ NtfsTimestampExtraFieldRecord record =
+ NtfsTimestampExtraFieldRecord.builder()
+ .dataSize(32)
+ .tags(Arrays.asList(tagOne, tagUnknown))
+ .build();
String[] lines = Zip4jvmSuite.execute(NtfsTimestampExtraFieldRecordView.builder()
.record(record)
@@ -68,7 +74,8 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(9);
- assertThat(lines[0]).isEqualTo("(0x000A) NTFS Timestamp: 11208273272 (0x29C10AD78) bytes");
+ assertThat(lines[0]).isEqualTo(
+ "(0x000A) NTFS Timestamp: 11208273272 (0x29C10AD78) bytes");
assertThat(lines[1]).isEqualTo(" - size: 36 bytes");
assertThat(lines[2]).isEqualTo(" - total tags: 2");
assertThat(lines[3]).isEqualTo(" (0x0001) Tag1: 24 bytes");
@@ -81,10 +88,11 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
public void shouldRetrieveEmptyStringWhenRecordNull() throws IOException {
PrintStream out = mock(PrintStream.class);
- NtfsTimestampExtraFieldRecordView view = NtfsTimestampExtraFieldRecordView.builder()
- .record(NtfsTimestampExtraFieldRecord.NULL)
- .block(mock(Block.class))
- .position(0, 52, 0).build();
+ NtfsTimestampExtraFieldRecordView view =
+ NtfsTimestampExtraFieldRecordView.builder()
+ .record(NtfsTimestampExtraFieldRecord.NULL)
+ .block(mock(Block.class))
+ .position(0, 52, 0).build();
assertThat(view.printTextInfo(out)).isFalse();
}
@@ -95,18 +103,23 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
when(block.getDiskNo()).thenReturn(5);
when(block.getFileName()).thenReturn("src.zip");
- NtfsTimestampExtraFieldRecord.Tag tagOne = NtfsTimestampExtraFieldRecord.OneTag.builder()
- .lastModificationTime(lastModifiedTime)
- .lastAccessTime(lastAccessTime)
- .creationTime(creationTime).build();
+ NtfsTimestampExtraFieldRecord.Tag tagOne =
+ NtfsTimestampExtraFieldRecord.OneTag.builder()
+ .lastModificationTime(lastModifiedTime)
+ .lastAccessTime(lastAccessTime)
+ .creationTime(creationTime)
+ .build();
- NtfsTimestampExtraFieldRecord.Tag tagUnknown = NtfsTimestampExtraFieldRecord.UnknownTag.builder()
- .signature(0x0002)
- .data(new byte[] { 0x0, 0x1, 0x2, 0x3 }).build();
+ NtfsTimestampExtraFieldRecord.Tag tagUnknown =
+ NtfsTimestampExtraFieldRecord.UnknownTag.builder()
+ .signature(0x0002)
+ .data(new byte[] { 0x0, 0x1, 0x2, 0x3 })
+ .build();
NtfsTimestampExtraFieldRecord record = NtfsTimestampExtraFieldRecord.builder()
.dataSize(32)
- .tags(Arrays.asList(tagOne, tagUnknown)).build();
+ .tags(Arrays.asList(tagOne, tagUnknown))
+ .build();
String[] lines = Zip4jvmSuite.execute(NtfsTimestampExtraFieldRecordView.builder()
.record(record)
@@ -114,7 +127,8 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
.position(0, 52, 5).build());
assertThat(lines).hasSize(10);
- assertThat(lines[0]).isEqualTo("(0x000A) NTFS Timestamp: 11208273272 (0x29C10AD78) bytes");
+ assertThat(lines[0]).isEqualTo(
+ "(0x000A) NTFS Timestamp: 11208273272 (0x29C10AD78) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 36 bytes");
assertThat(lines[3]).isEqualTo(" - total tags: 2");
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordViewTest.java
index a03ac6974..19140793b 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/UnknownExtraFieldRecordViewTest.java
@@ -18,13 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.apache.commons.lang3.ArrayUtils;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.model.extrafield.PkwareExtraField;
import ru.olegcherednik.zip4jvm.model.block.Block;
import ru.olegcherednik.zip4jvm.model.extrafield.records.UnknownExtraFieldRecord;
+import org.apache.commons.lang3.ArrayUtils;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -49,10 +49,12 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
.record(record)
.block(block)
.data(new byte[] { 0x0, 0x1, 0x2, 0x3 })
- .position(0, 52, 0).build());
+ .position(0, 52, 0)
+ .build());
assertThat(lines).hasSize(3);
- assertThat(lines[0]).isEqualTo("(0x0666) Unknown: 11208273272 (0x29C10AD78) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x0666) Unknown: 11208273272 (0x29C10AD78) bytes");
assertThat(lines[1]).isEqualTo(" - size: 36 bytes");
assertThat(lines[2]).isEqualTo("00 01 02 03");
}
@@ -73,9 +75,11 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
.position(0, 52, 5).build());
assertThat(lines).hasSize(4);
- assertThat(lines[0]).isEqualTo("(0x0666) Unknown: 11208273272 (0x29C10AD78) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x0666) Unknown: 11208273272 (0x29C10AD78) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 36 bytes");
assertThat(lines[3]).isEqualTo("00 01 02 03");
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoViewTest.java
index c8b214aa4..6c6b95561 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/extrafield/Zip64ExtendedInfoViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.extrafield;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.io.PrintStream;
@@ -55,7 +56,8 @@ public void shouldRetrieveAllDataWhenAllDataSet() throws IOException {
.position(0, 52, 0).build());
assertThat(lines).hasSize(6);
- assertThat(lines[0]).isEqualTo("(0x0001) Zip64 Extended Information: 5300395 (0x0050E0AB) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x0001) Zip64 Extended Information: 5300395 (0x0050E0AB) bytes");
assertThat(lines[1]).isEqualTo(" - size: 12 bytes");
assertThat(lines[2]).isEqualTo(" original compressed size: 11322883953 bytes");
assertThat(lines[3]).isEqualTo(" original uncompressed size: 11208273150 bytes");
@@ -91,7 +93,8 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
.position(0, 52, 5).build());
assertThat(lines).hasSize(7);
- assertThat(lines[0]).isEqualTo("(0x0001) Zip64 Extended Information: 5300395 (0x0050E0AB) bytes");
+ assertThat(lines[0])
+ .isEqualTo("(0x0001) Zip64 Extended Information: 5300395 (0x0050E0AB) bytes");
assertThat(lines[1]).isEqualTo(" - disk (0005): src.zip");
assertThat(lines[2]).isEqualTo(" - size: 12 bytes");
assertThat(lines[3]).isEqualTo(" original compressed size: 11322883953 bytes");
@@ -99,4 +102,5 @@ public void shouldRetrieveAllDataWithDiskWhenSplit() throws IOException {
assertThat(lines[5]).isEqualTo(" original relative offset of local header: 145 (0x00000091) bytes");
assertThat(lines[6]).isEqualTo(" original part number of this part (0002): 2");
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorViewTest.java
index f068f5976..5e7de2068 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryLocatorViewTest.java
@@ -18,11 +18,12 @@
*/
package ru.olegcherednik.zip4jvm.view.zip64;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import static org.assertj.core.api.Assertions.assertThat;
@@ -50,10 +51,12 @@ public void shouldRetrieveAllLinesWhenLocatorExists() throws IOException {
assertThat(lines).hasSize(7);
assertThat(lines[0]).isEqualTo("(PK0607) ZIP64 End of Central directory locator");
assertThat(lines[1]).isEqualTo("===============================================");
- assertThat(lines[2]).isEqualTo(" - location: 11208273384 (0x29C10ADE8) bytes");
+ assertThat(lines[2])
+ .isEqualTo(" - location: 11208273384 (0x29C10ADE8) bytes");
assertThat(lines[3]).isEqualTo(" - size: 20 bytes");
assertThat(lines[4]).isEqualTo(" part number of new-end-of-central-dir (0001): 2");
- assertThat(lines[5]).isEqualTo(" relative offset of new-end-of-central-dir: 11208273328 (0x29C10ADB0) bytes");
+ assertThat(lines[5])
+ .isEqualTo(" relative offset of new-end-of-central-dir: 11208273328 (0x29C10ADB0) bytes");
assertThat(lines[6]).isEqualTo(" total number of parts in archive: 5");
}
@@ -74,10 +77,13 @@ public void shouldRetrieveAllLineWithDiskWhenSplitZip() throws IOException {
assertThat(lines[0]).isEqualTo("(PK0607) ZIP64 End of Central directory locator");
assertThat(lines[1]).isEqualTo("===============================================");
assertThat(lines[2]).isEqualTo(" - disk (0005): src.zip");
- assertThat(lines[3]).isEqualTo(" - location: 11208273384 (0x29C10ADE8) bytes");
+ assertThat(lines[3])
+ .isEqualTo(" - location: 11208273384 (0x29C10ADE8) bytes");
assertThat(lines[4]).isEqualTo(" - size: 20 bytes");
assertThat(lines[5]).isEqualTo(" part number of new-end-of-central-dir (0001): 2");
- assertThat(lines[6]).isEqualTo(" relative offset of new-end-of-central-dir: 11208273328 (0x29C10ADB0) bytes");
+ assertThat(lines[6])
+ .isEqualTo(" relative offset of new-end-of-central-dir: 11208273328 (0x29C10ADB0) bytes");
assertThat(lines[7]).isEqualTo(" total number of parts in archive: 5");
}
+
}
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryViewTest.java
index 1ff1d4207..fe8e60310 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/EndCentralDirectoryViewTest.java
@@ -18,17 +18,13 @@
*/
package ru.olegcherednik.zip4jvm.view.zip64;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
-import ru.olegcherednik.zip4jvm.crypto.aes.AesStrength;
-import ru.olegcherednik.zip4jvm.crypto.strong.EncryptionAlgorithm;
-import ru.olegcherednik.zip4jvm.crypto.strong.Flags;
-import ru.olegcherednik.zip4jvm.crypto.strong.HashAlgorithm;
-import ru.olegcherednik.zip4jvm.model.CompressionMethod;
import ru.olegcherednik.zip4jvm.model.Version;
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
import java.util.Arrays;
@@ -56,7 +52,8 @@ public void shouldRetrieveAllLinesWhenZip64EndCentralDirectoryExists() throws IO
assertThat(lines).hasSize(15);
assertThat(lines[0]).isEqualTo("(PK0606) ZIP64 End of Central directory record");
assertThat(lines[1]).isEqualTo("==============================================");
- assertThat(lines[2]).isEqualTo(" - location: 11208273328 (0x29C10ADB0) bytes");
+ assertThat(lines[2]).isEqualTo(
+ " - location: 11208273328 (0x29C10ADB0) bytes");
assertThat(lines[3]).isEqualTo(" - size: 56 bytes");
assertThat(lines[4]).isEqualTo(" number of bytes in rest of record: 345 bytes");
assertThat(lines[5]).isEqualTo(" version made by operating system (00): MS-DOS, OS/2, NT FAT");
@@ -68,7 +65,8 @@ public void shouldRetrieveAllLinesWhenZip64EndCentralDirectoryExists() throws IO
assertThat(lines[11]).isEqualTo(" number of entries in central dir in this part: 13");
assertThat(lines[12]).isEqualTo(" total number of entries in central dir: 15");
assertThat(lines[13]).isEqualTo(" size of central dir: 115 bytes");
- assertThat(lines[14]).isEqualTo(" relative offset of central dir: 11208273213 (0x29C10AD3D) bytes");
+ assertThat(lines[14]).isEqualTo(
+ " relative offset of central dir: 11208273213 (0x29C10AD3D) bytes");
}
public void shouldRetrieveAllLinesWithDiskWhenSplitZip() throws IOException {
@@ -85,7 +83,8 @@ public void shouldRetrieveAllLinesWithDiskWhenSplitZip() throws IOException {
assertThat(lines[0]).isEqualTo("(PK0606) ZIP64 End of Central directory record");
assertThat(lines[1]).isEqualTo("==============================================");
assertThat(lines[2]).isEqualTo(" - disk (0005): src.zip");
- assertThat(lines[3]).isEqualTo(" - location: 11208273328 (0x29C10ADB0) bytes");
+ assertThat(lines[3]).isEqualTo(
+ " - location: 11208273328 (0x29C10ADB0) bytes");
assertThat(lines[4]).isEqualTo(" - size: 56 bytes");
assertThat(lines[5]).isEqualTo(" number of bytes in rest of record: 345 bytes");
assertThat(lines[6]).isEqualTo(" version made by operating system (00): MS-DOS, OS/2, NT FAT");
@@ -97,7 +96,8 @@ public void shouldRetrieveAllLinesWithDiskWhenSplitZip() throws IOException {
assertThat(lines[12]).isEqualTo(" number of entries in central dir in this part: 13");
assertThat(lines[13]).isEqualTo(" total number of entries in central dir: 15");
assertThat(lines[14]).isEqualTo(" size of central dir: 115 bytes");
- assertThat(lines[15]).isEqualTo(" relative offset of central dir: 11208273213 (0x29C10AD3D) bytes");
+ assertThat(lines[15]).isEqualTo(
+ " relative offset of central dir: 11208273213 (0x29C10AD3D) bytes");
}
private static Zip64.EndCentralDirectory createEndCentralDirectory() {
diff --git a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorViewTest.java b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorViewTest.java
index cb7275091..d255a3ed7 100644
--- a/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorViewTest.java
+++ b/src/test/java/ru/olegcherednik/zip4jvm/view/zip64/ExtensibleDataSectorViewTest.java
@@ -18,7 +18,6 @@
*/
package ru.olegcherednik.zip4jvm.view.zip64;
-import org.testng.annotations.Test;
import ru.olegcherednik.zip4jvm.Zip4jvmSuite;
import ru.olegcherednik.zip4jvm.crypto.aes.AesStrength;
import ru.olegcherednik.zip4jvm.crypto.strong.EncryptionAlgorithm;
@@ -28,8 +27,9 @@
import ru.olegcherednik.zip4jvm.model.Zip64;
import ru.olegcherednik.zip4jvm.model.block.Block;
+import org.testng.annotations.Test;
+
import java.io.IOException;
-import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -53,7 +53,8 @@ public void shouldRetrieveAllLinesWhenZip64ExtensibleDataSectorExists() throws I
assertThat(lines).hasSize(13);
assertThat(lines[0]).isEqualTo("ZIP64 Extensible data sector");
assertThat(lines[1]).isEqualTo("============================");
- assertThat(lines[2]).isEqualTo(" - location: 11208273328 (0x29C10ADB0) bytes");
+ assertThat(lines[2]).isEqualTo(
+ " - location: 11208273328 (0x29C10ADB0) bytes");
assertThat(lines[3]).isEqualTo(" - size: 56 bytes");
assertThat(lines[4]).isEqualTo(" compression method (99): AES encryption");
assertThat(lines[5]).isEqualTo(" compressed size: 438 bytes");
diff --git a/store/solid/off/src.zip b/store/solid/off/src.zip
new file mode 100644
index 000000000..f04d13578
Binary files /dev/null and b/store/solid/off/src.zip differ
diff --git a/zip.png b/zip.png
deleted file mode 100644
index 154475572..000000000
Binary files a/zip.png and /dev/null differ