### Question:
KubernetesResourceUtil { public static String extractContainerName(GroupArtifactVersion groupArtifactVersion, ImageConfiguration imageConfig) { String alias = imageConfig.getAlias(); return alias != null ? alias : extractImageUser(imageConfig.getName(), groupArtifactVersion.getGroupId()) + "-" + groupArtifactVersion.getArtifactId(); }  static KubernetesListBuilder readResourceFragmentsFrom(PlatformMode platformMode, ResourceVersioning apiVersions,
                                                                  String defaultName,
                                                                  File[] resourceFiles); static HasMetadata getResource(PlatformMode platformMode, ResourceVersioning apiVersions,
                                          File file, String appName); static File[] listResourceFragments(File localResourceDir, List<String> remotes, KitLogger log); static File[] listResourceFragments(File resourceDir); static File[] listRemoteResourceFragments(List<String> remotes, KitLogger log); final static void updateKindFilenameMapper(final Map<String, List<String>> mappings); static void removeItemFromKubernetesBuilder(KubernetesListBuilder builder, HasMetadata item); static String getNameWithSuffix(String name, String kind); static String extractContainerName(GroupArtifactVersion groupArtifactVersion, ImageConfiguration imageConfig); static Map<String, String> removeVersionSelector(Map<String, String> selector); static boolean checkForKind(KubernetesListBuilder builder, String... kinds); static boolean addPort(List<ContainerPort> ports, String portNumberText, String portName, KitLogger log); static boolean setEnvVar(List<EnvVar> envVarList, String name, String value); static String getEnvVar(List<EnvVar> envVarList, String name, String defaultValue); static boolean removeEnvVar(List<EnvVar> envVarList, String name); static List<EnvVar> convertToEnvVarList(Map<String, String> envVars); static void validateKubernetesMasterUrl(URL masterUrl); static void handleKubernetesClientException(KubernetesClientException e, KitLogger logger); static String getBuildStatusPhase(Build build); static String getBuildStatusReason(Build build); static Pod getNewestPod(Collection<Pod> pods); static Date getCreationTimestamp(HasMetadata hasMetadata); static Date parseDate(String text); static boolean podHasContainerImage(Pod pod, String imageName); static String getDockerContainerID(Pod pod); static boolean isNewerResource(HasMetadata newer, HasMetadata older); static void mergeSimpleFields(Object targetValues, Object defaultValues); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName); static String mergePodSpec(PodSpecBuilder builder, PodSpec defaultPodSpec, String defaultName, boolean sidecarEnabled); static String getSourceUrlAnnotation(HasMetadata item); static void setSourceUrlAnnotationIfNotSet(HasMetadata item, String sourceUrl); static boolean isAppCatalogResource(HasMetadata templateOrConfigMap); static Set<HasMetadata> loadResources(File manifest); static LabelSelector getPodLabelSelector(Set<HasMetadata> entities); static LabelSelector getPodLabelSelector(HasMetadata entity); static HasMetadata mergeResources(HasMetadata item1, HasMetadata item2, KitLogger log, boolean switchOnLocalCustomisation); static final String API_VERSION; static final String API_EXTENSIONS_VERSION; static final String API_APPS_VERSION; static final String JOB_VERSION; static final String OPENSHIFT_V1_VERSION; static final ResourceVersioning DEFAULT_RESOURCE_VERSIONING; static final HashSet<Class<?>> SIMPLE_FIELD_TYPES; static final String CONTAINER_NAME_REGEX; }### Answer:
@Test public void containerName() { ImageConfiguration imageConfiguration = new ImageConfiguration.Builder() .name("dummy-image") .registry("example.com/someregistry") .name("test") .build(); String containerName = KubernetesResourceUtil.extractContainerName(new GroupArtifactVersion("io.fabric8-test-", "fabric8-maven-plugin-dummy", "0"), imageConfiguration); assertTrue(containerName.matches(KubernetesResourceUtil.CONTAINER_NAME_REGEX)); }