1
0
mirror of https://github.com/octoleo/plantuml-server.git synced 2025-02-07 13:08:25 +00:00

[FEATURE] url parameter test case added

This commit is contained in:
Maxime Sinclair 2013-09-19 12:42:28 +02:00
parent a3bd2a1b83
commit 1cf5eb8987

View File

@ -133,4 +133,24 @@ public class TestForm extends WebappTestCase {
assertEquals(1, maps.length);
}
/**
* Verifies that when the encoded source is specified as an URL parameter
* the diagram is displayed and the source is decoded
*/
public void testUrlParameter() throws Exception {
WebConversation conversation = new WebConversation();
// Submit the request with a url parameter
WebRequest request = new GetMethodWebRequest(getServerUrl() + "form?url=" + TestUtils.SEQBOB);
WebResponse response = conversation.getResponse(request);
// Analyze response
WebForm forms[] = response.getForms();
assertEquals(2, forms.length);
// Ensure the Text field is filled
assertEquals(forms[0].getParameterValue("text"), "@startuml\nBob -> Alice : hello\n@enduml");
// Ensure the URL field is filled
assertEquals(forms[1].getParameterValue("url"), getServerUrl() + "img/" + TestUtils.SEQBOB);
// Ensure the the image is present
assertEquals(1, response.getImages().length);
}
}