### Question:
OpenStackJclouds implements CloudMiddleware { @Override public ImageUploaded getVmImage(String imageId) { Image image = openStackJcloudsApis.getImageApi().get(imageId); return image != null ? new ImageUploaded(image.getId(), image.getName(), image.getStatus().toString()) : null; } OpenStackJclouds();  OpenStackJclouds(String[] hosts, String[] securityGroups); @Override // This function is blocking. The thread execution blocks until the VM is deployed. // I would prefer to see this blocking in the VmManager class. I need to block the execution because // I need to return the ID of the deployed VM to the Application Manager. String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override // This function is also blocking. The reason is the same as in the deploy function. void destroy(String vmId); @Override void migrate(String vmId, String destinationNodeHostName); @Override List<String> getAllVMsIds(); @Override List<String> getScheduledNonDeployedVmsIds(); @Override VmDeployed getVM(String vmId); @Override boolean existsVm(String vmId); @Override void rebootHardVm(String vmId); @Override void rebootSoftVm(String vmId); @Override void startVm(String vmId); @Override void stopVm(String vmId); @Override void suspendVm(String vmId); @Override void resumeVm(String vmId); @Override List<ImageUploaded> getVmImages(); @Override String createVmImage(ImageToUpload imageToUpload); @Override ImageUploaded getVmImage(String imageId); @Override void deleteVmImage(String id); @Override void assignFloatingIp(String vmId); String getZone(); NovaApi getNovaApi(); @Override Map<String, String> getFlavours(); @Override void resize(String vmId, VmRequirements vm); @Override void confirmResize(String vmId); @Override Map<String, HardwareInfo> getHypervisors(String region); @Override es.bsc.demiurge.core.monitoring.hosts.Host createHost(String hostname); static final String[] DEFAULT_FLAVORS; static final String OS_CONFIG_IP; static final String OS_CONFIG_KEYSTONE_PORT; static final String OS_CONFIG_GLANCE_PORT; static final String OS_CONFIG_KEYSTONE_USER; static final String OS_CONFIG_KEYSTONE_TENANT; static final String OS_CONFIG_KEYSTONE_TENANT_ID; static final String OS_CONFIG_KEYSTONE_PASSWORD; static final String OS_CONFIG_SECURITY_GROUPS; static final String CONFIG_HOSTS; }### Answer:
@Test public void getNonExistingImageReturnsNull() { assertNull(openStackJclouds.getVmImage("fakeImage")); }