public void testConvert() throws Exception {
VirtualBoxManager vbm = createNiceMock(VirtualBoxManager.class);
IStorageController iStorageController = createNiceMock(IStorageController.class);
IMediumAttachment iMediumAttachment = createNiceMock(IMediumAttachment.class);
IMedium hd = createNiceMock(IMedium.class);
IMedium dvd = createNiceMock(IMedium.class);
IMachine vm = createNiceMock(IMachine.class);
expect(vm.getStorageControllers()).andReturn(Lists.newArrayList(iStorageController)).anyTimes();
expect(iStorageController.getName()).andReturn(CONTROLLER_NAME).anyTimes();
expect(iStorageController.getBus()).andReturn(CONTROLLER_BUS).anyTimes();
expect(vm.getMediumAttachmentsOfController(CONTROLLER_NAME)).andReturn(Lists.newArrayList(iMediumAttachment)).anyTimes();
expect(iMediumAttachment.getPort()).andReturn(0).once();
expect(iMediumAttachment.getDevice()).andReturn(0).once();
expect(iMediumAttachment.getMedium()).andReturn(hd);
expect(hd.getDeviceType()).andReturn(DeviceType.HardDisk).once();
expect(hd.getLocation()).andReturn(PATH_TO_HD).once();
expect(iMediumAttachment.getMedium()).andReturn(dvd);
expect(dvd.getDeviceType()).andReturn(DeviceType.DVD).once();
expect(dvd.getLocation()).andReturn(PATH_TO_DVD).once();
expect(vm.getName()).andReturn(VM_NAME).anyTimes();
expect(vm.getId()).andReturn(VM_ID).anyTimes();
expect(vm.getOSTypeId()).andReturn(OS_TYPE_ID).anyTimes();
expect(vm.getMemorySize()).andReturn(MEMORY_SIZE).anyTimes();