@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());
        });
    }
@author Nico Bergemann <barracuda415 at yahoo.de>
disunity-core/src/test/java/info/ata4/test/junity/BundleTest.java