RunConfigUtil { public static PodSpec getPodSpecFromRunConfig(RunConfig generatorRunConfig) { PodSpecBuilder podSpecBuilder = new PodSpecBuilder(); if (generatorRunConfig.getRestartPolicy() != null) { podSpecBuilder.withRestartPolicy(generatorRunConfig.getRestartPolicy()); } else { podSpecBuilder.withRestartPolicy(DEFAULT_RESTART_POLICY); } if (generatorRunConfig.getServiceAccount() != null) { podSpecBuilder.withServiceAccountName(generatorRunConfig.getServiceAccount()); } podSpecBuilder.addToContainers(containerFromConfig(generatorRunConfig)); return podSpecBuilder.build(); } private  RunConfigUtil(); static ObjectMeta getObjectMetadataFromRunConfig(RunConfig generatorRunConfig); static PodSpec getPodSpecFromRunConfig(RunConfig generatorRunConfig);  }
@Test void testGetPodSpecFromRunConfig() { RunConfig config = new RunConfigBuilder() .withName("test") .withImage("test:latest") .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) .withImagePullPolicy("IfNotPresent") .withLimits(getLimits()) .build(); PodSpec podSpec = RunConfigUtil.getPodSpecFromRunConfig(config); assertNotNull(podSpec); assertNotNull(podSpec.getContainers()); assertEquals(1, podSpec.getContainers().size()); assertEquals("test", podSpec.getContainers().get(0).getName()); assertEquals("IfNotPresent", podSpec.getContainers().get(0).getImagePullPolicy()); assertEquals("test:latest", podSpec.getContainers().get(0).getImage()); assertEquals(1, podSpec.getContainers().get(0).getEnv().size()); assertEquals("TEST_KEY", podSpec.getContainers().get(0).getEnv().get(0).getName()); assertEquals("TEST_VALUE", podSpec.getContainers().get(0).getEnv().get(0).getValue()); }