42
42
import static ru .olegcherednik .zip4jvm .TestDataAssert .fileBentleyAssert ;
43
43
import static ru .olegcherednik .zip4jvm .TestDataAssert .fileFerrariAssert ;
44
44
import static ru .olegcherednik .zip4jvm .TestDataAssert .fileSaintPetersburgAssert ;
45
+ import static ru .olegcherednik .zip4jvm .TestDataAssert .rootAssert ;
45
46
import static ru .olegcherednik .zip4jvm .assertj .Zip4jvmAssertions .assertThatDirectory ;
46
47
import static ru .olegcherednik .zip4jvm .assertj .Zip4jvmAssertions .assertThatFile ;
47
48
@@ -86,9 +87,7 @@ public void shouldUnzipOneFileIgnorePath() throws IOException {
86
87
public void shouldUnzipFolder () throws IOException {
87
88
Path dstDir = Zip4jvmSuite .subDirNameAsMethodNameWithTime (rootDir );
88
89
UnzipIt .zip (zipDeflateSolid ).dstDir (dstDir ).extract (dirNameBikes );
89
-
90
- assertThatDirectory (dstDir ).exists ().hasEntries (1 ).hasDirectories (1 );
91
- assertThatDirectory (dstDir .resolve (dirNameBikes )).matches (dirBikesAssert );
90
+ assertThatDirectory (dstDir ).matches (dirBikesAssert );
92
91
}
93
92
94
93
public void shouldExtractZipArchiveWhenEntryNameWithCustomCharset () throws IOException {
@@ -98,7 +97,6 @@ public void shouldExtractZipArchiveWhenEntryNameWithCustomCharset() throws IOExc
98
97
UnzipSettings settings = UnzipSettings .builder ().charset (Charset .forName ("GBK" )).build ();
99
98
100
99
UnzipIt .zip (zip ).dstDir (dstDir ).settings (settings ).extract ();
101
-
102
100
assertThatDirectory (dstDir ).hasEntries (2 ).hasRegularFiles (2 );
103
101
}
104
102
@@ -108,9 +106,9 @@ public void shouldExtractZipArchiveWhenZipWasCreatedUnderMac() throws IOExceptio
108
106
109
107
UnzipIt .zip (zip ).dstDir (dstDir ).extract ();
110
108
111
- // TODO commented tests
112
- // assertThatDirectory(dstDir).hasDirectories(0).hasFiles(2 );
113
- // assertThatDirectory(dstDir).file("fff - 副本.txt").exists( );
109
+ assertThatDirectory ( dstDir ). hasDirectories ( 2 ). hasRegularFiles ( 0 );
110
+ assertThatDirectory (dstDir . resolve ( "__MACOSX" )). exists ( );
111
+ assertThatDirectory (dstDir . resolve ( "data" )). matches ( rootAssert );
114
112
}
115
113
116
114
public void shouldExtractZipArchiveWhenUtf8Charset () throws IOException {
@@ -128,23 +126,4 @@ public void shouldExtractZipArchiveWhenUtf8Charset() throws IOException {
128
126
assertThatDirectory (dstDir ).directory ("test/测试文件夹3" ).exists ();
129
127
}
130
128
131
- @ Test (enabled = false )
132
- public void foo () throws IOException {
133
- /*
134
- The issue was that for some unknown reason there's a spanned archive
135
- marker (0x08074b50, little endian) at the start of these ZIP files,
136
- right before the first local file header (0x04034b50), which results
137
- in iterating over the file using ZipInputStream.getNextEntry() failing
138
- as the first call immediately returns null.
139
- */
140
- // Path dstDir = Zip4jvmSuite.subDirNameAsMethodNameWithTime(rootDir);
141
- // Path zip = Zip4jvmSuite.getResourcePath("/zip/spanned.zip");
142
-
143
- // TODO we could have a problem when read a zip like a stream (not reading CentralDirectory)
144
- // see https://github.com/srikanth-lingala/zip4j/issues/563
145
- // Stream<ZipFile.Entry> stream = UnzipIt.zip(zip).open().stream();
146
-
147
- // ZipInfo.zip(zip).decompose(dstDir);
148
- }
149
-
150
129
}
0 commit comments