Unified all file/path handling with java.nio.Path.

Change-Id: Ia8bd32a40448201059e9fcb3b371e4ca6dd9067b
diff --git a/src/main/java/com/google/gwt/benchmark/artifacts/PermutationInfo.java b/src/main/java/com/google/gwt/benchmark/artifacts/PermutationInfo.java
index dd549f8..7b17ab0 100644
--- a/src/main/java/com/google/gwt/benchmark/artifacts/PermutationInfo.java
+++ b/src/main/java/com/google/gwt/benchmark/artifacts/PermutationInfo.java
@@ -24,6 +24,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 import java.util.Scanner;
@@ -208,11 +209,12 @@
   /**
    * Retrieves the PermutationInfo for all permutations in a compilation result.
    */
-  public static List<PermutationInfo> getAllPemutationInfo(String outputJar, String auxJar,
-      String basePath) throws IOException {
+  public static List<PermutationInfo> getAllPemutationInfo(Path outputJarPath, Path auxJarPath,
+      Path basePath) throws IOException {
 
     int count = 0;
-    try (ZipFile jarFile = new ZipFile(outputJar); ZipFile auxJarFile = new ZipFile(auxJar)) {
+    try (ZipFile jarFile = new ZipFile(outputJarPath.toFile());
+        ZipFile auxJarFile = new ZipFile(auxJarPath.toFile())) {
 
       // Read compile mappings.
       List<PermutationInfo> permutationInfos = processCompilationMappingsFile(basePath, jarFile);
@@ -272,9 +274,9 @@
   /**
    * Computes the compressed and uncompressed sizes for a JavaScript artifact.
    */
-  private static Pair<Long, Long> computeJsFileSizes(ZipFile jarFile, String baseFileName) {
+  private static Pair<Long, Long> computeJsFileSizes(ZipFile jarFile, Path baseFileName) {
     // Check if there is an uncompressed version first.
-    ZipEntry entry = jarFile.getEntry(baseFileName);
+    ZipEntry entry = jarFile.getEntry(baseFileName.toString());
     if (entry != null) {
       return Pair.of(entry.getSize(), entry.getCompressedSize());
     }
@@ -291,10 +293,10 @@
   /**
    * Computes the sizes of JavaScript artifacts.
    */
-  private static void computeJsSizes(String basePath, ZipFile jarFile, PermutationInfo permInfo,
+  private static void computeJsSizes(Path basePath, ZipFile jarFile, PermutationInfo permInfo,
       PermutationInfo.Stats stats) {
     Pair<Long, Long> sizes =
-        computeJsFileSizes(jarFile, basePath + "/" + permInfo.getHash() + MAIN_FILE_SUFFIX);
+        computeJsFileSizes(jarFile, basePath.resolve(permInfo.getHash() + MAIN_FILE_SUFFIX));
     long uncompressedSize = sizes.getLeft();
     long compressedSize = sizes.getRight();
     stats.setInitialUncompressedSize(uncompressedSize);
@@ -303,8 +305,8 @@
     long totalCompressedSize = compressedSize;
     for (int i = 1;; i++) {
       sizes =
-          computeJsFileSizes(jarFile, basePath + "/deferredjs/" + permInfo.getHash() + "/" + i
-              + MAIN_FILE_SUFFIX);
+          computeJsFileSizes(jarFile, basePath.resolve("deferredjs").resolve(permInfo.getHash())
+              .resolve(i + MAIN_FILE_SUFFIX));
       if (sizes == null) {
         break;
       }
@@ -326,10 +328,11 @@
   /**
    * Computes stats related to symbolmaps.
    */
-  private static void computeSymbolInformation(String basePath, ZipFile auxJarFile,
+  private static void computeSymbolInformation(Path basePath, ZipFile auxJarFile,
       PermutationInfo permInfo, Stats stats) throws IOException {
     ZipEntry entry =
-        auxJarFile.getEntry(basePath + "/symbolMaps/" + permInfo.getHash() + ".symbolMap");
+        auxJarFile.getEntry(basePath.resolve("symbolMaps")
+            .resolve(permInfo.getHash() + ".symbolMap").toString());
     assert entry != null;
 
     stats.setSymbolMapSize(entry.getSize());
@@ -359,10 +362,11 @@
    * Processes the compilation-mappings.txt file and creates an empty permutation info
    * for each permutation in it.
    */
-  private static List<PermutationInfo> processCompilationMappingsFile(String basePath,
-      ZipFile jarFile) throws IOException {
+  private static List<PermutationInfo> processCompilationMappingsFile(Path basePath, ZipFile jarFile)
+      throws IOException {
     List<PermutationInfo> permutationInfos = Lists.newArrayList();
-    ZipEntry compilationMappings = jarFile.getEntry(basePath + "/" + "compilation-mappings.txt");
+    ZipEntry compilationMappings =
+        jarFile.getEntry(basePath.resolve("compilation-mappings.txt").toString());
     try (BufferedReader compilationMappingsReader =
         new BufferedReader(new InputStreamReader(jarFile.getInputStream(compilationMappings)))) {
       PermutationInfo permInfo;
diff --git a/src/main/java/com/google/gwt/benchmark/git/GitInterface.java b/src/main/java/com/google/gwt/benchmark/git/GitInterface.java
index 212b840..ce5559d 100644
--- a/src/main/java/com/google/gwt/benchmark/git/GitInterface.java
+++ b/src/main/java/com/google/gwt/benchmark/git/GitInterface.java
@@ -38,8 +38,8 @@
 import org.eclipse.jgit.treewalk.filter.PathSuffixFilter;
 import org.eclipse.jgit.treewalk.filter.TreeFilter;
 
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.logging.Logger;
 
@@ -70,11 +70,11 @@
   /**
    * Checkout revision {@code revision} in repository {@code repo}.
    */
-  public static RevisionInfo checkout(String repo, String revision) throws GitException {
+  public static RevisionInfo checkout(Path repoPath, String revision) throws GitException {
     Git git = null;
     log.info("Checking out " + revision);
     try {
-      git = Git.open(new File(repo));
+      git = Git.open(repoPath.toFile());
       CheckoutCommand checkoutCommand = git.checkout().setName(revision);
       checkoutCommand.call();
       if (checkoutCommand.getResult().getStatus() != CheckoutResult.Status.OK) {
@@ -94,22 +94,23 @@
   /**
    * Clones a git repository.
    */
-  public static void cloneRepository(String mainRepo, File targetRepo) throws GitAPIException,
-      InvalidRemoteException, TransportException {
-    log.info("Cloning repo from "  + mainRepo + " to " + targetRepo.getAbsolutePath());
+  public static void cloneRepository(Path mainRepoPath, Path targetRepoPath)
+      throws GitAPIException, InvalidRemoteException, TransportException {
+    log.info("Cloning repo from " + mainRepoPath + " to " + targetRepoPath);
 
-    CloneCommand clone = Git.cloneRepository().setDirectory(targetRepo).setURI(mainRepo);
+    CloneCommand clone =
+        Git.cloneRepository().setDirectory(targetRepoPath.toFile()).setURI(mainRepoPath.toString());
     Git git = clone.call();
-    Benchmark.log.info("Cloned repo from "  + mainRepo + " to " + targetRepo.getAbsolutePath());
+    Benchmark.log.info("Cloned repo from " + mainRepoPath + " to " + targetRepoPath);
   }
 
   /**
    * Returns the RevisionInfo for HEAD.
    */
-  public static RevisionInfo getCurrentCommit(String repo) throws GitException {
+  public static RevisionInfo getCurrentCommit(Path repoPath) throws GitException {
     Git git = null;
     try {
-      git = Git.open(new File(repo));
+      git = Git.open(repoPath.toFile());
       return createFromCommit(git.log().setMaxCount(1).call().iterator().next());
     } catch (IOException | GitAPIException e) {
       throw new GitException("Could not retrieve HEAD information ", e);
@@ -124,25 +125,25 @@
    * Obtains the list of revisions that affected files in any of the prefixes and with any of
    * the suffixes.
    */
-  public static List<RevisionInfo> getRevisionsAffectingTargets(String repo, List<String> prefixes,
-      List<String> suffixes) throws GitException {
+  public static List<RevisionInfo> getRevisionsAffectingTargets(Path repoPath,
+      List<String> prefixes, List<String> suffixes) throws GitException {
     log.info("Computing revisions to test");
     List<RevisionInfo> revisionsToTest = Lists.newArrayList();
     Git git = null;
     try {
-      git = Git.open(new File(repo));
+      git = Git.open(repoPath.toFile());
       LogCommand logCommand = git.log();
       for (RevCommit commit : logCommand.all().call()) {
-        RevisionInfo revInfo = maybeGetRevisionInfo(git.getRepository(), commit, prefixes,
-            suffixes);
-        if (revInfo == null){
+        RevisionInfo revInfo =
+            maybeGetRevisionInfo(git.getRepository(), commit, prefixes, suffixes);
+        if (revInfo == null) {
           continue;
         }
         revisionsToTest.add(revInfo);
       }
       log.info("Revisions to test : " + revisionsToTest.size());
     } catch (IOException | GitAPIException e) {
-      throw new GitException("Could not get revision list" , e);
+      throw new GitException("Could not get revision list", e);
     } finally {
       if (git != null) {
         git.close();
@@ -154,10 +155,10 @@
   /**
    * Updates a git repository.
    */
-  public static void updateGitRepository(String mainrepo) throws IOException, GitAPIException,
+  public static void updateGitRepository(Path repoPath) throws IOException, GitAPIException,
       InvalidRemoteException, TransportException {
-    Benchmark.log.info("Updating git repo at "  + mainrepo);
-    Git repo = Git.open(new File(mainrepo));
+    Benchmark.log.info("Updating git repo at " + repoPath);
+    Git repo = Git.open(repoPath.toFile());
     FetchCommand fetchCommand = repo.fetch();
     fetchCommand.call();
   }
@@ -166,8 +167,8 @@
    * Creates a RevisionInfo from a RevCommit.
    */
   private static RevisionInfo createFromCommit(RevCommit commit) {
-    return new RevisionInfo(commit.getName(), commit.getShortMessage(),
-        commit.getCommitterIdent().getName(), commit.getCommitterIdent().getWhen());
+    return new RevisionInfo(commit.getName(), commit.getShortMessage(), commit.getCommitterIdent()
+        .getName(), commit.getCommitterIdent().getWhen());
   }
 
   /**
@@ -197,10 +198,8 @@
 
       // Set the filter on revisions whose modified files (TreeFilter.ANY_DIFF) start with one of
       // the prefixes listed and end with one of the suffixes listed.
-      treeWalk.setFilter(AndTreeFilter.create(new TreeFilter[] {
-          TreeFilter.ANY_DIFF,
-          or(prefixFilters),
-          or(suffixFilters)}));
+      treeWalk.setFilter(AndTreeFilter.create(new TreeFilter[] {TreeFilter.ANY_DIFF,
+          or(prefixFilters), or(suffixFilters)}));
 
       if (treeWalk.next()) {
         // If there is at least one modified file that satisfied the query, this revision is
diff --git a/src/main/java/com/google/gwt/benchmark/project/ProjectConfiguration.java b/src/main/java/com/google/gwt/benchmark/project/ProjectConfiguration.java
index b43c451..4b0ab04 100644
--- a/src/main/java/com/google/gwt/benchmark/project/ProjectConfiguration.java
+++ b/src/main/java/com/google/gwt/benchmark/project/ProjectConfiguration.java
@@ -24,6 +24,8 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
@@ -49,13 +51,13 @@
   /**
    * Loads all project configurations.
    */
-  public static List<ProjectConfiguration> getProjectConfigurations(String workdir) {
+  public static List<ProjectConfiguration> getProjectConfigurations(Path workDirPath) {
     List<ProjectConfiguration> projectConfigurations = Lists.newArrayList();
-    File projectsDir = new File(workdir + "/projects");
-    String[] contents = projectsDir.list();
+    Path projectsDirPath = workDirPath.resolve("projects");
+    String[] contents = projectsDirPath.toFile().list();
     for (String projectDir : contents) {
       ProjectConfiguration projectConfiguration =
-          getProjectConfiguration(projectsDir.getPath(), projectDir);
+          getProjectConfiguration(projectsDirPath, Paths.get(projectDir));
       if (projectConfiguration != null) {
         projectConfigurations.add(projectConfiguration);
       }
@@ -67,13 +69,13 @@
    * Loads a project configuration from disk.
    */
   @VisibleForTesting
-  static ProjectConfiguration getProjectConfiguration(String baseDir, String projectDir) {
-    ProjectConfiguration projectConfiguration = new ProjectConfiguration(projectDir);
+  static ProjectConfiguration getProjectConfiguration(Path baseDir, Path projectDir) {
+    ProjectConfiguration projectConfiguration = new ProjectConfiguration(projectDir.toString());
     log.info("Processing project at " + projectDir);
     Properties projectProperties = new Properties();
     try {
-      final String projectPath = baseDir + "/" + projectDir;
-      projectProperties.load(new FileInputStream(new File(projectPath + "/project.config")));
+      Path projectPath = baseDir.resolve(projectDir);
+      projectProperties.load(new FileInputStream(projectPath.resolve("project.config").toFile()));
       projectConfiguration.setCompilerEntryPoint(projectProperties.getProperty(
           GWT_ENTRY_POINT_PROPERTY, GWT_DEFAULT_ENTRY_POINT_PROPERTY));
       projectConfiguration.setGwtCommandLineOpts(projectProperties.getProperty(GWT_OPTS_PROPERTY,
@@ -90,14 +92,14 @@
       }
       projectConfiguration.setTargetModule(targetModule);
       projectConfiguration.setPath(projectPath);
-      projectConfiguration.setOutputPath(projectProperties.getProperty(OUTPUT_PATH_PROPERTY,
-          targetModule));
+      projectConfiguration.setOutputPath(Paths.get(projectProperties.getProperty(
+          OUTPUT_PATH_PROPERTY, targetModule)));
 
       // Determine the input jars for this project.
-      File projectJarPath = new File(projectPath + "/" + PROJECT_JAR_PATH);
-      if (projectJarPath.exists()) {
-        for (File jar : projectJarPath.listFiles()) {
-          projectConfiguration.inputJars.add(PROJECT_JAR_PATH + "/" + jar.getName());
+      Path projectJarPath = projectPath.resolve(PROJECT_JAR_PATH);
+      if (projectJarPath.toFile().exists()) {
+        for (File jar : projectJarPath.toFile().listFiles()) {
+          projectConfiguration.inputJars.add(projectJarPath.resolve(jar.getName()));
         }
       }
 
@@ -110,11 +112,11 @@
 
   private String compilerEntryPoint;
   private String gwtCommandLineOpts;
-  private final List<String> inputJars = Lists.newArrayList();
+  private final List<Path> inputJars = Lists.newArrayList();
   private String javaCommandLineOpts;
   private final String name;
-  private String outputPath;
-  private String path;
+  private Path outputPath;
+  private Path path;
   private String targetModule;
 
   /**
@@ -176,14 +178,14 @@
   /**
    * @return the outputPath
    */
-  public final String getOutputPath() {
+  public final Path getOutputPath() {
     return outputPath;
   }
 
   /**
    * Returns the project path.
    */
-  public final String getPath() {
+  public final Path getPath() {
     return path;
   }
 
@@ -220,15 +222,15 @@
   /**
    * @param outputPath the outputPath to set
    */
-  public final void setOutputPath(String outputPath) {
+  public final void setOutputPath(Path outputPath) {
     this.outputPath = outputPath;
   }
 
   /**
    * Sets the project path.
    */
-  public final void setPath(String path) {
-    Preconditions.checkArgument(path != null && !path.isEmpty(),
+  public final void setPath(Path path) {
+    Preconditions.checkArgument(path != null && !path.toString().isEmpty(),
         "Project path should not be null nor empty");
     Preconditions.checkNotNull("Project path should not be null", path);
     this.path = path;
@@ -258,7 +260,7 @@
   /**
    * Returns the list of input jars.
    */
-  private final List<String> getInputJars() {
+  private final List<Path> getInputJars() {
     return Collections.unmodifiableList(inputJars);
   }
 }
diff --git a/src/main/java/com/google/gwt/benchmark/runner/ProcessRunner.java b/src/main/java/com/google/gwt/benchmark/runner/ProcessRunner.java
index fd76304..af7435b 100644
--- a/src/main/java/com/google/gwt/benchmark/runner/ProcessRunner.java
+++ b/src/main/java/com/google/gwt/benchmark/runner/ProcessRunner.java
@@ -24,12 +24,15 @@
 import org.apache.commons.exec.ExecuteWatchdog;
 import org.apache.commons.exec.Executor;
 import org.apache.commons.exec.PumpStreamHandler;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.output.TeeOutputStream;
 
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 import java.util.Map;
 import java.util.logging.Logger;
@@ -53,11 +56,11 @@
    * Tester main method.
    */
   public static void main(String[] args) {
-    File currentDir = new File(System.getProperty("user.dir"));
+    Path currentDir = Paths.get(System.getProperty("user.dir"));
     try {
-      File runnerOut = File.createTempFile("runner", ".out");
-      File runnerErr = File.createTempFile("runner", ".err");
-      log.info("Output will be stored at " + runnerOut.getPath() + " and " + runnerErr.getPath());
+      Path runnerOut = File.createTempFile("runner", ".out").toPath();
+      Path runnerErr = File.createTempFile("runner", ".err").toPath();
+      log.info("Output will be stored at " + runnerOut + " and " + runnerErr);
       ProcessStats processStats =
           runAndTimeCommand(currentDir, runnerOut, runnerErr, Maps.<String, String>newHashMap(),
               args);
@@ -67,11 +70,11 @@
     }
   }
 
-  private static ProcessStats parseProcessStats(boolean error, File timeStatsFile)
+  private static ProcessStats parseProcessStats(boolean error, Path timeStatsFilePath)
       throws RunnerException {
     List<String> lines;
     try {
-      lines = Files.readAllLines(timeStatsFile.toPath(), Charsets.UTF_8);
+      lines = Files.readAllLines(timeStatsFilePath, Charsets.UTF_8);
     } catch (IOException e) {
       throw new RunnerException("Could not get time stats", e);
     }
@@ -103,28 +106,29 @@
   /**
    * Executes the command and args as a separate process and records timing info.
    *
-   * @param workdir the working directory to run the command on.
+   * @param workDirPath the working directory to run the command on.
    * @param newEnviromentVars enviroment variables and values to add the to environment on which to
    *        the command.
    * @param commandPlusArgs the command to be run and its arguments.
    */
-  public static ProcessStats runAndTimeCommand(File workdir, File stdOutput, File stdError,
-      Map<String, String> newEnviromentVars, String... commandPlusArgs) throws RunnerException {
+  public static ProcessStats runAndTimeCommand(Path workDirPath, Path stdOutputRedirectPath,
+      Path stdErrorRedirectPath, Map<String, String> newEnviromentVars, String... commandPlusArgs)
+      throws RunnerException {
     log.info("Running command " + Joiner.on(" ").join(commandPlusArgs));
 
-    File timerOutputFile = null;
+    Path timerOutputFilePath = null;
 
-    try (FileOutputStream outputFileStream = new FileOutputStream(stdOutput);
-        FileOutputStream errorFileStream = new FileOutputStream(stdError)) {
+    try (FileOutputStream outputFileStream = new FileOutputStream(stdOutputRedirectPath.toFile());
+        FileOutputStream errorFileStream = new FileOutputStream(stdErrorRedirectPath.toFile())) {
 
-      timerOutputFile = File.createTempFile("gwt-compile-bench", "timestats");
+      timerOutputFilePath = File.createTempFile("gwt-compile-bench", "timestats").toPath();
 
       // Set the parameters to /usr/bin/time
       CommandLine commandLine = new CommandLine("/usr/bin/time");
       commandLine.addArgument("--format");
       commandLine.addArgument("%e\n%S\n%U\n%M\n%x");
       commandLine.addArgument("--output");
-      commandLine.addArgument(timerOutputFile.getAbsolutePath());
+      commandLine.addArgument(timerOutputFilePath.toString());
 
       // Add the original command line to run
       commandLine.addArguments(commandPlusArgs);
@@ -139,8 +143,8 @@
       pumpStreamHandler.setStopTimeout(STREAM_HANDLER_STOP_TIMEOUT);
       executor.setStreamHandler(pumpStreamHandler);
 
-      log.info("Setting workdir to " + workdir);
-      executor.setWorkingDirectory(workdir);
+      log.info("Setting workdir to " + workDirPath);
+      executor.setWorkingDirectory(workDirPath.toFile());
 
       Map<String, String> environment = Maps.newHashMap(System.getenv());
       environment.putAll(newEnviromentVars);
@@ -148,16 +152,14 @@
       // Actually execute the command.
       int exitValue = executor.execute(commandLine, environment);
 
-      ProcessStats processStats = parseProcessStats(exitValue != 0, timerOutputFile);
+      ProcessStats processStats = parseProcessStats(exitValue != 0, timerOutputFilePath);
       log.info("Finished the run with the following stats: " + processStats.toString());
 
       return processStats;
     } catch (IOException e) {
       throw new RunnerException("Could not run command " + Joiner.on(" ").join(commandPlusArgs), e);
     } finally {
-      if (timerOutputFile != null) {
-        timerOutputFile.delete();
-      }
+      FileUtils.deleteQuietly(timerOutputFilePath.toFile());
     }
   }
 }
diff --git a/src/test/java/com/google/gwt/benchmark/artifacts/PermutationInfoTest.java b/src/test/java/com/google/gwt/benchmark/artifacts/PermutationInfoTest.java
index 92a2d02..6b143af 100644
--- a/src/test/java/com/google/gwt/benchmark/artifacts/PermutationInfoTest.java
+++ b/src/test/java/com/google/gwt/benchmark/artifacts/PermutationInfoTest.java
@@ -19,6 +19,7 @@
 import org.junit.Test;
 
 import java.io.IOException;
+import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -28,10 +29,10 @@
 
   @Test
   public void testReadCompileOutput() throws IOException {
-    List<PermutationInfo> permutationInfos = PermutationInfo.getAllPemutationInfo(
-        "src/test/resources/artifacts/showcase.jar",
-        "src/test/resources/artifacts/showcase-aux.jar",
-        "showcase");
+    List<PermutationInfo> permutationInfos =
+        PermutationInfo.getAllPemutationInfo(
+            Paths.get("src/test/resources/artifacts/showcase.jar"),
+            Paths.get("src/test/resources/artifacts/showcase-aux.jar"), Paths.get("showcase"));
     assertEquals(25, permutationInfos.size());
     PermutationInfo permutationInfo =
         getByHash(permutationInfos, "0F002976225CC32E85BE1F39AEEE6C96");
diff --git a/src/test/java/com/google/gwt/benchmark/git/GitInterfaceTest.java b/src/test/java/com/google/gwt/benchmark/git/GitInterfaceTest.java
index 58b3c13..c988d64 100644
--- a/src/test/java/com/google/gwt/benchmark/git/GitInterfaceTest.java
+++ b/src/test/java/com/google/gwt/benchmark/git/GitInterfaceTest.java
@@ -25,7 +25,8 @@
 
 import org.junit.Test;
 
-import java.io.File;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.List;
 
 /**
@@ -36,31 +37,30 @@
   private static final String INITIAL_REVISION_TEST_REPO =
       "5136b807e93d93800139ea43ae88fb5ddee7c226";
 
-  private static final String HEAD_TEST_REPO =
-      "559ed7a0f92ac7da8b072e6e67f09589793f78fe";
+  private static final String HEAD_TEST_REPO = "559ed7a0f92ac7da8b072e6e67f09589793f78fe";
 
   @Test
   public void testCheckout_initial() throws GitException, ZipException {
-    File repodir = Files.createTempDir();
-    unzip("src/test/resources/testrepos/test.repo.zip", repodir.toString());
+    Path repoDirPath = Files.createTempDir().toPath();
+    unzip(Paths.get("src/test/resources/testrepos/test.repo.zip"), repoDirPath);
     RevisionInfo revInfo =
-        GitInterface.checkout(repodir.toString() + "/test.repo", INITIAL_REVISION_TEST_REPO);
+        GitInterface.checkout(repoDirPath.resolve("test.repo"), INITIAL_REVISION_TEST_REPO);
     assertNotNull(revInfo);
     assertEquals(INITIAL_REVISION_TEST_REPO, revInfo.getCommitId());
   }
 
   @Test
   public void testCheckout_bad() throws ZipException {
-    File repodir = Files.createTempDir();
-    unzip("src/test/resources/testrepos/test.repo.zip", repodir.toString());
+    Path repoDirPath = Files.createTempDir().toPath();
+    unzip(Paths.get("src/test/resources/testrepos/test.repo.zip"), repoDirPath);
     try {
-      GitInterface.checkout(repodir.toString() + "/test.repo", "_BAD_");
+      GitInterface.checkout(repoDirPath.resolve("test.repo"), "_BAD_");
       fail("Should have thrown an Exception");
     } catch (GitException e) {
       // expected.
     }
     try {
-      GitInterface.checkout(repodir.toString(), INITIAL_REVISION_TEST_REPO);
+      GitInterface.checkout(repoDirPath, INITIAL_REVISION_TEST_REPO);
       fail("Should have thrown an Exception");
     } catch (GitException e) {
       // expected.
@@ -69,25 +69,25 @@
 
   @Test
   public void testGetCurrentCommit() throws GitException, ZipException {
-    File repodir = Files.createTempDir();
-    unzip("src/test/resources/testrepos/test.repo.zip", repodir.toString());
-    RevisionInfo revInfo = GitInterface.getCurrentCommit(repodir.toString() + "/test.repo");
+    Path repoDirPath = Files.createTempDir().toPath();
+    unzip(Paths.get("src/test/resources/testrepos/test.repo.zip"), repoDirPath);
+    RevisionInfo revInfo = GitInterface.getCurrentCommit(repoDirPath.resolve("test.repo"));
     assertNotNull(revInfo);
     assertEquals(HEAD_TEST_REPO, revInfo.getCommitId());
   }
 
   @Test
   public void testGetRevisionsAffectingTargets() throws GitException, ZipException {
-    File repodir = Files.createTempDir();
-    unzip("src/test/resources/testrepos/test.repo.zip", repodir.toString());
+    Path repodir = Files.createTempDir().toPath();
+    unzip(Paths.get("src/test/resources/testrepos/test.repo.zip"), repodir);
     List<RevisionInfo> revisions =
-        GitInterface.getRevisionsAffectingTargets(repodir.toString()  + "/test.repo",
+        GitInterface.getRevisionsAffectingTargets(repodir.resolve("test.repo"),
             ImmutableList.of("src"), ImmutableList.of(".java"));
     assertEquals(1, revisions.size());
     assertEquals(INITIAL_REVISION_TEST_REPO, revisions.get(0).getCommitId());
   }
 
-  private void unzip(String zipFilePath, String destinationPath) throws ZipException {
-    new ZipFile(zipFilePath).extractAll(destinationPath);
+  private void unzip(Path zipFilePath, Path destinationPath) throws ZipException {
+    new ZipFile(zipFilePath.toString()).extractAll(destinationPath.toString());
   }
 }
diff --git a/src/test/java/com/google/gwt/benchmark/project/ProjectConfigurationTest.java b/src/test/java/com/google/gwt/benchmark/project/ProjectConfigurationTest.java
index d4e2f1d..de86146 100644
--- a/src/test/java/com/google/gwt/benchmark/project/ProjectConfigurationTest.java
+++ b/src/test/java/com/google/gwt/benchmark/project/ProjectConfigurationTest.java
@@ -20,7 +20,6 @@
 import static org.junit.Assert.fail;
 
 import com.google.common.base.Function;
-import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
@@ -28,6 +27,7 @@
 
 import org.junit.Test;
 
+import java.nio.file.Paths;
 import java.util.HashSet;
 import java.util.List;
 
@@ -43,7 +43,7 @@
   @Test
   public void testGetProjectConfigurations() {
     List<ProjectConfiguration> projectConfigurations =
-        ProjectConfiguration.getProjectConfigurations(TEST_WORK_DIR);
+        ProjectConfiguration.getProjectConfigurations(Paths.get(TEST_WORK_DIR));
 
     assertEquals(3, projectConfigurations.size());
 
@@ -64,8 +64,8 @@
   @Test
   public void testProjectConfiguration_good() {
     ProjectConfiguration projectConfiguration =
-        ProjectConfiguration.getProjectConfiguration(
-            Joiner.on("/").join(TEST_WORK_DIR, "projects"), "p1");
+        ProjectConfiguration.getProjectConfiguration(Paths.get(TEST_WORK_DIR).resolve("projects"),
+            Paths.get("p1"));
 
     assertNotNull(projectConfiguration);
     assertEquals("p1", projectConfiguration.getName());
@@ -73,8 +73,9 @@
     assertEquals("-draftCompile", projectConfiguration.getGwtCommandLineOpts());
     assertEquals("com.dummy.Compiler", projectConfiguration.getCompilerEntryPoint());
     assertEquals("com.target.Target", projectConfiguration.getTargetModule());
-    assertEquals("com.target.Target", projectConfiguration.getOutputPath());
-    assertEquals("src/test/resources/workdir/projects/p1", projectConfiguration.getPath());
+    assertEquals(Paths.get("com.target.Target"), projectConfiguration.getOutputPath());
+    assertEquals(Paths.get("src/test/resources/workdir/projects/p1"),
+        projectConfiguration.getPath());
     assertEquals(
         "java -cp gwt-user.jar:gwt-dev.jar -Dtest com.dummy.Compiler "
             + "-draftCompile com.target.Target -war outdir/out.jar -extra outdir/aux.jar "
@@ -89,8 +90,8 @@
   @Test
   public void testProjectConfiguration_bad() {
     ProjectConfiguration projectConfiguration =
-        ProjectConfiguration.getProjectConfiguration(
-            Joiner.on("/").join(TEST_WORK_DIR, "projects"), "incomplete");
+        ProjectConfiguration.getProjectConfiguration(Paths.get(TEST_WORK_DIR).resolve("projects"),
+            Paths.get("incomplete"));
 
     assertNull(projectConfiguration);
   }
@@ -101,8 +102,8 @@
   @Test
   public void testProjectConfiguration_default() {
     ProjectConfiguration projectConfiguration =
-        ProjectConfiguration.getProjectConfiguration(
-            Joiner.on("/").join(TEST_WORK_DIR, "projects"), "p2");
+        ProjectConfiguration.getProjectConfiguration(Paths.get(TEST_WORK_DIR).resolve("projects"),
+            Paths.get("p2"));
 
     assertNotNull(projectConfiguration);
     assertEquals("p2", projectConfiguration.getName());
@@ -110,13 +111,14 @@
     assertEquals("", projectConfiguration.getGwtCommandLineOpts());
     assertEquals("com.google.gwt.dev.Compiler", projectConfiguration.getCompilerEntryPoint());
     assertEquals("p2target", projectConfiguration.getTargetModule());
-    assertEquals("p2target_out", projectConfiguration.getOutputPath());
-    assertEquals("src/test/resources/workdir/projects/p2", projectConfiguration.getPath());
+    assertEquals(Paths.get("p2target_out"), projectConfiguration.getOutputPath());
+    assertEquals(Paths.get("src/test/resources/workdir/projects/p2"),
+        projectConfiguration.getPath());
     assertEquals(
         "java -cp gwt-user.jar:gwt-dev.jar com.google.gwt.dev.Compiler p2target -war outdir/out.jar"
             + " -extra outdir/aux.jar -deploy outdir/aux.jar",
         projectConfiguration.getCompleteCommandLine("outdir",
-            ImmutableList.of("gwt-user.jar", "gwt-dev.jar")));;
+            ImmutableList.of("gwt-user.jar", "gwt-dev.jar")));
 
     try {
       projectConfiguration.getCompleteCommandLine("", ImmutableList.<String>of());
diff --git a/src/test/java/com/google/gwt/benchmark/runner/ProcessRunnerTest.java b/src/test/java/com/google/gwt/benchmark/runner/ProcessRunnerTest.java
index 1b69d0e..0eb7e54 100644
--- a/src/test/java/com/google/gwt/benchmark/runner/ProcessRunnerTest.java
+++ b/src/test/java/com/google/gwt/benchmark/runner/ProcessRunnerTest.java
@@ -25,6 +25,8 @@
 import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
 
@@ -120,16 +122,16 @@
    */
   @Test
   public void testRunAndTimeCommand() throws IOException, RunnerException {
-    File outFile = File.createTempFile("test", ".out");
-    File errFile = File.createTempFile("test", ".err");
-    File workdir = new File(System.getProperty("user.dir"));
+    Path outFilePath = File.createTempFile("test", ".out").toPath();
+    Path errFilePath = File.createTempFile("test", ".err").toPath();
+    Path workDirPath = Paths.get(System.getProperty("user.dir"));
     ProcessStats processStats =
-        ProcessRunner.runAndTimeCommand(workdir, outFile, errFile,
+        ProcessRunner.runAndTimeCommand(workDirPath, outFilePath, errFilePath,
             ImmutableMap.<String, String>of(), "ls", "-1a");
 
     assertNotNull(processStats);
     assertEquals(0, processStats.getExitCode());
-    List<String> lines = Files.readAllLines(outFile.toPath(), Charsets.UTF_8);
+    List<String> lines = Files.readAllLines(outFilePath, Charsets.UTF_8);
     assertEquals(".", lines.get(0));
     assertEquals("..", lines.get(1));
   }