1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2024-12-22 08:48:54 +00:00

Check the content of the SVG

This commit is contained in:
Maxime Sinclair 2013-07-10 10:08:44 +02:00
parent f34d9ca34e
commit 6d1ca6c43c

View File

@ -5,6 +5,8 @@ import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import java.util.Scanner;
public class TestSVG extends WebappTestCase {
/**
* Verifies the generation of the SVG for the Bob -> Alice sample
@ -23,4 +25,29 @@ public class TestSVG extends WebappTestCase {
assertTrue( diagramLen < 3000);
}
/**
* Check the content of the SVG
*/
public void testSequenceDiagramContent() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "svg/SyfFKj2rKt3CoKnELR1Io4ZDoSa70000");
WebResponse response = conversation.getResource( request);
// Analyze response
// Get the data contained in the XML
Scanner s = new Scanner(response.getInputStream()).useDelimiter("(<([^<>]+)>)+");
String token;
int bobCounter = 0, aliceCounter = 0;
while(s.hasNext()) {
token = s.next();
System.out.println("Token : " + token);
if (token.startsWith("Bob")) {
bobCounter++;
}
if (token.startsWith("Alice")) {
aliceCounter++;
}
}
assertTrue(bobCounter == 2);
assertTrue(aliceCounter == 2);
}
}