// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Evaluator.java
// public interface Evaluator {
// 
//   /**
//    * @return true if the environment adheres to this test.
//    */
//   public boolean evaluate();
// 
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/RepairAction.java
// public interface RepairAction extends Runnable {
// 
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/MechanicPreferences.java
// @SuppressWarnings("deprecation") // Uses the old-style API.
// public class MechanicPreferences implements IMechanicPreferences {
// 
//   public void addListener(IPropertyChangeListener listener) {
//     OldMechanicPreferences.addListener(listener);
//   }
// 
//   public void removeListener(IPropertyChangeListener listener) {
//     OldMechanicPreferences.removeListener(listener);
//   }
// 
//   public List<IResourceTaskProvider> getTaskProviders() {
//     return OldMechanicPreferences.getTaskProviders();
//   }
// 
//   public int getThreadSleepSeconds() {
//     return OldMechanicPreferences.getThreadSleepSeconds();
//   }
// 
//   public int cleanSleepSeconds(int seconds) {
//     return OldMechanicPreferences.cleanSleepSeconds(seconds);
//   }
// 
//   public Set<String> getBlockedTaskIds() {
//     return OldMechanicPreferences.getBlockedTaskIds();
//   }
// 
//   public void setBlockedTaskIds(Set<String> ids) {
//     OldMechanicPreferences.setBlockedTaskIds(ids);
//   }
// 
//   public void blockItem(Task item) {
//     OldMechanicPreferences.blockItem(item);
//   }
// 
//   public String getHelpUrl() {
//     return OldMechanicPreferences.getHelpUrl();
//   }
// 
//   public boolean contains(String key) {
//     return OldMechanicPreferences.contains(key);
//   }
// 
//   public int getInt(String key) {
//     return OldMechanicPreferences.getInt(key);
//   }
// 
//   public long getLong(String key) {
//     return OldMechanicPreferences.getLong(key);
//   }
// 
//   public void setLong(String key, long value) {
//     OldMechanicPreferences.setLong(key, value);
//   }
// 
//   public String getString(String key) {
//     return OldMechanicPreferences.getString(key);
//   }
// 
//   public void setString(String key, String value) {
//     OldMechanicPreferences.setString(key, value);
//   }
// 
//   public boolean isShowPopup() {
//     return OldMechanicPreferences.isShowPopup();
//   }
// 
//   public void doNotShowPopup() {
//     OldMechanicPreferences.doNotShowPopup();
//   }
// 
//   public void showPopup() {
//     OldMechanicPreferences.showPopup();
//   }
// 
//   public IStatus validatePreferencesFile(IPath path) {
//     return OldMechanicPreferences.validatePreferencesFile(path);
//   }
// }


import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
import com.google.eclipse.mechanic.Evaluator;
import com.google.eclipse.mechanic.RepairAction;
import com.google.eclipse.mechanic.Task;
import com.google.eclipse.mechanic.internal.MechanicPreferences;
import com.google.eclipse.mechanic.tests.internal.RunAsPluginTest;
    mechanicPreferences.setLong(pref, 1);
    assertEquals(1, mechanicPreferences.getLong(pref));
    mechanicPreferences.setLong(pref, Long.MAX_VALUE);
    assertEquals(Long.MAX_VALUE, mechanicPreferences.getLong(pref));
  }

  public void testGetTaskDirectories() {
    setToDefault(IMechanicPreferences.DIRS_PREF);

    String taskDirs = mechanicPreferences.getString(IMechanicPreferences.DIRS_PREF);
    assertEquals("${user_homedir}/.eclipse/mechanic:${mechanic_configuration_path}/mechanic", taskDirs);
  }

  public void testContains() {
    String pref = "XYZPDQ";
    assertFalse(mechanicPreferences.contains(pref));
    mechanicPreferences.setLong(pref, 1L);
    assertTrue(mechanicPreferences.contains(pref));
    setToDefault(pref);
    assertFalse(mechanicPreferences.contains(pref));
  }

  //public static int getThreadSleepSeconds() {
  //public static String doVariableSubstitution(String input) {
  //public static IStatus validatePreferencesFile(IPath path) {

  /**
   * Create a mock task with the given id.
   */
  private Task createTask(final String id) {
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Evaluator.java
// public interface Evaluator {
// 
//   /**
//    * @return true if the environment adheres to this test.
//    */
//   public boolean evaluate();
// 
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/RepairAction.java
// public interface RepairAction extends Runnable {
// 
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/Task.java
// public interface Task {
// 
//   /**
//    * Return an id for this task. The id should be unique to any instance that
//    * behaves differently than another instance. Typically the id would be the
//    * fully qualified class name unless two task instances somehow manage to 
//    * behave differently. In this case they should each return a unique id.
//    */
//   public String getId();
// 
//   /**
//    * Returns a string suitable for display to the user providing a title for
//    * this Task. This is used in contexts where a short
//    * description is needed. Capitalization should follow the same rules as
//    * applied to book titles.
//    */
//   public String getTitle();
// 
//   /**
//    * Returns a string suitable for display to the user describing what action
//    * will be taken when the associated {@link RepairAction} is executed.
//    * <p/>
//    * The description should start with a 3rd person descriptive verb such as:
//    * <p/>
//    * "Customizes your java code templates with user information."
//    * "Configures a local extension location."
//    */
//   public String getDescription();
// 
//   /**
//    * Returns an Evaluator for this task. The Evaluator should return false
//    * if the associated RepairAction needs to be executed.
//    */
//   public Evaluator getEvaluator();
// 
//   /**
//    * Returns a {@link RepairAction} capable of bringing this {@link Task}
//    * into compliance.
//    */
//   public RepairAction getRepairAction();
// }
// 
// Path: parent/bundles/com.google.eclipse.mechanic/src/com/google/eclipse/mechanic/internal/MechanicPreferences.java
// @SuppressWarnings("deprecation") // Uses the old-style API.
// public class MechanicPreferences implements IMechanicPreferences {
// 
//   public void addListener(IPropertyChangeListener listener) {
//     OldMechanicPreferences.addListener(listener);
//   }
// 
//   public void removeListener(IPropertyChangeListener listener) {
//     OldMechanicPreferences.removeListener(listener);
//   }
// 
//   public List<IResourceTaskProvider> getTaskProviders() {
//     return OldMechanicPreferences.getTaskProviders();
//   }
// 
//   public int getThreadSleepSeconds() {
//     return OldMechanicPreferences.getThreadSleepSeconds();
//   }
// 
//   public int cleanSleepSeconds(int seconds) {
//     return OldMechanicPreferences.cleanSleepSeconds(seconds);
//   }
// 
//   public Set<String> getBlockedTaskIds() {
//     return OldMechanicPreferences.getBlockedTaskIds();
//   }
// 
//   public void setBlockedTaskIds(Set<String> ids) {
//     OldMechanicPreferences.setBlockedTaskIds(ids);
//   }
// 
//   public void blockItem(Task item) {
//     OldMechanicPreferences.blockItem(item);
//   }
// 
//   public String getHelpUrl() {
//     return OldMechanicPreferences.getHelpUrl();
//   }
// 
//   public boolean contains(String key) {
//     return OldMechanicPreferences.contains(key);
//   }
// 
//   public int getInt(String key) {
//     return OldMechanicPreferences.getInt(key);
//   }
// 
//   public long getLong(String key) {
//     return OldMechanicPreferences.getLong(key);
//   }
// 
//   public void setLong(String key, long value) {
//     OldMechanicPreferences.setLong(key, value);
//   }
// 
//   public String getString(String key) {
//     return OldMechanicPreferences.getString(key);
//   }
// 
//   public void setString(String key, String value) {
//     OldMechanicPreferences.setString(key, value);
//   }
// 
//   public boolean isShowPopup() {
//     return OldMechanicPreferences.isShowPopup();
//   }
// 
//   public void doNotShowPopup() {
//     OldMechanicPreferences.doNotShowPopup();
//   }
// 
//   public void showPopup() {
//     OldMechanicPreferences.showPopup();
//   }
// 
//   public IStatus validatePreferencesFile(IPath path) {
//     return OldMechanicPreferences.validatePreferencesFile(path);
//   }
// }


// Path: parent/tests/com.google.eclipse.mechanic.tests/src/com/google/eclipse/mechanic/plugin/core/MechanicPreferencesTest.java
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import junit.framework.TestCase;
import com.google.eclipse.mechanic.Evaluator;
import com.google.eclipse.mechanic.RepairAction;
import com.google.eclipse.mechanic.Task;
import com.google.eclipse.mechanic.internal.MechanicPreferences;
import com.google.eclipse.mechanic.tests.internal.RunAsPluginTest;

    mechanicPreferences.setLong(pref, 1);
    assertEquals(1, mechanicPreferences.getLong(pref));
    mechanicPreferences.setLong(pref, Long.MAX_VALUE);
    assertEquals(Long.MAX_VALUE, mechanicPreferences.getLong(pref));
  }

  public void testGetTaskDirectories() {
    setToDefault(IMechanicPreferences.DIRS_PREF);

    String taskDirs = mechanicPreferences.getString(IMechanicPreferences.DIRS_PREF);
    assertEquals("${user_homedir}/.eclipse/mechanic:${mechanic_configuration_path}/mechanic", taskDirs);
  }

  public void testContains() {
    String pref = "XYZPDQ";
    assertFalse(mechanicPreferences.contains(pref));
    mechanicPreferences.setLong(pref, 1L);
    assertTrue(mechanicPreferences.contains(pref));
    setToDefault(pref);
    assertFalse(mechanicPreferences.contains(pref));
  }

  //public static int getThreadSleepSeconds() {
  //public static String doVariableSubstitution(String input) {
  //public static IStatus validatePreferencesFile(IPath path) {

  /**
   * Create a mock task with the given id.
   */
  private Task createTask(final String id) {
    return new Task() {