Repository: GoogleContainerTools/jib
File: jib-plugins-common/src/test/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessorTest.java (Java)

Code before:
        .comparingElementsUsing(EXTRACTION_PATH_OF)
        .containsExactly(
            "/target/dir/a",
            "/target/dir/a/b",
            "/target/dir/a/b/bar",
            "/target/dir/c",
            "/target/dir/c/cat",
            "/target/dir/foo");

    Optional<FileEntry> fooEntry =
        extraFiles.stream()
            .filter(
                layerEntry ->
                    layerEntry.getExtractionPath().equals(AbsoluteUnixPath.get("/target/dir/foo")))
            .findFirst();
    assertThat(fooEntry).isPresent();
    assertThat(fooEntry.get().getPermissions().toOctalString()).isEqualTo("123");
  }

  @Test
  public void testPluginConfigurationProcessor__errorOnExtraDirectoryPathNotFound() throws URISyntaxException, NumberFormatException {
    Path extraDirectory = Paths.get(Resources.getResource("core/layer").toURI()).resolve("xyz");
    Mockito.<List<?>>when(rawConfiguration.getExtraDirectories())
        .thenReturn(Arrays.asList(new TestExtraDirectoriesConfiguration(extraDirectory)));

    ExtraDirectoryNotFoundException exception = assertThrows(ExtraDirectoryNotFoundException.class, this::processCommonConfiguration);
    assertThat(exception).hasMessageThat().isEqualTo(extraDirectory.toString());
  }

  @Test
  public void testPluginConfigurationProcessor_cacheDirectorySystemProperties()
      throws InvalidContainerVolumeException, MainClassInferenceException, InvalidAppRootException,
          IOException, InvalidWorkingDirectoryException, InvalidPlatformException,
          InvalidImageReferenceException, IncompatibleBaseImageJavaVersionException,
          NumberFormatException, InvalidContainerizingModeException,
          InvalidFilesModificationTimeException, InvalidCreationTimeException, ExtraDirectoryNotFoundException {
    System.setProperty(PropertyNames.BASE_IMAGE_CACHE, "new/base/cache");
    System.setProperty(PropertyNames.APPLICATION_CACHE, "/new/application/cache");

    processCommonConfiguration();

    verify(containerizer).setBaseImageLayersCache(Paths.get("new/base/cache"));
    verify(containerizer).setApplicationLayersCache(Paths.get("/new/application/cache"));
  }

  @Test
  public void testAddJvmArgFilesLayer() throws IOException, InvalidAppRootException {
    String classpath = "/extra:/app/classes:/app/libs/dep.jar";
    String mainClass = "com.example.Main";
    PluginConfigurationProcessor.addJvmArgFilesLayer(
        rawConfiguration, projectProperties, jibContainerBuilder, classpath, mainClass);

Review comment (suggestion):
nit:
```suggestion
    Exception exception = assertThrows(ExtraDirectoryNotFoundException.class, this::processCommonConfiguration);
```

Code after:
    assertThat(extraFiles)
        .comparingElementsUsing(EXTRACTION_PATH_OF)
        .containsExactly(
            "/target/dir/a",
            "/target/dir/a/b",
            "/target/dir/a/b/bar",
            "/target/dir/c",
            "/target/dir/c/cat",
            "/target/dir/foo");

    Optional<FileEntry> fooEntry =
        extraFiles.stream()
            .filter(
                layerEntry ->
                    layerEntry.getExtractionPath().equals(AbsoluteUnixPath.get("/target/dir/foo")))
            .findFirst();
    assertThat(fooEntry).isPresent();
    assertThat(fooEntry.get().getPermissions().toOctalString()).isEqualTo("123");
  }

  @Test
  public void testPluginConfigurationProcessor__errorOnExtraDirectoryPathNotFound()
      throws URISyntaxException, NumberFormatException {
    Path extraDirectory = Paths.get(Resources.getResource("core/layer").toURI()).resolve("xyz");
    Mockito.<List<?>>when(rawConfiguration.getExtraDirectories())
        .thenReturn(Arrays.asList(new TestExtraDirectoriesConfiguration(extraDirectory)));

    Exception exception =
        assertThrows(ExtraDirectoryNotFoundException.class, this::processCommonConfiguration);
    assertThat(exception).hasMessageThat().isEqualTo(extraDirectory.toString());
  }

  @Test
  public void testPluginConfigurationProcessor_cacheDirectorySystemProperties()
      throws InvalidContainerVolumeException, MainClassInferenceException, InvalidAppRootException,
          IOException, InvalidWorkingDirectoryException, InvalidPlatformException,
          InvalidImageReferenceException, IncompatibleBaseImageJavaVersionException,
          NumberFormatException, InvalidContainerizingModeException,
          InvalidFilesModificationTimeException, InvalidCreationTimeException,
          ExtraDirectoryNotFoundException {
    System.setProperty(PropertyNames.BASE_IMAGE_CACHE, "new/base/cache");
    System.setProperty(PropertyNames.APPLICATION_CACHE, "/new/application/cache");

    processCommonConfiguration();

    verify(containerizer).setBaseImageLayersCache(Paths.get("new/base/cache"));
    verify(containerizer).setApplicationLayersCache(Paths.get("/new/application/cache"));
  }

  @Test
  public void testAddJvmArgFilesLayer() throws IOException, InvalidAppRootException {