Commit 6d1ca6c4 authored by Maxime Sinclair's avatar Maxime Sinclair
Browse files

Check the content of the SVG

parent f34d9ca3
......@@ -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
......@@ -22,5 +24,30 @@ public class TestSVG extends WebappTestCase {
assertTrue( diagramLen > 1000);
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);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment