Repository: GoogleContainerTools/jib
File: jib-cli/src/test/java/com/google/cloud/tools/jib/cli/jar/JarProcessorsTest.java (Java)

Code before:
        JarProcessors.from(jarPath, mockTemporaryDirectoryProvider, ProcessingMode.packaged);
    Mockito.verifyNoInteractions(mockTemporaryDirectoryProvider);
    assertThat(processor).isInstanceOf(SpringBootPackagedProcessor.class);
  }

  @Test
  public void testFrom_springBootExploded() throws IOException, URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(SPRING_BOOT).toURI());
    JarProcessor processor =
        JarProcessors.from(jarPath, mockTemporaryDirectoryProvider, ProcessingMode.exploded);
    Mockito.verify(mockTemporaryDirectoryProvider).newDirectory();
    assertThat(processor).isInstanceOf(SpringBootExplodedProcessor.class);
  }

  @Test
  public void testFrom_incompatibleBaseImage() throws URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(JAVA_14_JAR).toURI());
    IllegalStateException exception =
        assertThrows(
            IllegalStateException.class,
            () ->
                JarProcessors.from(
                    jarPath, mockTemporaryDirectoryProvider, ProcessingMode.exploded));
    assertThat(exception)
        .hasMessageThat()
        .startsWith("The input JAR (" + jarPath + ") is compiled with Java " + 14);
  }

  @Test
  public void testGetVersion_versionNotFound() throws URISyntaxException, IOException {
    Path jarPath = Paths.get(Resources.getResource(STANDARD).toURI());
    Integer version = JarProcessors.getJavaMajorVersion(jarPath);
    assertThat(version).isEqualTo(JarProcessors.VERSION_NOT_FOUND);
  }
}


Review comment (suggestion):
```suggestion
        .startsWith("The input JAR (" + jarPath + ") is compiled with Java 14");
```

Code after:
        JarProcessors.from(jarPath, mockTemporaryDirectoryProvider, ProcessingMode.packaged);
    Mockito.verifyNoInteractions(mockTemporaryDirectoryProvider);
    assertThat(processor).isInstanceOf(SpringBootPackagedProcessor.class);
  }

  @Test
  public void testFrom_springBootExploded() throws IOException, URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(SPRING_BOOT).toURI());
    JarProcessor processor =
        JarProcessors.from(jarPath, mockTemporaryDirectoryProvider, ProcessingMode.exploded);
    Mockito.verify(mockTemporaryDirectoryProvider).newDirectory();
    assertThat(processor).isInstanceOf(SpringBootExplodedProcessor.class);
  }

  @Test
  public void testFrom_incompatibleBaseImage() throws URISyntaxException {
    Path jarPath = Paths.get(Resources.getResource(JAVA_14_JAR).toURI());
    IllegalStateException exception =
        assertThrows(
            IllegalStateException.class,
            () ->
                JarProcessors.from(
                    jarPath, mockTemporaryDirectoryProvider, ProcessingMode.exploded));
    assertThat(exception)
        .hasMessageThat()
        .startsWith("The input JAR (" + jarPath + ") is compiled with Java 14");
  }

  @Test
  public void testGetMajorJavaVersion_versionNotFound() throws URISyntaxException, IOException {
    Path jarPath = Paths.get(Resources.getResource(STANDARD).toURI());
    Integer version = JarProcessors.getJavaMajorVersion(jarPath);
    assertThat(version).isEqualTo(0);
  }
}