### Question:
GradleProjectProperties implements ProjectProperties { @Nullable @Override public String getMainClassFromJarPlugin() { Jar jarTask = (Jar) project.getTasks().findByName("jar"); if (jarTask == null) { return null; } return (String) jarTask.getManifest().getAttributes().get("Main-Class"); } @VisibleForTesting  GradleProjectProperties(
      Project project,
      Logger logger,
      TempDirectoryProvider tempDirectoryProvider,
      Supplier<List<JibGradlePluginExtension<?>>> extensionLoader); static GradleProjectProperties getForProject(
      Project project, Logger logger, TempDirectoryProvider tempDirectoryProvider); @Override JibContainerBuilder createJibContainerBuilder(
      JavaContainerBuilder javaContainerBuilder, ContainerizingMode containerizingMode); @Override List<Path> getClassFiles(); @Override void waitForLoggingThread(); @Override void configureEventHandlers(Containerizer containerizer); @Override void log(LogEvent logEvent); @Override String getToolName(); @Override String getToolVersion(); @Override String getPluginName(); @Nullable @Override String getMainClassFromJarPlugin(); @Override Path getDefaultCacheDirectory(); @Override String getJarPluginName(); @Override boolean isWarProject(); @Override String getName(); @Override String getVersion(); @Override int getMajorJavaVersion(); @Override boolean isOffline(); @Override JibContainerBuilder runPluginExtensions(
      List<? extends ExtensionConfiguration> extensionConfigs,
      JibContainerBuilder jibContainerBuilder);  }### Answer:
@Test public void testGetMainClassFromJar_success() { DefaultManifest manifest = new DefaultManifest(mockFileResolver); manifest.attributes(ImmutableMap.of("Main-Class", "some.main.class")); Jar mockJar = Mockito.mock(Jar.class); Mockito.when(mockJar.getManifest()).thenReturn(manifest); Mockito.when(mockTaskContainer.findByName("jar")).thenReturn(mockJar); Assert.assertEquals("some.main.class", gradleProjectProperties.getMainClassFromJarPlugin()); }
@Test public void testGetMainClassFromJar_missing() { Mockito.when(mockTaskContainer.findByName("jar")).thenReturn(null); Assert.assertNull(gradleProjectProperties.getMainClassFromJarPlugin()); }