Merge "Fix junit tests under windows when the platform is explicitly changed" into stable-3.6
This commit is contained in:
commit
79201ac95e
|
@ -184,6 +184,7 @@ public void setWindows() {
|
||||||
setProperty("file.separator", "\\");
|
setProperty("file.separator", "\\");
|
||||||
setProperty("path.separator", ";");
|
setProperty("path.separator", ";");
|
||||||
setProperty("line.separator", "\r\n");
|
setProperty("line.separator", "\r\n");
|
||||||
|
setPlatformChecker();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,5 +195,6 @@ public void setUnix() {
|
||||||
setProperty("file.separator", "/");
|
setProperty("file.separator", "/");
|
||||||
setProperty("path.separator", ":");
|
setProperty("path.separator", ":");
|
||||||
setProperty("line.separator", "\n");
|
setProperty("line.separator", "\n");
|
||||||
|
setPlatformChecker();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,11 +163,19 @@ public static void setInstance(SystemReader newReader) {
|
||||||
private void init() {
|
private void init() {
|
||||||
// Creating ObjectChecker must be deferred. Unit tests change
|
// Creating ObjectChecker must be deferred. Unit tests change
|
||||||
// behavior of is{Windows,MacOS} in constructor of subclass.
|
// behavior of is{Windows,MacOS} in constructor of subclass.
|
||||||
if (platformChecker == null) {
|
if (platformChecker == null)
|
||||||
platformChecker = new ObjectChecker()
|
setPlatformChecker();
|
||||||
.setSafeForWindows(isWindows())
|
}
|
||||||
.setSafeForMacOS(isMacOS());
|
|
||||||
}
|
/**
|
||||||
|
* Should be used in tests when the platform is explicitly changed.
|
||||||
|
*
|
||||||
|
* @since 3.6
|
||||||
|
*/
|
||||||
|
protected final void setPlatformChecker() {
|
||||||
|
platformChecker = new ObjectChecker()
|
||||||
|
.setSafeForWindows(isWindows())
|
||||||
|
.setSafeForMacOS(isMacOS());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue