update junit test classes and there dependencies
This commit is contained in:
@@ -1,28 +1,32 @@
|
||||
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 TestCheck extends WebappTestCase {
|
||||
|
||||
/**
|
||||
* Verifies the generation of a syntax check for the following sample:
|
||||
* Bob -> Alice : hello
|
||||
*/
|
||||
public void testCorrectSequenceDiagram() throws Exception {
|
||||
WebConversation conversation = new WebConversation();
|
||||
WebRequest request = new GetMethodWebRequest(getServerUrl()
|
||||
+ "check/" + TestUtils.SEQBOB);
|
||||
WebResponse response = conversation.getResource(request);
|
||||
public void testCorrectSequenceDiagram() throws IOException {
|
||||
final URL url = new URL(getServerUrl() + "/check/" + TestUtils.SEQBOB);
|
||||
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 character set is not UTF-8", "UTF-8", response.getCharacterSet());
|
||||
assertEquals(
|
||||
"Response content type is not TEXT PLAIN or UTF-8",
|
||||
"text/plain;charset=utf-8",
|
||||
conn.getContentType().toLowerCase()
|
||||
);
|
||||
// Get the content, check its first characters and verify its size
|
||||
String checkResult = response.getText();
|
||||
assertTrue("Response content is not starting with (2 participants)",
|
||||
checkResult.startsWith("(2 participants)"));
|
||||
String checkResult = getContentText(conn);
|
||||
assertTrue(
|
||||
"Response content is not starting with (2 participants)",
|
||||
checkResult.startsWith("(2 participants)")
|
||||
);
|
||||
int checkLen = checkResult.length();
|
||||
assertTrue(checkLen > 1);
|
||||
assertTrue(checkLen < 100);
|
||||
@@ -32,12 +36,10 @@ public class TestCheck extends WebappTestCase {
|
||||
* Check the syntax of an invalid sequence diagram :
|
||||
* Bob -
|
||||
*/
|
||||
public void testWrongDiagramSyntax() throws Exception {
|
||||
WebConversation conversation = new WebConversation();
|
||||
WebRequest request = new GetMethodWebRequest(getServerUrl() + "check/SyfFKj050000");
|
||||
WebResponse response = conversation.getResource(request);
|
||||
public void testWrongDiagramSyntax() throws IOException {
|
||||
final URL url = new URL(getServerUrl() + "/check/SyfFKj050000");
|
||||
// Analyze response
|
||||
String checkResult = response.getText();
|
||||
String checkResult = getContentText(url);
|
||||
assertTrue("Response is not an error", checkResult.startsWith("(Error)"));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user