1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-06-15 06:32:23 +00:00

[TASK] Add a test about Unicode preservation

This commit is contained in:
Maxime Sinclair 2013-09-06 16:32:51 +02:00
parent 39eab59226
commit 7d7aa41168

View File

@ -0,0 +1,41 @@
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(""));
}
}