@Override
  public List<FileEntriesLayer> createLayers() throws IOException {
    // Clear the exploded-artifact root first
    if (Files.exists(targetExplodedJarRoot)) {
      MoreFiles.deleteRecursively(targetExplodedJarRoot, RecursiveDeleteOption.ALLOW_INSECURE);
    }

    // Add dependencies layers.
    List<FileEntriesLayer> layers =
        JarLayers.getDependenciesLayers(jarPath, ProcessingMode.exploded);

    // Determine class and resource files in the directory containing jar contents and create
    // FileEntriesLayer for each type of layer (classes or resources).
    ZipUtil.unzip(jarPath, targetExplodedJarRoot, true);
    Predicate<Path> isClassFile = path -> path.getFileName().toString().endsWith(".class");
    Predicate<Path> isResourceFile = isClassFile.negate().and(Files::isRegularFile);
    FileEntriesLayer classesLayer =
        ArtifactLayers.getDirectoryContentsAsLayer(
            ArtifactLayers.CLASSES,
            targetExplodedJarRoot,
            isClassFile,
            JarLayers.APP_ROOT.resolve("explodedJar"));
    FileEntriesLayer resourcesLayer =
        ArtifactLayers.getDirectoryContentsAsLayer(
            ArtifactLayers.RESOURCES,
            targetExplodedJarRoot,
            isResourceFile,
            JarLayers.APP_ROOT.resolve("explodedJar"));

    if (!resourcesLayer.getEntries().isEmpty()) {
      layers.add(resourcesLayer);
    }
    if (!classesLayer.getEntries().isEmpty()) {
      layers.add(classesLayer);
    }
    return layers;
  }
@Test
  public void testCreateLayers_emptyJar() throws IOException, URISyntaxException {
    Path standardJar = Paths.get(Resources.getResource(STANDARD_JAR_EMPTY).toURI());
    Path destDir = temporaryFolder.newFolder().toPath();
    StandardExplodedProcessor standardExplodedModeProcessor =
        new StandardExplodedProcessor(standardJar, destDir, JAR_JAVA_VERSION);

    List<FileEntriesLayer> layers = standardExplodedModeProcessor.createLayers();

    assertThat(layers.size()).isEqualTo(1);

    FileEntriesLayer resourcesLayer = layers.get(0);

    assertThat(resourcesLayer.getEntries().size()).isEqualTo(1);
    assertThat(resourcesLayer.getEntries().get(0).getExtractionPath())
        .isEqualTo(AbsoluteUnixPath.get("/app/explodedJar/META-INF/MANIFEST.MF"));
  }