Skip to content

Commit

Permalink
[ISSUE alibaba#11255]Update PathEncoderManagerTest#testEncodeWithNonE…
Browse files Browse the repository at this point in the history
…xistOs.
  • Loading branch information
stone-98 committed Oct 17, 2023
1 parent c9f77e5 commit 54e2632
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ public void testInitWithWindows()
*/
@Test
public void testWindowsEncode() throws Exception {
// load static
PathEncoderManager instance = PathEncoderManager.getInstance();
String case1 = "aa||a";
String case2 = "aa%A9%%A9%a";
// 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() throws Exception {
// load static
PathEncoderManager instance = PathEncoderManager.getInstance();
// remove impl
Expand All @@ -77,10 +89,6 @@ public void testWindowsEncode() throws Exception {
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
Expand Down

0 comments on commit 54e2632

Please sign in to comment.