1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2025-01-03 05:00:14 +00:00

Source beautified

This commit is contained in:
Maxime Sinclair 2013-07-10 10:37:21 +02:00
parent 6d1ca6c43c
commit ded3a5578a

View File

@ -14,15 +14,15 @@ public class TestSVG extends WebappTestCase {
public void testSimpleSequenceDiagram() throws Exception { public void testSimpleSequenceDiagram() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000");
WebResponse response = conversation.getResource( request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Verifies the Content-Type header // Verifies the Content-Type header
assertEquals( "Response content type is not SVG", "image/svg+xml", response.getContentType()); assertEquals("Response content type is not SVG", "image/svg+xml", response.getContentType());
// Get the content and verify its size // Get the content and verify its size
String diagram = response.getText(); String diagram = response.getText();
int diagramLen = diagram.length(); int diagramLen = diagram.length();
assertTrue( diagramLen > 1000); assertTrue(diagramLen > 1000);
assertTrue( diagramLen < 3000); assertTrue(diagramLen < 3000);
} }
/** /**
@ -31,15 +31,14 @@ public class TestSVG extends WebappTestCase {
public void testSequenceDiagramContent() throws Exception { public void testSequenceDiagramContent() throws Exception {
WebConversation conversation = new WebConversation(); WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000"); WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000");
WebResponse response = conversation.getResource( request); WebResponse response = conversation.getResource(request);
// Analyze response // Analyze response
// Get the data contained in the XML // Get the data contained in the XML
Scanner s = new Scanner(response.getInputStream()).useDelimiter("(<([^<>]+)>)+"); Scanner s = new Scanner(response.getInputStream()).useDelimiter("(<([^<>]+)>)+");
String token; String token;
int bobCounter = 0, aliceCounter = 0; int bobCounter = 0, aliceCounter = 0;
while(s.hasNext()) { while (s.hasNext()) {
token = s.next(); token = s.next();
System.out.println("Token : " + token);
if (token.startsWith("Bob")) { if (token.startsWith("Bob")) {
bobCounter++; bobCounter++;
} }