### Question:
ConfigurationPropertyValidator { public static ImageReference getGeneratedTargetDockerTag( @Nullable String targetImage, ProjectProperties projectProperties, HelpfulSuggestions helpfulSuggestions) throws InvalidImageReferenceException { String generatedName = projectProperties.getName(); String generatedTag = projectProperties.getVersion().equals("unspecified") ? "latest" : projectProperties.getVersion(); if (Strings.isNullOrEmpty(targetImage)) { projectProperties.log( LogEvent.lifecycle(helpfulSuggestions.forGeneratedTag(generatedName, generatedTag))); ImageReference.parse(generatedName + ":" + generatedTag); return ImageReference.of(null, generatedName, generatedTag); } else { return ImageReference.parse(targetImage); } } private  ConfigurationPropertyValidator(); static Optional<Credential> getImageCredential(
      Consumer<LogEvent> logger,
      String usernameProperty,
      String passwordProperty,
      AuthProperty auth,
      RawConfiguration rawConfiguration); static ImageReference getGeneratedTargetDockerTag(
      @Nullable String targetImage,
      ProjectProperties projectProperties,
      HelpfulSuggestions helpfulSuggestions); static Map<String, String> parseMapProperty(String property); static List<String> parseListProperty(String property);  }### Answer:
@Test public void testGetGeneratedTargetDockerTag() throws InvalidImageReferenceException { HelpfulSuggestions helpfulSuggestions = new HelpfulSuggestions("", "", "to", "--to", "build.txt"); ProjectProperties mockProjectProperties = Mockito.mock(ProjectProperties.class); Mockito.when(mockProjectProperties.getName()).thenReturn("project-name"); Mockito.when(mockProjectProperties.getVersion()).thenReturn("project-version"); ImageReference result = ConfigurationPropertyValidator.getGeneratedTargetDockerTag( "a/b:c", mockProjectProperties, helpfulSuggestions); Assert.assertEquals("a/b", result.getRepository()); Assert.assertEquals("c", result.getTag().orElse(null)); Mockito.verify(mockLogger, Mockito.never()).accept(LogEvent.lifecycle(Mockito.any())); result = ConfigurationPropertyValidator.getGeneratedTargetDockerTag( null, mockProjectProperties, helpfulSuggestions); Assert.assertEquals("project-name", result.getRepository()); Assert.assertEquals("project-version", result.getTag().orElse(null)); Mockito.verify(mockProjectProperties) .log( LogEvent.lifecycle( "Tagging image with generated image reference project-name:project-version. If you'd " + "like to specify a different tag, you can set the to parameter in your " + "build.txt, or use the --to=<MY IMAGE> commandline flag.")); Mockito.when(mockProjectProperties.getName()).thenReturn("%#& Mockito.when(mockProjectProperties.getVersion()).thenReturn("%$# try { ConfigurationPropertyValidator.getGeneratedTargetDockerTag( null, mockProjectProperties, helpfulSuggestions); Assert.fail(); } catch (InvalidImageReferenceException ignored) { } }