Consolidate windows platform tests to a single class

This saves us from defining the same method 3 times.

Change-Id: I00cf7c6827dee48fb2105b15bc56fe33996b8805
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-12-22 16:34:40 -08:00
parent 57c4ba8e81
commit 3c3cd755d0
5 changed files with 50 additions and 32 deletions

View File

@@ -14,6 +14,8 @@
package com.google.gerrit.server.config;
import com.google.gerrit.server.util.HostPlatform;
import junit.framework.TestCase;
import java.io.File;
@@ -84,7 +86,7 @@ public class SitePathsTest extends TestCase {
assertNotNull(site.resolve("a"));
assertEquals(new File(root, "a"), site.resolve("a"));
final String pfx = isWin32() ? "C:/" : "/";
final String pfx = HostPlatform.isWin32() ? "C:/" : "/";
assertNotNull(site.resolve(pfx + "a"));
assertEquals(new File(pfx + "a"), site.resolve(pfx + "a"));
}
@@ -93,10 +95,4 @@ public class SitePathsTest extends TestCase {
final File t = new File("target");
return new File(t, "random-name-" + UUID.randomUUID().toString());
}
private static boolean isWin32() {
final String osDotName = System.getProperty("os.name");
return osDotName != null
&& osDotName.toLowerCase().indexOf("windows") != -1;
}
}