Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
runcon
Plantuml Server
Commits
7d7aa411
Commit
7d7aa411
authored
Sep 06, 2013
by
Maxime Sinclair
Browse files
[TASK] Add a test about Unicode preservation
parent
39eab592
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/test/java/net/sourceforge/plantuml/servlet/TestCharset.java
0 → 100644
View file @
7d7aa411
package
net.sourceforge.plantuml.servlet
;
import
com.meterware.httpunit.GetMethodWebRequest
;
import
com.meterware.httpunit.WebConversation
;
import
com.meterware.httpunit.WebRequest
;
import
com.meterware.httpunit.WebResponse
;
public
class
TestCharset
extends
WebappTestCase
{
/**
* Verifies the preservation of unicode characters for the "Bob -> Alice : hell‽" sample
*/
public
void
testUnicodeSupport
()
throws
Exception
{
WebConversation
conversation
=
new
WebConversation
();
WebRequest
request
=
new
GetMethodWebRequest
(
getServerUrl
()
+
"txt/SyfFKj2rKt3CoKnELR1Io4ZDoNdKi1S0"
);
WebResponse
response
=
conversation
.
getResource
(
request
);
// Analyze response
// Verifies the Content-Type header
assertEquals
(
"Response content type is not TEXT PLAIN"
,
"text/plain"
,
response
.
getContentType
());
// Get the content and verify that the interrobang unicode character is present
String
diagram
=
response
.
getText
();
assertTrue
(
"Interrobang unicode character is not preserved"
,
diagram
.
contains
(
"‽"
));
}
/**
* Verifies the preservation of unicode characters for the "participant Bob [[http://www.snow.com/❄]]\nBob -> Alice" sample
*/
public
void
testUnicodeInCMap
()
throws
Exception
{
WebConversation
conversation
=
new
WebConversation
();
WebRequest
request
=
new
GetMethodWebRequest
(
getServerUrl
()
+
"map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00"
);
WebResponse
response
=
conversation
.
getResource
(
request
);
// Analyze response
// Verifies the Content-Type header
assertEquals
(
"Response content type is not TEXT PLAIN"
,
"text/plain"
,
response
.
getContentType
());
// Get the content and verify that the snow unicode character is present
String
map
=
response
.
getText
();
assertTrue
(
"Snow unicode character is not preserved"
,
map
.
contains
(
"❄"
));
}
}
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