update all dependencies (maven artifacts)

- PDF dependency was missing in the pom file the JDK8
  * We should think about creating a parent pom - in that case all plantuml dependencies could be in the parent pom and we would only the mantain one pom file.
    (It is also possible to drop the Java 8 support.)
  * Why do we not have any PDF tests?
- add rule to ignore version update hint with `-dev` followed by a dot and date (e.g. `0.37.0-dev.20230308`)
- migration from JUnit4 to JUnit5
This commit is contained in:
Florian
2023-05-05 17:50:02 +02:00
committed by PlantUML
parent e6566b58bd
commit e5d11fb89a
20 changed files with 435 additions and 359 deletions

View File

@@ -4,6 +4,9 @@ import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import net.sourceforge.plantuml.servlet.utils.TestUtils;
import net.sourceforge.plantuml.servlet.utils.WebappTestCase;
@@ -16,6 +19,7 @@ public class TestMap extends WebappTestCase {
* participant Bob [[http://www.yahoo.com]]
* Bob -> Alice : [[http://www.google.com]] hello
*/
@Test
public void testSimpleSequenceDiagram() throws IOException {
final URL url = new URL(
getServerUrl() +
@@ -24,30 +28,31 @@ public class TestMap extends WebappTestCase {
final URLConnection conn = url.openConnection();
// Analyze response
// Verifies the Content-Type header
assertEquals(
"Response content type is not TEXT PLAIN or UTF-8",
Assertions.assertEquals(
"text/plain;charset=utf-8",
conn.getContentType().toLowerCase()
conn.getContentType().toLowerCase(),
"Response content type is not TEXT PLAIN or UTF-8"
);
// Get the content, check its first characters and verify its size
String diagram = getContentText(conn);
assertTrue(
"Response content is not starting with <map",
diagram.startsWith("<map")
Assertions.assertTrue(
diagram.startsWith("<map"),
"Response content is not starting with <map"
);
assertTrue(
"Response content (2. line) is not starting with <area",
diagram.split("\\n", 2)[1].startsWith("<area")
Assertions.assertTrue(
diagram.split("\\n", 2)[1].startsWith("<area"),
"Response content (2. line) is not starting with <area"
);
int diagramLen = diagram.length();
assertTrue(diagramLen > 200);
assertTrue(diagramLen < 300);
Assertions.assertTrue(diagramLen > 200);
Assertions.assertTrue(diagramLen < 300);
}
/**
* Check the content of the MAP for the sequence diagram sample
* Verify structure of the area tags
*/
@Test
public void testSequenceDiagramContent() throws IOException {
final URL url = new URL(
getServerUrl() +
@@ -61,9 +66,9 @@ public class TestMap extends WebappTestCase {
// <area shape="..." id="..." href="..." ... />
// <area shape="..." id="..." href="..." ... />
// </map>
assertTrue(
"Response doesn't match shape",
map.matches("^<map id=\".+\" name=\".+\">\n(<area shape=\".+\" id=\".+\" href=\".+\".*/>\n){2}</map>\n*$")
Assertions.assertTrue(
map.matches("^<map id=\".+\" name=\".+\">\n(<area shape=\".+\" id=\".+\" href=\".+\".*/>\n){2}</map>\n*$"),
"Response doesn't match shape"
);
}
@@ -71,20 +76,21 @@ public class TestMap extends WebappTestCase {
* Check the empty MAP of a sequence diagram without link
* This test uses the simple Bob -> Alice
*/
@Test
public void testSequenceDiagramWithoutLink() throws IOException {
final URL url = new URL(getServerUrl() + "/map/" + TestUtils.SEQBOB);
final URLConnection conn = url.openConnection();
// Analyze response
// Verifies the Content-Type header
assertEquals(
"Response content type is not TEXT PLAIN or UTF-8",
Assertions.assertEquals(
"text/plain;charset=utf-8",
conn.getContentType().toLowerCase()
conn.getContentType().toLowerCase(),
"Response content type is not TEXT PLAIN or UTF-8"
);
// Get the data contained in the XML
String diagram = getContentText(conn);
int diagramLen = diagram.length();
assertEquals(0, diagramLen);
Assertions.assertEquals(0, diagramLen);
}
}