@Test
  public void testGetMajorJavaVersion_targetProperty() {
    when(mockMavenProperties.getProperty("maven.compiler.target")).thenReturn("1.8");
    assertThat(mavenProjectProperties.getMajorJavaVersion()).isEqualTo(8);

    when(mockMavenProperties.getProperty("maven.compiler.target")).thenReturn("1.7");
    assertThat(mavenProjectProperties.getMajorJavaVersion()).isEqualTo(7);

    when(mockMavenProperties.getProperty("maven.compiler.target")).thenReturn("11");
    assertThat(mavenProjectProperties.getMajorJavaVersion()).isEqualTo(11);
  }
Helper for reading back layers in a {@link BuildContext}.
jib-maven-plugin/src/test/java/com/google/cloud/tools/jib/maven/MavenProjectPropertiesTest.java