### Question:
MavenProjectProperties implements ProjectProperties { @VisibleForTesting static Optional<String> getChildValue(@Nullable Xpp3Dom dom, String... childNodePath) { if (dom == null) { return Optional.empty(); } Xpp3Dom node = dom; for (String child : childNodePath) { node = node.getChild(child); if (node == null) { return Optional.empty(); } } return Optional.ofNullable(node.getValue()); } @VisibleForTesting  MavenProjectProperties(
      PluginDescriptor jibPluginDescriptor,
      MavenProject project,
      MavenSession session,
      Log log,
      TempDirectoryProvider tempDirectoryProvider,
      Supplier<List<JibMavenPluginExtension<?>>> extensionLoader); static MavenProjectProperties getForProject(
      PluginDescriptor jibPluginDescriptor,
      MavenProject project,
      MavenSession session,
      Log log,
      TempDirectoryProvider tempDirectoryProvider); @Nullable static String getProperty(
      String propertyName, @Nullable MavenProject project, @Nullable MavenSession session); @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); static final String PLUGIN_NAME; static final String PLUGIN_KEY; }### Answer:
@Test public void testGetChildValue_null() { Assert.assertFalse(MavenProjectProperties.getChildValue(null).isPresent()); Assert.assertFalse(MavenProjectProperties.getChildValue(null, "foo", "bar").isPresent()); }
@Test public void testGetChildValue_noPathGiven() { Xpp3Dom root = newXpp3Dom("root", "value"); Assert.assertEquals(Optional.of("value"), MavenProjectProperties.getChildValue(root)); }
@Test public void testGetChildValue_noChild() { Xpp3Dom root = newXpp3Dom("root", "value"); Assert.assertFalse(MavenProjectProperties.getChildValue(root, "foo").isPresent()); Assert.assertFalse(MavenProjectProperties.getChildValue(root, "foo", "bar").isPresent()); }
@Test public void testGetChildValue_childPathMatched() { Xpp3Dom root = newXpp3Dom("root", "value"); Xpp3Dom foo = addXpp3DomChild(root, "foo", "foo"); addXpp3DomChild(foo, "bar", "bar"); Assert.assertEquals(Optional.of("foo"), MavenProjectProperties.getChildValue(root, "foo")); Assert.assertEquals( Optional.of("bar"), MavenProjectProperties.getChildValue(root, "foo", "bar")); Assert.assertEquals(Optional.of("bar"), MavenProjectProperties.getChildValue(foo, "bar")); }
@Test public void testGetChildValue_notFullyMatched() { Xpp3Dom root = newXpp3Dom("root", "value"); Xpp3Dom foo = addXpp3DomChild(root, "foo", "foo"); addXpp3DomChild(foo, "bar", "bar"); Assert.assertFalse(MavenProjectProperties.getChildValue(root, "baz").isPresent()); Assert.assertFalse(MavenProjectProperties.getChildValue(root, "foo", "baz").isPresent()); }
@Test public void testGetChildValue_nullValue() { Xpp3Dom root = new Xpp3Dom("root"); addXpp3DomChild(root, "foo", null); Assert.assertFalse(MavenProjectProperties.getChildValue(root).isPresent()); Assert.assertFalse(MavenProjectProperties.getChildValue(root, "foo").isPresent()); }