Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
slm-fileview
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jenkins
slm-fileview
Commits
f2d5f4a8
Commit
f2d5f4a8
authored
Aug 20, 2021
by
jerrykcode
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为WebUtils.encodeUrlFileName方法添加测试用例
parent
2177aed6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
WebUtilsTests.java
server/src/test/java/cn/keking/utils/WebUtilsTests.java
+24
-0
No files found.
server/src/test/java/cn/keking/utils/WebUtilsTests.java
0 → 100644
View file @
f2d5f4a8
package
cn
.
keking
.
utils
;
import
org.junit.jupiter.api.Test
;
public
class
WebUtilsTests
{
@Test
void
encodeUrlFileNameTest
()
{
// 测试对URL中的文件名部分进行UTF-8编码
String
in
=
"https://file.keking.cn/demo/hello#0.txt"
;
String
out
=
"https://file.keking.cn/demo/hello%230.txt"
;
assert
WebUtils
.
encodeUrlFileName
(
in
).
equals
(
out
);
}
@Test
void
encodeUrlFileNameTestWithParams
()
{
// 测试对URL中的文件名部分进行UTF-8编码
// URL带参数
// 文件名"#hello&world"中的"&"应该被编码成为"%26",而?后的参数列表中的"&"不会被编码
String
in
=
"https://file.keking.cn/demo/#hello&world.txt?param0=0¶m1=1"
;
String
out
=
"https://file.keking.cn/demo/%23hello%26world.txt?param0=0¶m1=1"
;
assert
WebUtils
.
encodeUrlFileName
(
in
).
equals
(
out
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment