public void testDoNothingIfAlreadyTakenSnapshot() throws Exception {
String snapshotName = "snap";
String snapshotDesc = "snapDesc";
VirtualBoxManager manager = createNiceMock(VirtualBoxManager.class);
IMachine machine = createMock(IMachine.class);
IVirtualBox vBox = createMock(IVirtualBox.class);
ISession session = createMock(ISession.class);
IConsole console = createNiceMock(IConsole.class);
IProgress progress = createNiceMock(IProgress.class);
expect(progress.getCompleted()).andReturn(true);
expect(machine.getCurrentSnapshot()).andReturn(null).anyTimes();
expect(manager.openMachineSession(machine)).andReturn(session);
expect(machine.getState()).andReturn(MachineState.PoweredOff).anyTimes();
expect(machine.getName()).andReturn("machine").anyTimes();
expect(session.getConsole()).andReturn(console);
expect(console.takeSnapshot(snapshotName, snapshotDesc)).andReturn(
progress);
session.unlockMachine();