@@ -96,6 +96,8 @@ public void testConcatAndMerged(String name) {
96
96
assertNotEquals (stdHello , jvmHello );
97
97
String stdHelloRaw = ByteDataUtil .toString (ZipCompressions .decompress (stdHello ));
98
98
String jvmHelloRaw = ByteDataUtil .toString (ZipCompressions .decompress (jvmHello ));
99
+ assertFalse (stdHelloRaw .isEmpty ());
100
+ assertFalse (jvmHelloRaw .isEmpty ());
99
101
assertTrue (stdHelloRaw .contains ("Hello world" ));
100
102
assertTrue (jvmHelloRaw .contains ("The secret code is: ROSE" ));
101
103
} catch (IOException ex ) {
@@ -115,6 +117,7 @@ public void testLocalHeaderDetectMismatch() {
115
117
116
118
LocalFileHeader hello = zipStd .getLocalFileByName ("Hello.class" );
117
119
assertNotNull (hello );
120
+ assertEquals (0 , hello .getFileData ().length ()); // Should be empty
118
121
119
122
// The local file header says the contents are 0 bytes, but the central header has the real length
120
123
assertTrue (hello .hasDifferentValuesThanCentralDirectoryHeader ());
@@ -128,11 +131,12 @@ public void postProcessLocalFileHeader(@Nonnull LocalFileHeader file) {
128
131
});
129
132
LocalFileHeader helloAdopted = zipStdAndAdopt .getLocalFileByName ("Hello.class" );
130
133
assertFalse (helloAdopted .hasDifferentValuesThanCentralDirectoryHeader ());
134
+ assertNotEquals (0 , helloAdopted .getFileData ().length ()); // Should have data
131
135
132
- // Alternatively, just use the JVM strategy
136
+ // The JVM strategy copies most properties, except for size.
133
137
ZipArchive zipJvm = ZipIO .readJvm (path );
134
138
helloAdopted = zipJvm .getLocalFileByName ("Hello.class" );
135
- assertFalse ( helloAdopted .hasDifferentValuesThanCentralDirectoryHeader ());
139
+ assertNotEquals ( 0 , helloAdopted .getFileData (). length ()); // Should have data, even if not sourced from values in the CEN
136
140
} catch (IOException ex ) {
137
141
fail (ex );
138
142
}
0 commit comments