use of info.ata4.junity.bundle.BundleHeader in project disunity by ata4.
the class BundleTest method headerValid.
@Test
public void headerValid() throws IOException {
BundleHeader header = bundle.header();
long fileSize = Files.size(file);
assertTrue("Number of levels to download must be equal to number of levels or 1", header.numberOfLevelsToDownload() == header.numberOfLevels() || header.numberOfLevelsToDownload() == 1);
assertTrue("Signatures should be valid", header.hasValidSignature());
assertTrue("Minimum streamed bytes must be smaller than or equal to file size", header.minimumStreamedBytes() <= fileSize);
assertTrue("Header size must be smaller than file size", header.headerSize() < fileSize);
if (header.streamVersion() >= 2) {
assertEquals("Header file size and actual file size must be equal", header.completeFileSize(), fileSize);
}
assertEquals("Number of levels must match number of level end offsets", header.numberOfLevelsToDownload(), header.levelByteEnd().size());
header.levelByteEnd().forEach(lbe -> {
assertTrue("Compressed offset must be smaller or equal to uncompressed offset", lbe.getLeft() <= lbe.getRight());
});
}
Aggregations