/**
   * Runs the console installer twice, verifying that a second uninstall key is created.
   *
   * @throws Exception for any error
   */
  @Test
  @InstallFile("samples/windows/install.xml")
  public void testMultipleInstallation() throws Exception {
    Assume.assumeTrue(
        "This test must be run as administrator, or with Windows UAC turned off",
        !skipTests && isAdminUser);

    // run the install
    checkInstall(container, APP_NAME);

    // remove the lock file to enable second installation
    removeLock();

    // run the installation again
    ConsoleInstallerContainer container2 = new TestConsoleInstallerContainer();
    TestConsoleInstaller installer2 = container2.getComponent(TestConsoleInstaller.class);
    InstallData installData2 = container2.getComponent(InstallData.class);

    // copied from super.setUp()
    // write to temporary folder so the test doesn't need to be run with elevated permissions
    File installPath = new File(temporaryFolder.getRoot(), "izpackTest");
    installData2.setInstallPath(installPath.getAbsolutePath());
    installData2.setDefaultInstallPath(installPath.getAbsolutePath());

    TestConsole console2 = installer2.getConsole();
    console2.addScript("CheckedHelloPanel", "y", "1");
    console2.addScript("TargetPanel", "\n", "y", "1");
    console2.addScript("PacksPanel", "1");

    assertFalse(registryKeyExists(handler, UNINSTALL_KEY2));
    checkInstall(installer2, installData2);

    // verify the UNINSTALL_NAME has been updated
    assertEquals(APP_NAME + "(1)", installData2.getVariable("UNINSTALL_NAME"));

    // verify a second key is created
    assertTrue(registryKeyExists(handler, UNINSTALL_KEY2));
  }