[ISSUE #11255]Update PathEncoderManagerTest#testEncodeWithNonExistOs. (#11256)

* [ISSUE #11255]Remove PathEncoderManagerTest#testEncodeWithNonExistOs.

* [ISSUE #11255]Update PathEncoderManagerTest#testEncodeWithNonExistOs.
This commit is contained in:
阿魁 2023-10-17 16:53:11 +08:00 committed by GitHub
parent c4aac2b82f
commit 1df023451d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,13 +70,8 @@ public class PathEncoderManagerTest {
public void testWindowsEncode() throws Exception {
// load static
PathEncoderManager instance = PathEncoderManager.getInstance();
// remove impl
targetEncoder.set(instance, null);
// try to encode, non windows
String case1 = "aa||a";
Assert.assertEquals(PathEncoderManager.getInstance().encode(case1), case1);
String case2 = "aa%A9%%A9%a";
Assert.assertEquals(PathEncoderManager.getInstance().decode(case2), case2);
// try to encode if in windows
targetEncoder.set(instance, new WindowsEncoder());
Assert.assertEquals(PathEncoderManager.getInstance().encode(case1), case2);
@ -84,10 +79,16 @@ public class PathEncoderManagerTest {
}
@Test
public void testEncodeWithNonExistOs() {
System.setProperty("os.name", "non-exist");
String testCase = "aa||a";
Assert.assertEquals(testCase, PathEncoderManager.getInstance().encode(testCase));
public void testEncodeWithNonExistOs() throws Exception {
// load static
PathEncoderManager instance = PathEncoderManager.getInstance();
// remove impl
targetEncoder.set(instance, null);
// try to encode, non windows
String case1 = "aa||a";
Assert.assertEquals(PathEncoderManager.getInstance().encode(case1), case1);
String case2 = "aa%A9%%A9%a";
Assert.assertEquals(PathEncoderManager.getInstance().decode(case2), case2);
}
@Test