Source:
public void shouldInitializeContainerInfoFromRemoteDockerImageWithVolumes() throws IOException { when(dockerConnection.hasImage("openshift3/jenkins-1-rhel7", "latest")).thenReturn(false); final IImageStreamImportCapability cap = Mockito.mock(IImageStreamImportCapability.class); when(project.supports(IImageStreamImportCapability.class)).thenReturn(true); when(project.getCapability(IImageStreamImportCapability.class)).thenReturn(cap); final IStatus status = Mockito.mock(IStatus.class); final IImageStreamImport streamImport = Mockito.mock(IImageStreamImport.class); final DockerImageURI dockerImageURI = new DockerImageURI("openshift3/jenkins-1-rhel7:latest"); when(status.isSuccess()).thenReturn(true); when(cap.importImageMetadata(dockerImageURI)).thenReturn(streamImport); when(streamImport.getImageJsonFor(dockerImageURI.getTag())) .thenReturn(getImageStreamImport("/resources/openshift3_jenkins_1_rhel7_ImageStreamImport.json")); when(streamImport.getImageStatus()).thenReturn(Arrays.asList(status)); model.setImageName("openshift3/jenkins-1-rhel7:latest"); final boolean result = model.initializeContainerInfo(); assertThat(result).isTrue(); assertThat(model.getEnvironmentVariables()).contains( new EnvironmentVariable("PATH", "/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin"), new EnvironmentVariable("JENKINS_VERSION", "1.642"), new EnvironmentVariable("HOME", "/var/lib/jenkins"), new EnvironmentVariable("JENKINS_HOME", "/var/lib/jenkins")); assertThat(model.getPortSpecs()).contains( new PortSpecAdapter("50000-tcp", "TCP", 50000), new PortSpecAdapter("8080-tcp", "TCP", 8080)); assertThat(model.getVolumes()).contains("/var/lib/jenkins"); }

Target:
public void shouldInitializeContainerInfoFromRemoteDockerImageWithVolumes() throws IOException { when(dockerConnection.hasImage(JENKINS_IMAGE, LATEST_TAG)).thenReturn(false); final IImageStreamImportCapability cap = Mockito.mock(IImageStreamImportCapability.class); when(project.supports(IImageStreamImportCapability.class)).thenReturn(true); when(project.getCapability(IImageStreamImportCapability.class)).thenReturn(cap); final IStatus status = Mockito.mock(IStatus.class); final IImageStreamImport streamImport = Mockito.mock(IImageStreamImport.class); final DockerImageURI dockerImageURI = new DockerImageURI(JENKINS_IMAGE_URI); when(status.isSuccess()).thenReturn(true); when(cap.importImageMetadata(dockerImageURI)).thenReturn(streamImport); when(streamImport.getImageJsonFor(dockerImageURI.getTag())) .thenReturn(getImageStreamImport("/resources/openshift3_jenkins_1_rhel7_ImageStreamImport.json")); when(streamImport.getImageStatus()).thenReturn(Arrays.asList(status)); model.setImageName(JENKINS_IMAGE_URI); final boolean result = model.initializeContainerInfo(); assertThat(result).isTrue(); assertThat(model.getEnvironmentVariables()).contains( new EnvironmentVariable("PATH", "/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin"), new EnvironmentVariable("JENKINS_VERSION", "1.642"), new EnvironmentVariable("HOME", "/var/lib/jenkins"), new EnvironmentVariable("JENKINS_HOME", "/var/lib/jenkins")); assertThat(model.getPortSpecs()).contains( new PortSpecAdapter("50000-tcp", "TCP", 50000), new PortSpecAdapter("8080-tcp", "TCP", 8080)); assertThat(model.getVolumes()).contains("/var/lib/jenkins"); }