Skip to content

Commit bbf8280

Browse files
committed
Update assertions now that JVM local doesn't copy *all* values
1 parent e1f45ab commit bbf8280

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/java/software/coley/lljzip/PartParseTests.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ public void testConcatAndMerged(String name) {
9696
assertNotEquals(stdHello, jvmHello);
9797
String stdHelloRaw = ByteDataUtil.toString(ZipCompressions.decompress(stdHello));
9898
String jvmHelloRaw = ByteDataUtil.toString(ZipCompressions.decompress(jvmHello));
99+
assertFalse(stdHelloRaw.isEmpty());
100+
assertFalse(jvmHelloRaw.isEmpty());
99101
assertTrue(stdHelloRaw.contains("Hello world"));
100102
assertTrue(jvmHelloRaw.contains("The secret code is: ROSE"));
101103
} catch (IOException ex) {
@@ -115,6 +117,7 @@ public void testLocalHeaderDetectMismatch() {
115117

116118
LocalFileHeader hello = zipStd.getLocalFileByName("Hello.class");
117119
assertNotNull(hello);
120+
assertEquals(0, hello.getFileData().length()); // Should be empty
118121

119122
// The local file header says the contents are 0 bytes, but the central header has the real length
120123
assertTrue(hello.hasDifferentValuesThanCentralDirectoryHeader());
@@ -128,11 +131,12 @@ public void postProcessLocalFileHeader(@Nonnull LocalFileHeader file) {
128131
});
129132
LocalFileHeader helloAdopted = zipStdAndAdopt.getLocalFileByName("Hello.class");
130133
assertFalse(helloAdopted.hasDifferentValuesThanCentralDirectoryHeader());
134+
assertNotEquals(0, helloAdopted.getFileData().length()); // Should have data
131135

132-
// Alternatively, just use the JVM strategy
136+
// The JVM strategy copies most properties, except for size.
133137
ZipArchive zipJvm = ZipIO.readJvm(path);
134138
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
136140
} catch (IOException ex) {
137141
fail(ex);
138142
}

0 commit comments

Comments
 (0)