### Question:
FakeCloudMiddleware implements CloudMiddleware { @Override public void deleteVmImage(String id) { for (int i = 0; i < images.size(); ++i) { if (id.equals(images.get(i).getId())) { images.remove(i); return; } } } FakeCloudMiddleware(List<HostFake> hosts); @Override String deploy(Vm vm, String hostname); @Override String deployWithVolume(Vm vm, String hostname, String isoPath); @Override 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); void deleteAllVmImages(); HostFake getHost(String hostname); void addHost(HostFake host); @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 Host createHost(String hostname);  }### Answer:
@Test public void deleteVmImage() { String newImageId = fakeCloudMiddleware.createVmImage(new ImageToUpload("newImage", "fakeUrl")); fakeCloudMiddleware.deleteVmImage(newImageId); Assert.assertTrue(fakeCloudMiddleware.getVmImages().isEmpty()); }
@Test public void deleteVmImageDoesNothingAndRaisesNoExceptionsWhenInvalidId() { fakeCloudMiddleware.deleteVmImage("invalidId"); }