@VisibleForTesting
    static int checkJar(Path file) throws Exception {
        final URI uri = file.toUri();

        int numSevereIssues = 0;
        try (final FileSystem fileSystem =
                FileSystems.newFileSystem(
                        new URI("jar:file", uri.getHost(), uri.getPath(), uri.getFragment()),
                        Collections.emptyMap())) {
            if (isTestJarAndEmpty(file, fileSystem.getPath("/"))) {
                return 0;
            }
            if (!noticeFileExistsAndIsValid(fileSystem.getPath("META-INF", "NOTICE"), file)) {
                numSevereIssues++;
            }
            if (!licenseFileExistsAndIsValid(fileSystem.getPath("META-INF", "LICENSE"), file)) {
                numSevereIssues++;
            }

            numSevereIssues +=
                    getNumLicenseFilesOutsideMetaInfDirectory(file, fileSystem.getPath("/"));

            numSevereIssues += getFilesWithIncompatibleLicenses(file, fileSystem.getPath("/"));
        }
        return numSevereIssues;
    }
@Test
    void testRejectedOnInvalidLicenseFile(@TempDir Path tempDir) throws Exception {
        assertThat(
                        JarFileChecker.checkJar(
                                createJar(
                                        tempDir,
                                        Entry.fileEntry(VALID_NOTICE_CONTENTS, VALID_NOTICE_PATH),
                                        Entry.fileEntry(
                                                INVALID_LICENSE_CONTENTS, VALID_LICENSE_PATH))))
                .isEqualTo(1);
    }