@Test
  public void testGetMajorJavaVersion() {
    JavaPluginExtension extension = project.getExtensions().findByType(JavaPluginExtension.class);

    extension.setTargetCompatibility(JavaVersion.VERSION_1_3);
    assertThat(gradleProjectProperties.getMajorJavaVersion()).isEqualTo(3);

    extension.setTargetCompatibility(JavaVersion.VERSION_11);
    assertThat(gradleProjectProperties.getMajorJavaVersion()).isEqualTo(11);

    extension.setTargetCompatibility(JavaVersion.VERSION_1_9);
    assertThat(gradleProjectProperties.getMajorJavaVersion()).isEqualTo(9);
  }
Helper for reading back layers in a {@link BuildContext}.
jib-gradle-plugin/src/test/java/com/google/cloud/tools/jib/gradle/GradleProjectPropertiesTest.java