@Test
  public void testIllegalImageReturnedByQuery() throws Exception {
    existingVm.getDiskMap().put(existingDiskImage.getId(), existingDiskImage);
    existingVm.getImages().add(existingDiskImage);
    snapshotVmConfigurationHelper.markImagesIllegalIfNotInDb(existingVm, existingSnapshotId);

    for (Disk diskImage : existingVm.getDiskMap().values()) {
      assertEquals(ImageStatus.ILLEGAL, ((DiskImage) diskImage).getImageStatus());
    }
  }
 @Before
 public void setUp() throws Exception {
   existingSnapshot = createSnapshot(existingSnapshotId);
   existingVm = createVm(existingVmId);
   existingSnapshot.setVmConfiguration(EXISTING_VM_NAME); // Dummy configuration
   existingDiskImage = createDiskImage(existingImageId, existingImageGroupId);
   snapshotVmConfigurationHelper = spy(new SnapshotVmConfigurationHelper());
   snapshotsManager = mock(SnapshotsManager.class);
   when(snapshotVmConfigurationHelper.getSnapshotManager()).thenReturn(snapshotsManager);
   setUpDaoMocks();
 }