summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2011-10-26 01:54:54 +0200
committerRobin Rosenberg <robin.rosenberg@dewire.com>2011-12-07 23:58:17 +0100
commitdfcb43eff1bbdc58b6d286b4d18256ce8af56a78 (patch)
tree70b535f441ee070383aaf23dc82b9e56446e0d55 /org.eclipse.jgit.junit
parent251bc02840a2e722a6cf660e4adde0e63d3d2de1 (diff)
downloadjgit-dfcb43eff1bbdc58b6d286b4d18256ce8af56a78.tar.gz
jgit-dfcb43eff1bbdc58b6d286b4d18256ce8af56a78.zip
Add methods for configuring platform emulation
Specifically we support setting system properties for Windows, generic Unix and current test platform. Change-Id: Ib02be417c4915350dfec64fda3face1138552871
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r--org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
index b9bc25857a..ae1c5d9fe8 100644
--- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
+++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
@@ -150,4 +150,34 @@ public class MockSystemReader extends SystemReader {
public Locale getLocale() {
return Locale.US;
}
+
+ /**
+ * Assign some properties for the currently executing platform
+ */
+ public void setCurrentPlatform() {
+ setProperty("os.name", System.getProperty("os.name"));
+ setProperty("file.separator", System.getProperty("file.separator"));
+ setProperty("path.separator", System.getProperty("path.separator"));
+ setProperty("line.separator", System.getProperty("line.separator"));
+ }
+
+ /**
+ * Emulate Windows
+ */
+ public void setWindows() {
+ setProperty("os.name", "Windows");
+ setProperty("file.separator", "\\");
+ setProperty("path.separator", ";");
+ setProperty("line.separator", "\r\n");
+ }
+
+ /**
+ * Emulate Unix
+ */
+ public void setUnix() {
+ setProperty("os.name", "*nix"); // Essentially anything but Windows
+ setProperty("file.separator", "/");
+ setProperty("path.separator", ":");
+ setProperty("line.separator", "\n");
+ }
}