Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading