update junit test classes and there dependencies

This commit is contained in:
Florian
2021-10-11 12:38:37 +02:00
committed by arnaudroques
parent 221af78afc
commit 8d5be87f03
20 changed files with 700 additions and 469 deletions

View File

@@ -1,25 +1,27 @@
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 TestAsciiArt extends WebappTestCase {
/**
* Verifies the generation of the ascii art for the Bob -> Alice sample
*/
public void testSimpleSequenceDiagram() throws Exception {
WebConversation conversation = new WebConversation();
WebRequest request = new GetMethodWebRequest(getServerUrl() + "txt/" + TestUtils.SEQBOB);
WebResponse response = conversation.getResource(request);
public void testSimpleSequenceDiagram() throws IOException {
final URL url = new URL(getServerUrl() + "/txt/" + 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 and verify its size
String diagram = response.getText();
String diagram = getContentText(conn);
int diagramLen = diagram.length();
assertTrue(diagramLen > 200);
assertTrue(diagramLen < 250);