receivedElementEvents;
Interaction l;
- public void setUp() {
+ @BeforeEach
+ void setUp() {
data = new PathwayModel();
data.addListener(this);
o = new DataNode("", DataNodeType.UNDEFINED);
@@ -56,13 +63,14 @@ public void setUp() {
receivedElementEvents.clear();
}
- public void testFields() {
+ @org.junit.jupiter.api.Test
+ void fields() {
o.setCenterX(1.0);
- assertEquals("test set/get CenterX", 1.0, o.getCenterX(), 0.0001);
+ assertEquals(1.0, o.getCenterX(), 0.0001, "test set/get CenterX");
- assertEquals("Setting CenterX should generate single event", receivedElementEvents.size(), 1);
- assertEquals("test getProperty()", 1.0, o.getCenterX(), 0.0001);
+ assertEquals(1, receivedElementEvents.size(), "Setting CenterX should generate single event");
+ assertEquals(1.0, o.getCenterX(), 0.0001, "test getProperty()");
// try {
// o.setCenterX(null);
@@ -72,9 +80,9 @@ public void testFields() {
// however, you should be able to set graphRef to null
- assertNull("graphref null by default", l.getStartElementRef());
+ assertNull(l.getStartElementRef(), "graphref null by default");
l.setStartElementRef(null);
- assertNull("can set graphRef to null", l.getStartElementRef());
+ assertNull(l.getStartElementRef(), "can set graphRef to null");
}
// public void testProperties() throws IOException, ConverterException {
@@ -153,7 +161,8 @@ public void testFields() {
// assertEquals("Something other than 'World7'", o2.getPropertyEx("Hello7"));
// }
- public void testColor() {
+ @org.junit.jupiter.api.Test
+ void color() {
try {
o.setTextColor(null);
o.setBorderColor(null);
@@ -162,46 +171,49 @@ public void testColor() {
}
}
- public void testParent() {
+ @org.junit.jupiter.api.Test
+ void parent() {
// remove
data.remove(o);
- assertNull("removing object set parents null", o.getPathwayModel());
- assertEquals(received.size(), 1);
- assertEquals("Event type should be DELETED", received.get(0).getType(), PathwayModelEvent.DELETED);
+ assertNull(o.getPathwayModel(), "removing object set parents null");
+ assertEquals(1, received.size());
+ assertEquals(PathwayModelEvent.DELETED, received.get(0).getType(), "Event type should be DELETED");
// re-add
data.add(o);
- assertEquals("adding sets parent", o.getPathwayModel(), data);
- assertEquals(received.size(), 2);
- assertEquals("Event type should be ADDED", received.get(1).getType(), PathwayModelEvent.ADDED);
+ assertEquals(o.getPathwayModel(), data, "adding sets parent");
+ assertEquals(2, received.size());
+ assertEquals(PathwayModelEvent.ADDED, received.get(1).getType(), "Event type should be ADDED");
}
/**
* Test graphRef's and graphId's
*
*/
- public void testRef() {
- assertTrue("query non-existing list of ref", data.getReferringLinkableFroms(o).size() == 0);
+ @org.junit.jupiter.api.Test
+ void ref() {
+ assertEquals(0, data.getReferringLinkableFroms(o).size(), "query non-existing list of ref");
// create link
l.setStartElementRef(o);
- assertTrue("reference created", data.getReferringLinkableFroms(o).contains(l.getStartLinePoint()));
+ assertTrue(data.getReferringLinkableFroms(o).contains(l.getStartLinePoint()), "reference created");
l.setStartElementRef(null);
- assertTrue("reference removed", data.getReferringLinkableFroms(o).size() == 0);
+ assertEquals(0, data.getReferringLinkableFroms(o).size(), "reference removed");
DataNode o2 = new DataNode("", DataNodeType.UNDEFINED);
data.add(o2);
// create link in opposite order
l.setEndElementRef(o);
- assertTrue("reference created (2)", data.getReferringLinkableFroms(o).contains(l.getEndLinePoint()));
+ assertTrue(data.getReferringLinkableFroms(o).contains(l.getEndLinePoint()), "reference created (2)");
}
/**
* test that Xref and XrefWithSymbol obey the equals contract
*/
- public void testXRefEquals() {
+ @org.junit.jupiter.api.Test
+ void xRefEquals() {
if (!DataSource.fullNameExists("Affy"))
DataSourceTxt.init();
@@ -216,16 +228,16 @@ public void testXRefEquals() {
for (int i = 0; i < testList.length; ++i) {
Object refi = testList[i];
// equals must be reflexive
- assertTrue(refi.equals(refi));
+ assertEquals(refi, refi);
// never equal to null
- assertFalse(refi.equals(null));
+ assertNotEquals(null, refi);
}
for (int i = 1; i < testList.length; ++i)
for (int j = 0; j < i; ++j) {
// equals must be symmetric
Object refi = testList[i];
Object refj = testList[j];
- assertEquals("Symmetry fails for " + refj + " and " + refi, refi.equals(refj), refj.equals(refi));
+ assertEquals(refi.equals(refj), refj.equals(refi), "Symmetry fails for " + refj + " and " + refi);
// hashcode contract
if (refi.equals(refj)) {
@@ -240,13 +252,13 @@ public void testXRefEquals() {
Object refj = testList[j];
Object refk = testList[k];
if (refi.equals(refj) && refj.equals(refk)) {
- assertTrue(refk.equals(refi));
+ assertEquals(refk, refi);
}
if (refj.equals(refk) && refk.equals(refi)) {
- assertTrue(refi.equals(refj));
+ assertEquals(refi, refj);
}
if (refk.equals(refi) && refi.equals(refj)) {
- assertTrue(refk.equals(refj));
+ assertEquals(refk, refj);
}
}
}
@@ -310,22 +322,24 @@ public void testXRefEquals() {
// }
// }
- public void testRef2() {
+ @org.junit.jupiter.api.Test
+ void ref2() {
o.setElementId("1");
LinkableTo o2 = new DataNode("", DataNodeType.UNDEFINED);
// note: parent not set yet!
data.add((PathwayObject) o2); // reference should now be created
- assertNull("default endGraphRef is null", l.getEndElementRef());
+ assertNull(l.getEndElementRef(), "default endGraphRef is null");
l.setEndElementRef(o2);
- assertTrue("reference created through adding",
- data.getReferringLinkableFroms(o2).contains(l.getEndLinePoint()));
+ assertTrue(data.getReferringLinkableFroms(o2).contains(l.getEndLinePoint()),
+ "reference created through adding");
}
- public void testWrongFormat() {
+ @org.junit.jupiter.api.Test
+ void wrongFormat() {
try {
String inputFile = "test.mapp";
URL url = Thread.currentThread().getContextClassLoader().getResource(inputFile);
@@ -350,7 +364,8 @@ public void testWrongFormat() {
* Test that there is one and only one Pathway object
*
*/
- public void testMappInfo() {
+ @org.junit.jupiter.api.Test
+ void mappInfo() {
Pathway mi;
// pathway is created and set when a pathway model is first created.
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAlias.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAlias.java
index c66c58d..f0387f7 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAlias.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAlias.java
@@ -1,16 +1,14 @@
package org.pathvisio.libgpml.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
-import java.io.IOException;
-import org.junit.Before;
-import org.junit.Test;
-import org.pathvisio.libgpml.io.ConverterException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.model.type.GroupType;
@@ -20,15 +18,15 @@
* @author finterly
*
*/
-public class TestAlias {
+class TestAlias {
private PathwayModel p;
private Group g;
private DataNode d;
private DataNode alias;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
p = new PathwayModel();
g = new Group(GroupType.GROUP);
d = new DataNode("textLabel", DataNodeType.UNDEFINED);
@@ -50,7 +48,7 @@ public void setUp() throws Exception {
*
*/
@Test
- public void testRemoveAlias() {
+ void removeAlias() {
p.removeDataNode(alias);
assertNull(alias.getAliasRef());
assertNull(p.getLinkedAliases(g));
@@ -61,7 +59,7 @@ public void testRemoveAlias() {
*
*/
@Test
- public void testRemoveGroup() {
+ void removeGroup() {
p.removeGroup(g);
assertNull(alias.getAliasRef());
assertNull(p.getLinkedAliases(g));
@@ -72,7 +70,7 @@ public void testRemoveGroup() {
*
*/
@Test
- public void testWriteGPML2021() throws IOException, ConverterException {
+ void writeGPML2021() throws Exception {
File tmp = File.createTempFile("alias_testwriteGPML2021_", ".gpml");
GPML2021Writer.GPML2021WRITER.writeToXml(p, tmp, false);
System.out.println(tmp);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnchor.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnchor.java
index a000f5b..79dc179 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnchor.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnchor.java
@@ -16,24 +16,27 @@
******************************************************************************/
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.LineElement.Anchor;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
import org.pathvisio.libgpml.model.type.AnchorShapeType;
import org.pathvisio.libgpml.model.type.ArrowHeadType;
-import junit.framework.TestCase;
-
/**
* Test for {@link Anchor}.
*
* @author finterly
*/
-public class TestAnchor extends TestCase {
+class TestAnchor {
private PathwayModel p;
private Interaction i1;
@@ -42,8 +45,8 @@ public class TestAnchor extends TestCase {
/**
* Creates and adds anchor to line, line to pathwayModel.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
i1 = new Interaction();
LinePoint pt1 = i1.getLinePoints().get(0);
@@ -102,7 +105,7 @@ public void setUp() {
* Tests removing anchor.
*/
@Test
- public void testRemoveAnchor() {
+ void removeAnchor() {
// remove anchor
i1.removeAnchor(a1);
assertFalse(i1.hasAnchor(a1));
@@ -113,7 +116,7 @@ public void testRemoveAnchor() {
* Tests removing line and thus anchor.
*/
@Test
- public void testRemoveLine() {
+ void removeLine() {
p.removeInteraction(i1);
assertFalse(i1.hasAnchor(a1));
assertFalse(p.hasPathwayObject(a1));
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnnotation.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnnotation.java
index a9bf085..eb22feb 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnnotation.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestAnnotation.java
@@ -1,25 +1,26 @@
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.pathvisio.libgpml.io.ConverterException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.PathwayElement.AnnotationRef;
import org.pathvisio.libgpml.model.type.AnnotationType;
import org.pathvisio.libgpml.model.type.DataNodeType;
-import junit.framework.TestCase;
-
/**
* Tests for Annotation class.
*
* @author p70073399
*/
-public class TestAnnotation extends TestCase {
+class TestAnnotation {
private PathwayModel p;
private DataNode d1;
@@ -31,8 +32,8 @@ public class TestAnnotation extends TestCase {
/**
* Two annotationRefs (same annotation) added to a data node.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
d1 = new DataNode("d1", DataNodeType.UNDEFINED);
p.addDataNode(d1);
@@ -53,7 +54,7 @@ public void setUp() {
}
@Test
- public void testReadingOfPathwayAnnotations() throws ConverterException {
+ void readingOfPathwayAnnotations() throws Exception {
String inputFile = "example-v2013a.gpml";
URL url = Thread.currentThread().getContextClassLoader().getResource(inputFile);
File file = new File(url.getPath());
@@ -73,7 +74,7 @@ public void testReadingOfPathwayAnnotations() throws ConverterException {
* Tests for removing annotation.
*/
@Test
- public void testRemoveAnnotation() {
+ void removeAnnotation() {
System.out.println(d1.getAnnotationRefs());
System.out.println(a.getAnnotationRefs());
p.removeAnnotation(a);
@@ -88,7 +89,7 @@ public void testRemoveAnnotation() {
* model.
*/
@Test
- public void testDuplicateAnnotation() {
+ void duplicateAnnotation() {
AnnotationRef ar3 = d1.addAnnotation("value", AnnotationType.ONTOLOGY, null, null);
assertEquals(ar1.getAnnotation(), ar3.getAnnotation());
}
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCitation.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCitation.java
index 93acb7e..6368f2b 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCitation.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCitation.java
@@ -1,22 +1,25 @@
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
import org.bridgedb.DataSource;
import org.bridgedb.Xref;
import org.bridgedb.bio.DataSourceTxt;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.PathwayElement.CitationRef;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.util.XrefUtils;
-import junit.framework.TestCase;
-
/**
* For testing Citation methods
*
* @author finterly
*/
-public class TestCitation extends TestCase {
+class TestCitation {
private PathwayModel p;
private DataNode d1;
@@ -28,8 +31,8 @@ public class TestCitation extends TestCase {
/**
* Two annotationRefs (same annotation) added to a data node.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
if (!DataSource.fullNameExists("Affy"))
DataSourceTxt.init();
p = new PathwayModel();
@@ -56,7 +59,7 @@ public void setUp() {
* Tests for removing annotation.
*/
@Test
- public void testRemoveCitation() {
+ void removeCitation() {
System.out.println(d1.getCitationRefs());
System.out.println(a.getCitationRefs());
p.removeCitation(a);
@@ -71,7 +74,7 @@ public void testRemoveCitation() {
* model.
*/
@Test
- public void testDuplicateCitation() {
+ void duplicateCitation() {
Xref xref = XrefUtils.createXref("11", "ensembl");
CitationRef ar3 = d1.addCitation(xref, "urlLink");
assertEquals(ar1.getCitation(), ar3.getCitation());
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCopy.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCopy.java
index 4b96715..a5a5b69 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCopy.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestCopy.java
@@ -16,25 +16,28 @@
******************************************************************************/
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.DataNode.State;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
import org.pathvisio.libgpml.model.PathwayElement.CitationRef;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.model.type.StateType;
-import junit.framework.TestCase;
-
/**
* Test for Clone methods.
*
* @author finterly
*/
-public class TestCopy extends TestCase {
+class TestCopy {
private PathwayModel p;
private DataNode o1;
@@ -43,8 +46,8 @@ public class TestCopy extends TestCase {
private Citation c;
private Interaction i1;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
p = new PathwayModel();
// add datanode
o1 = new DataNode("o1", DataNodeType.UNDEFINED);
@@ -62,12 +65,12 @@ public void setUp() throws Exception {
i1.addAnchor(0, null);
}
-
+
/**
*
*/
@Test
- public void testClonePathway() {
+ void clonePathway() {
// link dataNode and interaction
i1.setStartElementRef(o1);
PathwayModel p2 = p.clone();
@@ -82,21 +85,21 @@ public void testClonePathway() {
// }
// assertEquals(o2.getAnchors().get(0).getPathwayModel(), p2);
}
-
+
/**
*
*/
@Test
- public void testCopyDataNode() {
+ void copyDataNode() {
CopyElement copy = o1.copy();
DataNode o2 = (DataNode) copy.getNewElement();
State s2 = o2.getStates().get(0);
assertEquals(o1, o1);
- assertFalse(o1 == o2);
+ assertNotSame(o1, o2);
assertEquals(s1.getDataNode(), o1);
assertEquals(s2.getDataNode(), o2);
- assertFalse(s1 == s2);
+ assertNotSame(s1, s2);
assertEquals(o1.getPathwayModel(), p);
assertEquals(s1.getPathwayModel(), p);
@@ -118,7 +121,7 @@ public void testCopyDataNode() {
o2.copyReferencesFrom(copy.getSourceElement());
CitationRef cr2 = o2.getCitationRefs().get(0);
Citation c2 = cr2.getCitation();
- assertEquals(c2.getUrlLink(), "String");
+ assertEquals("String", c2.getUrlLink());
assertTrue(o2.hasCitationRef(cr2));
assertTrue(p2.hasPathwayObject(c2));
@@ -128,10 +131,10 @@ public void testCopyDataNode() {
*
*/
@Test
- public void testCopyInteraction() {
+ void copyInteraction() {
Interaction o2 = (Interaction) i1.copy().getNewElement();
assertEquals(i1, i1);
- assertFalse(i1 == o2);
+ assertNotSame(i1, o2);
assertEquals(i1.getPathwayModel(), p);
assertNull(o2.getPathwayModel());
@@ -148,7 +151,7 @@ public void testCopyInteraction() {
*
*/
@Test
- public void testCopyGraphicalLine() {
+ void copyGraphicalLine() {
GraphicalLine o1 = new GraphicalLine();
p.addGraphicalLine(o1);
@@ -160,7 +163,7 @@ public void testCopyGraphicalLine() {
GraphicalLine o2 = (GraphicalLine) o1.copy().getNewElement();
assertEquals(o1, o1);
- assertFalse(o1 == o2);
+ assertNotSame(o1, o2);
assertEquals(o1.getPathwayModel(), p);
assertNull(o2.getPathwayModel());
@@ -177,14 +180,14 @@ public void testCopyGraphicalLine() {
*
*/
@Test
- public void testCopyLabel() {
+ void copyLabel() {
Label o1 = new Label("o1");
p.addLabel(o1);
Label o2 = (Label) o1.copy().getNewElement();
assertEquals(o1, o1);
- assertFalse(o1 == o2);
+ assertNotSame(o1, o2);
assertEquals(o1.getPathwayModel(), p);
assertNull(o2.getPathwayModel());
}
@@ -193,14 +196,14 @@ public void testCopyLabel() {
*
*/
@Test
- public void testCopyShape() {
+ void copyShape() {
Shape o1 = new Shape();
p.addShape(o1);
Shape o2 = (Shape) o1.copy().getNewElement();
assertEquals(o1, o1);
- assertFalse(o1 == o2);
+ assertNotSame(o1, o2);
assertEquals(o1.getPathwayModel(), p);
assertNull(o2.getPathwayModel());
}
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestElementId.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestElementId.java
index 2c7619d..a584f84 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestElementId.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestElementId.java
@@ -1,12 +1,12 @@
package org.pathvisio.libgpml.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.model.type.GroupType;
@@ -15,12 +15,12 @@
*
* @author finterly
*/
-public class TestElementId {
+class TestElementId {
private PathwayModel p;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
p = new PathwayModel();
}
@@ -28,7 +28,7 @@ public void setUp() throws Exception {
*
*/
@Test
- public void testDataNode() {
+ void dataNode() {
DataNode o = new DataNode("textLabel", DataNodeType.UNDEFINED);
assertNull(o.getElementId());
p.add(o);
@@ -41,7 +41,7 @@ public void testDataNode() {
}
@Test
- public void testInteraction() {
+ void interaction() {
Interaction o = new Interaction();
assertNull(o.getElementId());
p.add(o);
@@ -54,7 +54,7 @@ public void testInteraction() {
}
@Test
- public void testGraphicalLine() {
+ void graphicalLine() {
GraphicalLine o = new GraphicalLine();
assertNull(o.getElementId());
p.add(o);
@@ -67,7 +67,7 @@ public void testGraphicalLine() {
}
@Test
- public void testLabel() {
+ void label() {
Label o = new Label("textLabel");
assertNull(o.getElementId());
p.add(o);
@@ -80,7 +80,7 @@ public void testLabel() {
}
@Test
- public void testShape() {
+ void shape() {
Shape o = new Shape();
assertNull(o.getElementId());
p.add(o);
@@ -93,7 +93,7 @@ public void testShape() {
}
@Test
- public void testGroup() {
+ void group() {
Group o = new Group(GroupType.GROUP);
assertNull(o.getElementId());
p.add(o);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestEvidence.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestEvidence.java
index 42426ad..07cd273 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestEvidence.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestEvidence.java
@@ -1,19 +1,22 @@
package org.pathvisio.libgpml.model;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.PathwayElement.EvidenceRef;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.util.XrefUtils;
-import junit.framework.TestCase;
-
/**
* For testing Evidence methods
*
* @author finterly
*/
-public class TestEvidence extends TestCase {
+class TestEvidence {
private PathwayModel p;
private DataNode d1;
@@ -25,8 +28,8 @@ public class TestEvidence extends TestCase {
/**
* Two annotationRefs (same annotation) added to a data node.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
d1 = new DataNode("d1", DataNodeType.UNDEFINED);
p.addDataNode(d1);
@@ -51,7 +54,7 @@ public void setUp() {
* Tests for removing annotation.
*/
@Test
- public void testRemoveEvidence() {
+ void removeEvidence() {
System.out.println(d1.getEvidenceRefs());
System.out.println(a.getEvidenceRefs());
p.removeEvidence(a);
@@ -66,7 +69,7 @@ public void testRemoveEvidence() {
* model.
*/
@Test
- public void testDuplicateEvidence() {
+ void duplicateEvidence() {
EvidenceRef ar3 = d1.addEvidence("value", XrefUtils.createXref("123", "doid"), "urlLink");
assertEquals(ar1.getEvidence(), ar3.getEvidence());
}
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraph.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraph.java
index c483da7..fb768a5 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraph.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraph.java
@@ -16,27 +16,30 @@
******************************************************************************/
package org.pathvisio.libgpml.model;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
import org.pathvisio.libgpml.model.type.DataNodeType;
-import junit.framework.TestCase;
-
/**
* Test graph properties of a pathway model.
*
* @author unknown
*/
-public class TestGraph extends TestCase {
+class TestGraph {
PathwayModel p;
Interaction l;
DataNode n1, n2;
LinePoint start, end;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
l = new Interaction();
@@ -70,7 +73,7 @@ public void setUp() {
* that the mPoint is linked to an object or not.
*/
@Test
- public void testRelative() {
+ void relative() {
assertFalse(start.isRelative());
assertFalse(end.isRelative());
@@ -101,7 +104,7 @@ public void testRelative() {
* properly unlinked.
*/
@Test
- public void testRemove() {
+ void remove() {
assertFalse(start.isRelative());
assertEquals(11.0, start.getX(), 0.01);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraphLink.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraphLink.java
index 80e6a68..328dd3c 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraphLink.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGraphLink.java
@@ -1,16 +1,17 @@
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.LineElement.Anchor;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
import org.pathvisio.libgpml.model.type.DataNodeType;
-import junit.framework.TestCase;
-
/**
* For testing methods for elementRef:
*
@@ -22,14 +23,14 @@
*
* @author finterly
*/
-public class TestGraphLink extends TestCase {
+class TestGraphLink {
private PathwayModel p;
private Interaction i;
private Interaction i2;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
i = new Interaction();
i2 = new Interaction();
@@ -60,7 +61,7 @@ public void setUp() {
*
*/
@Test
- public void testLinkToShapedElement() {
+ void linkToShapedElement() {
DataNode d1 = new DataNode("d", DataNodeType.METABOLITE);
p.addDataNode(d1);
@@ -98,7 +99,7 @@ public void testLinkToShapedElement() {
*
*/
@Test
- public void testLinkToAnchor() {
+ void linkToAnchor() {
// adds anchor to interaction i2
Anchor a = i2.addAnchor(0.5, null);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroup.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroup.java
index 2478d3e..20f6741 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroup.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroup.java
@@ -1,19 +1,24 @@
package org.pathvisio.libgpml.model;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.DataNode.State;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.model.type.GroupType;
-import junit.framework.TestCase;
-
/**
* Test for {@link Group}.
*
* @author finterly
*/
-public class TestGroup extends TestCase {
+class TestGroup {
PathwayModel p;
Group g1;
@@ -25,8 +30,8 @@ public class TestGroup extends TestCase {
/**
* Creates and adds anchor to line, line to pathwayModel.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
g1 = new Group(GroupType.GROUP);
@@ -82,7 +87,7 @@ public void setUp() {
*
*/
@Test
- public void testRemoveDataNode() {
+ void removeDataNode() {
// terminates data node and empty group
p.removeDataNode(d1);
assertFalse(p.hasPathwayObject(g1));
@@ -112,7 +117,7 @@ public void testRemoveDataNode() {
*
*/
@Test
- public void testRemoveDataNodeFromGroup() {
+ void removeDataNodeFromGroup() {
// removes data node from group, terminates group, data node remains
g1.removePathwayElement(d1);
@@ -156,7 +161,7 @@ public void testRemoveDataNodeFromGroup() {
*
*/
@Test
- public void testRemoveGroup() {
+ void removeGroup() {
// terminates group, data nodes remain
p.removeGroup(g1);
assertFalse(p.hasPathwayObject(g1));
@@ -186,7 +191,7 @@ public void testRemoveGroup() {
*
*/
@Test
- public void testSwitchGroup() {
+ void switchGroup() {
d1.setGroupRefTo(g2);
assertFalse(p.hasPathwayObject(g1));
assertTrue(p.hasPathwayObject(g2));
@@ -213,7 +218,7 @@ public void testSwitchGroup() {
* @author unknown, finterly
*/
@Test
- public void testUngroup() {
+ void ungroup() {
PathwayModel pwy = new PathwayModel();
Interaction line = new Interaction(null);
Group group = new Group(null);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroupNested.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroupNested.java
index 2e81022..ad1899e 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroupNested.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestGroupNested.java
@@ -1,22 +1,23 @@
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.File;
-import java.io.IOException;
-import org.junit.Before;
-import org.junit.Test;
-import org.pathvisio.libgpml.io.ConverterException;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.model.type.GroupType;
-import junit.framework.TestCase;
-
/**
* Tests for nested {@link Group}(s).
*
* @author finterly
*/
-public class TestGroupNested extends TestCase {
+class TestGroupNested {
PathwayModel p;
Group g1;
@@ -28,8 +29,8 @@ public class TestGroupNested extends TestCase {
/**
* Creates and adds anchor to line, line to pathwayModel.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
g1 = new Group(GroupType.GROUP);
@@ -76,7 +77,7 @@ public void setUp() {
*
*/
@Test
- public void testRemoveDataNode() {
+ void removeDataNode() {
// terminates data node and g1
p.removeDataNode(d1);
assertFalse(p.hasPathwayObject(g1));
@@ -108,7 +109,7 @@ public void testRemoveDataNode() {
*
*/
@Test
- public void testRemoveDataNode2() {
+ void removeDataNode2() {
// terminates data node, group remains
p.removeDataNode(d2);
assertTrue(p.hasPathwayObject(g2));
@@ -130,7 +131,7 @@ public void testRemoveDataNode2() {
*
*/
@Test
- public void testRemoveDataNodeFromGroup() {
+ void removeDataNodeFromGroup() {
// removes data node from group, terminates group, data node remains
g1.removePathwayElement(d1);
@@ -176,7 +177,7 @@ public void testRemoveDataNodeFromGroup() {
*
*/
@Test
- public void testRemoveGroup() {
+ void removeGroup() {
// terminates group, data nodes remain
p.removeGroup(g1);
assertFalse(p.hasPathwayObject(g1));
@@ -208,7 +209,7 @@ public void testRemoveGroup() {
*
*/
@Test
- public void testSwitchGroup() {
+ void switchGroup() {
d1.setGroupRefTo(g2);
assertFalse(p.hasPathwayObject(g1));
assertTrue(p.hasPathwayObject(g2));
@@ -234,7 +235,7 @@ public void testSwitchGroup() {
*
*/
@Test
- public void testWriteGPML2021() throws IOException, ConverterException {
+ void writeGPML2021() throws Exception {
File tmp = File.createTempFile("group_nested_testwriteGPML2021_", ".gpml");
GPML2021Writer.GPML2021WRITER.writeToXml(p, tmp, false);
System.out.println(tmp);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestLinePoint.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestLinePoint.java
index 6268eaf..589778a 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestLinePoint.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestLinePoint.java
@@ -16,21 +16,24 @@
******************************************************************************/
package org.pathvisio.libgpml.model;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
-import junit.framework.TestCase;
-
/**
* Test for {@link LinePoint}.
*
* @author finterly
*/
-public class TestLinePoint extends TestCase {
+class TestLinePoint {
private PathwayModel p;
private Interaction i1;
@@ -40,8 +43,8 @@ public class TestLinePoint extends TestCase {
/**
* Creates and adds anchor to line, line to pathwayModel.
*/
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
p = new PathwayModel();
i1 = new Interaction();
LinePoint pt1 = i1.getLinePoints().get(0);
@@ -88,7 +91,7 @@ public void setUp() {
* Tests removing line and thus anchor.
*/
@Test
- public void testRemoveLine() {
+ void removeLine() {
p.removeInteraction(i1);
assertFalse(p.hasPathwayObject(i1));
assertFalse(p.hasPathwayObject(pt3));
@@ -99,7 +102,7 @@ public void testRemoveLine() {
* Tests calling setLinePoints() before adding line to pathway model.
*/
@Test
- public void testSetLinePoints() {
+ void setLinePoints() {
PathwayModel p = new PathwayModel();
GraphicalLine i1 = new GraphicalLine();
LinePoint pt1 = i1.getLinePoints().get(0);
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestReferenceable.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestReferenceable.java
index d747926..b32eeb1 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestReferenceable.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestReferenceable.java
@@ -1,7 +1,13 @@
package org.pathvisio.libgpml.model;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.PathwayElement.AnnotationRef;
import org.pathvisio.libgpml.model.PathwayElement.CitationRef;
import org.pathvisio.libgpml.model.PathwayElement.EvidenceRef;
@@ -12,8 +18,6 @@
import org.pathvisio.libgpml.model.type.DataNodeType;
import org.pathvisio.libgpml.util.XrefUtils;
-import junit.framework.TestCase;
-
/**
* Tests for {@link Referenceable}:
*
@@ -28,7 +32,7 @@
*
* @author finterly
*/
-public class TestReferenceable extends TestCase {
+class TestReferenceable {
private PathwayModel p;
private DataNode d1;
@@ -45,8 +49,8 @@ public class TestReferenceable extends TestCase {
private CitationRef cr2;
private EvidenceRef er2;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
p = new PathwayModel();
d1 = new DataNode("d1", DataNodeType.UNDEFINED); // instantiate dataNode
p.addDataNode(d1); // add datanode to pathway model
@@ -68,7 +72,7 @@ public void setUp() throws Exception {
}
@Test
- public void testCheckSetUp() {
+ void checkSetUp() {
// pathway model has objects
assertTrue(p.hasPathwayObject(d1));
assertTrue(p.hasPathwayObject(a1));
@@ -112,7 +116,7 @@ public void testCheckSetUp() {
}
@Test
- public void testRemoveAnnotation() {
+ void removeAnnotation() {
p.removeAnnotation(a1);
// pathway model has objects
@@ -154,7 +158,7 @@ public void testRemoveAnnotation() {
}
@Test
- public void testRemoveAnnotationRef() {
+ void removeAnnotationRef() {
d1.removeAnnotationRef(ar1);
// pathway model has objects
@@ -197,7 +201,7 @@ public void testRemoveAnnotationRef() {
}
@Test
- public void testRemoveDataNode() {
+ void removeDataNode() {
p.removeDataNode(d1);
// pathway model has objects
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestState.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestState.java
index 72798ae..93f33c9 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestState.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestState.java
@@ -16,13 +16,17 @@
******************************************************************************/
package org.pathvisio.libgpml.model;
-import org.junit.Before;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.DataNode.State;
import org.pathvisio.libgpml.model.type.DataNodeType;
-import junit.framework.TestCase;
-
/**
* Test for {@link State}.
*
@@ -35,7 +39,7 @@
*
* @author finterly
*/
-public class TestState extends TestCase {
+class TestState {
private PathwayModel p;
private DataNode d1;
@@ -43,8 +47,8 @@ public class TestState extends TestCase {
private State st2;
private State st3;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
p = new PathwayModel();
d1 = new DataNode("d1", DataNodeType.UNDEFINED);
p.addDataNode(d1);
@@ -67,7 +71,7 @@ public void setUp() throws Exception {
*
*/
@Test
- public void testRemoveState() {
+ void removeState() {
d1.removeState(st3);
assertFalse(d1.hasState(st3));
assertFalse(p.hasPathwayObject(st3));
@@ -78,7 +82,7 @@ public void testRemoveState() {
* Tests removing a data node and its effect on states.
*/
@Test
- public void testRemoveDataNode() {
+ void removeDataNode() {
p.removeDataNode(d1);
assertTrue(d1.getStates().isEmpty());
assertTrue(p.getDataNodes().isEmpty());
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestTemporary.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestTemporary.java
index 811d8c3..9d77aca 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestTemporary.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/TestTemporary.java
@@ -1,18 +1,19 @@
package org.pathvisio.libgpml.model;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
* Test for random things.
*
* @author finterly
*/
-public class TestTemporary extends TestCase {
+class TestTemporary {
/**
* Temporary place for testing various methods.
*/
- public static void testThis() {
+ @Test
+ void testThis() {
// PathwayModel p = new PathwayModel();
// Interaction line = new Interaction();
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/connector/TestSegmentedConnector.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/connector/TestSegmentedConnector.java
index 8271174..f07302b 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/connector/TestSegmentedConnector.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/connector/TestSegmentedConnector.java
@@ -16,25 +16,26 @@
******************************************************************************/
package org.pathvisio.libgpml.model.connector;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.awt.geom.Point2D;
import java.util.Arrays;
-
+import org.junit.jupiter.api.Test;
import org.pathvisio.libgpml.model.Interaction;
import org.pathvisio.libgpml.model.LineElement.LinePoint;
import org.pathvisio.libgpml.model.connector.ConnectorShape.Segment;
-import junit.framework.TestCase;
-
/**
* Test for segmented connector.
*
* @author unknown
*
*/
-public class TestSegmentedConnector extends TestCase {
-
+class TestSegmentedConnector {
+
/** test conversion to / from line coordinates */
- public void testLineCoordinates() {
+ @Test
+ void lineCoordinates() {
Interaction line = new Interaction();
LinePoint[] points = new LinePoint[] { line.new LinePoint(75.0, 125.0),
line.new LinePoint(75.0, 50.0),
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/type/TestDataNodeType.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/type/TestDataNodeType.java
index c05bf52..523cbc2 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/type/TestDataNodeType.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/model/type/TestDataNodeType.java
@@ -16,22 +16,28 @@
******************************************************************************/
package org.pathvisio.libgpml.model.type;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
* Test for extensible enum class. Tests DataNodeType as an example.
*
* @author finterly
*/
-public class TestDataNodeType extends TestCase {
+class TestDataNodeType {
/**
* For testing data node type features.
*/
- public static void testDataNodeType() {
+ @Test
+ static void dataNodeType() {
// returns "RNA"
DataNodeType rna1 = DataNodeType.register("RNA");
@@ -43,7 +49,7 @@ public static void testDataNodeType() {
// should return "Complex" in place of "comPLEX"
DataNodeType complex1 = DataNodeType.register("comPLEX");
// should both equal "Complex"
- assertEquals(complex1, DataNodeType.COMPLEX);
+ assertEquals(DataNodeType.COMPLEX, complex1);
// should add "new data node type"
DataNodeType new1 = DataNodeType.register("new data node type");
@@ -70,14 +76,15 @@ public static void testDataNodeType() {
// System.out.println(DataNodeType.getNames());
// System.out.println(rna1 == DataNodeType.RNA);
}
-
+
/**
* For testing group type features.
*/
- public static void testGroupType() {
+ @Test
+ static void groupType() {
GroupType type1 = GroupType.register("group");
assertEquals(GroupType.GROUP, type1);
- assertTrue(GroupType.GROUP == type1);
+ assertSame(GroupType.GROUP, type1);
}
}
\ No newline at end of file
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestColorUtils.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestColorUtils.java
index e2cbb11..8896ca9 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestColorUtils.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestColorUtils.java
@@ -1,20 +1,24 @@
package org.pathvisio.libgpml.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
* Tests for ColorUtils class.
*
* @author finterly
*/
-public class TestColorUtils extends TestCase {
-
- public void testHexToColorToHex() {
+class TestColorUtils {
+
+ @Test
+ void hexToColorToHex() {
// hex strings tests
List hexTests = new ArrayList(Arrays.asList("#b4b46419", "#00000000", "#ffffff"));
// color object equivalent of hex string tests
@@ -35,8 +39,9 @@ public void testHexToColorToHex() {
}
}
-
- public void testStringToColor() {
+
+ @Test
+ void stringToColor() {
// strings tests
List strTests = new ArrayList(Arrays.asList("white", "Transparent", "blue"));
// color object equivalent of hex string tests
@@ -52,8 +57,9 @@ public void testStringToColor() {
assertEquals(color.getAlpha(), colorTests.get(i).getAlpha());
}
}
-
- public void testTransparency() {
+
+ @Test
+ void transparency() {
Color color = ColorUtils.hexToColor("00000000");
Color color2 = ColorUtils.hexToColor("ffffff00");
assertTrue(ColorUtils.isTransparent(color));
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestGroupRectPropertyUtils.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestGroupRectPropertyUtils.java
index 0a38cf2..0d9c391 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestGroupRectPropertyUtils.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestGroupRectPropertyUtils.java
@@ -17,16 +17,17 @@
package org.pathvisio.libgpml.util;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
* Tests for GroupRectPropertyUtils class, the utility class for finding group bounds.
*
* @author finterly
*/
-public class TestGroupRectPropertyUtils extends TestCase {
+class TestGroupRectPropertyUtils {
- public void testGroupRectPropertyCalculation() {
+ @Test
+ void groupRectPropertyCalculation() {
// Group group = new Group();
//
diff --git a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestXrefUtils.java b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestXrefUtils.java
index 59cfa2c..ffbc018 100644
--- a/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestXrefUtils.java
+++ b/org.pathvisio.lib/src/test/java/org/pathvisio/libgpml/util/TestXrefUtils.java
@@ -1,19 +1,24 @@
package org.pathvisio.libgpml.util;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+
import org.bridgedb.DataSource;
import org.bridgedb.Xref;
import org.bridgedb.bio.DataSourceTxt;
-
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
/**
* Tests for XrefUtils class.
*
* @author finterly
*/
-public class TestXrefUtils extends TestCase {
+class TestXrefUtils {
- public void testBridgeDb() {
+ @Test
+ void bridgeDb() {
if (!DataSource.fullNameExists("Affy"))
DataSourceTxt.init();
@@ -28,14 +33,15 @@ public void testBridgeDb() {
Xref xref1 = XrefUtils.createXref("123", "doid");
- assertEquals(XrefUtils.getXrefDataSourceStr(xref1.getDataSource()), "doid");
+ assertEquals("doid", XrefUtils.getXrefDataSourceStr(xref1.getDataSource()));
}
/**
* Tests the method for checking if Xrefs are equal
*/
- public void testEquivalentXrefs() {
+ @Test
+ void equivalentXrefs() {
if (!DataSource.fullNameExists("Ensembl"))
DataSourceTxt.init();
Xref xref00 = null;