forked from plantuml/plantuml-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update junit test classes and there dependencies
- Loading branch information
1 parent
221af78
commit 8d5be87
Showing
20 changed files
with
700 additions
and
469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 13 additions & 11 deletions
24
src/test/java/net/sourceforge/plantuml/servlet/TestAsciiArt.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 25 additions & 18 deletions
43
src/test/java/net/sourceforge/plantuml/servlet/TestCharset.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,50 @@ | ||
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; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
|
||
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); | ||
public void testUnicodeSupport() throws IOException { | ||
final URL url = new URL(getServerUrl() + "/txt/SyfFKj2rKt3CoKnELR1Io4ZDoNdKi1S0"); | ||
final URLConnection conn = url.openConnection(); | ||
// Analyze response | ||
// Verifies the Content-Type header | ||
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType()); | ||
assertEquals( | ||
"Response content type is not TEXT PLAIN or UTF-8", | ||
"text/plain;charset=utf-8", | ||
conn.getContentType().toLowerCase() | ||
); | ||
// Get the content and verify that the interrobang unicode character is present | ||
String diagram = response.getText(); | ||
String diagram = getContentText(conn); | ||
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); | ||
public void testUnicodeInCMap() throws IOException { | ||
final URL url = new URL( | ||
getServerUrl() + | ||
"/map/AqWiAibCpYn8p2jHSCfFKeYEpYWfAR3IroylBzShpiilrqlEpzL_DBSbDfOB9Azhf-2OavcS2W00" | ||
); | ||
final URLConnection conn = url.openConnection(); | ||
// Analyze response | ||
// Verifies the Content-Type header | ||
assertEquals("Response content type is not TEXT PLAIN", "text/plain", response.getContentType()); | ||
assertEquals( | ||
"Response content type is not TEXT PLAIN or UTF-8", | ||
"text/plain;charset=utf-8", | ||
conn.getContentType().toLowerCase() | ||
); | ||
// Get the content and verify that the snow unicode character is present | ||
String map = response.getText(); | ||
String map = getContentText(conn); | ||
assertTrue("Snow unicode character is not preserved", map.contains("❄")); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 14 additions & 11 deletions
25
src/test/java/net/sourceforge/plantuml/servlet/TestEPS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
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; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
import java.util.Scanner; | ||
|
||
public class TestEPS extends WebappTestCase { | ||
|
||
/** | ||
* Verifies the generation of the EPS for the Bob -> Alice sample | ||
*/ | ||
public void testSimpleSequenceDiagram() throws Exception { | ||
WebConversation conversation = new WebConversation(); | ||
WebRequest request = new GetMethodWebRequest(getServerUrl() + "eps/" + TestUtils.SEQBOB); | ||
WebResponse response = conversation.getResource(request); | ||
public void testSimpleSequenceDiagram() throws IOException { | ||
final URL url = new URL(getServerUrl() + "/eps/" + TestUtils.SEQBOB); | ||
final URLConnection conn = url.openConnection(); | ||
// Analyze response | ||
// Verifies the Content-Type header | ||
assertEquals("Response content type is not EPS", "application/postscript", response.getContentType()); | ||
assertEquals( | ||
"Response content type is not EPS", | ||
"application/postscript", | ||
conn.getContentType().toLowerCase() | ||
); | ||
// Get the content and verify its size | ||
String diagram = response.getText(); | ||
String diagram = getContentText(conn); | ||
int diagramLen = diagram.length(); | ||
assertTrue(diagramLen > 10000); | ||
assertTrue(diagramLen < 12000); | ||
} | ||
|
||
} |
Oops, something went wrong.