public void registerJarResources(List<ResourceUri> resourceUris) throws IOException {
        registerResources(
                prepareStagingResources(
                        resourceUris,
                        ResourceType.JAR,
                        true,
                        url -> {
                            try {
                                JarUtils.checkJarFile(url);
                            } catch (IOException e) {
                                throw new ValidationException(
                                        String.format("Failed to register jar resource [%s]", url),
                                        e);
                            }
                        },
                        false),
                true);
    }
@Test
    public void testRegisterInvalidJarResource() throws Exception {
        final String fileUri = file.getPath();

        CommonTestUtils.assertThrows(
                String.format(
                        "Expect the resource type to be jar, but encounter a resource [%s] with type %s.",
                        fileUri, ResourceType.FILE.name().toLowerCase()),
                ValidationException.class,
                () -> {
                    resourceManager.registerJarResources(
                            Collections.singletonList(new ResourceUri(ResourceType.FILE, fileUri)));
                    return null;
                });

        // test register jar resource with invalid suffix
        CommonTestUtils.assertThrows(
                String.format(
                        "The registering or unregistering jar resource [%s] must ends with '.jar' suffix.",
                        fileUri),
                ValidationException.class,
                () -> {
                    resourceManager.registerJarResources(
                            Collections.singletonList(new ResourceUri(ResourceType.JAR, fileUri)));
                    return null;
                });

        // test register directory for jar resource
        final String jarDir = tempFolder.getPath();

        CommonTestUtils.assertThrows(
                String.format(
                        "The registering or unregistering jar resource [%s] is a directory that is not allowed.",
                        jarDir),
                ValidationException.class,
                () -> {
                    resourceManager.registerJarResources(
                            Collections.singletonList(new ResourceUri(ResourceType.JAR, jarDir)));
                    return null;
                });

        // test register directory for jar resource
        String jarPath =
                Files.createDirectory(Paths.get(tempFolder.getPath(), "test-jar.jar")).toString();

        CommonTestUtils.assertThrows(
                String.format(
                        "The registering or unregistering jar resource [%s] is a directory that is not allowed.",
                        jarPath),
                ValidationException.class,
                () -> {
                    resourceManager.registerJarResources(
                            Collections.singletonList(new ResourceUri(ResourceType.JAR, jarPath)));
                    return null;
                });
    }