Skip to content

Commit

Permalink
[ISSUE #11255]Update PathEncoderManagerTest#testEncodeWithNonExistOs. (
Browse files Browse the repository at this point in the history
…#11256)

* [ISSUE #11255]Remove PathEncoderManagerTest#testEncodeWithNonExistOs.

* [ISSUE #11255]Update PathEncoderManagerTest#testEncodeWithNonExistOs.
  • Loading branch information
stone-98 authored Oct 17, 2023
1 parent c4aac2b commit 1df0234
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,25 @@ public void testInitWithWindows()
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);
Assert.assertEquals(PathEncoderManager.getInstance().decode(case2), case1);
}

@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
Expand Down

0 comments on commit 1df0234

Please sign in to comment.