|
@@ -6,11 +6,18 @@ import static org.junit.Assert.assertTrue;
|
|
import java.awt.Color;
|
|
import java.awt.Color;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
|
-import org.junit.Before;
|
|
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Test for the Classes.
|
|
|
|
+ *
|
|
|
|
+ * @author Gruppe14
|
|
|
|
+ */
|
|
public class PraktikumHolonsTestClasses {
|
|
public class PraktikumHolonsTestClasses {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for the Categories.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testCategory() {
|
|
public void testCategory() {
|
|
Category test1 = new Category("Test1");
|
|
Category test1 = new Category("Test1");
|
|
@@ -35,6 +42,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("Shoud not be empty", !arr.isEmpty());
|
|
assertTrue("Shoud not be empty", !arr.isEmpty());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for HolonObject.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonObject() {
|
|
public void testHolonObject() {
|
|
|
|
|
|
@@ -93,11 +103,14 @@ public class PraktikumHolonsTestClasses {
|
|
test1.setState();
|
|
test1.setState();
|
|
assertTrue("Should be state 0", test1.getState() == 0);
|
|
assertTrue("Should be state 0", test1.getState() == 0);
|
|
test2.setState();
|
|
test2.setState();
|
|
-
|
|
|
|
|
|
+
|
|
test2.setBorderColor(color);
|
|
test2.setBorderColor(color);
|
|
assertTrue("Color not Same", color == test2.getBorderColor());
|
|
assertTrue("Color not Same", color == test2.getBorderColor());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for HolonSwitch.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonSwitch() {
|
|
public void testHolonSwitch() {
|
|
HolonSwitch test1 = new HolonSwitch("Test1");
|
|
HolonSwitch test1 = new HolonSwitch("Test1");
|
|
@@ -123,6 +136,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue(test1.getGraphPoints() == test2.getGraphPoints());
|
|
assertTrue(test1.getGraphPoints() == test2.getGraphPoints());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for CpsEdge.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testCpsEdge() {
|
|
public void testCpsEdge() {
|
|
CpsNode node1 = new CpsNode("Node1");
|
|
CpsNode node1 = new CpsNode("Node1");
|
|
@@ -164,6 +180,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("Tags Empty", !edge1.getTags().isEmpty());
|
|
assertTrue("Tags Empty", !edge1.getTags().isEmpty());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for HolonElement.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonElement() {
|
|
public void testHolonElement() {
|
|
HolonElement ele1 = new HolonElement("TV", 2, -20);
|
|
HolonElement ele1 = new HolonElement("TV", 2, -20);
|
|
@@ -186,16 +205,22 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("SAV not correct", ele3.getSav().equals("CVS"));
|
|
assertTrue("SAV not correct", ele3.getSav().equals("CVS"));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test for Position.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testPosition() {
|
|
public void testPosition() {
|
|
Position pos1 = new Position(100, 200);
|
|
Position pos1 = new Position(100, 200);
|
|
Position pos2 = new Position();
|
|
Position pos2 = new Position();
|
|
|
|
|
|
- assertTrue("Wront coordinates", pos1.x == 100 && pos1.y == 200);
|
|
|
|
|
|
+ assertTrue("Wrong coordinates", pos1.x == 100 && pos1.y == 200);
|
|
assertTrue("Are the Same", pos1.x != pos2.x);
|
|
assertTrue("Are the Same", pos1.x != pos2.x);
|
|
assertTrue("not (-1,-1)", pos2.x == -1 && pos2.y == -1);
|
|
assertTrue("not (-1,-1)", pos2.x == -1 && pos2.y == -1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Test SubNet.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testSubNet() {
|
|
public void testSubNet() {
|
|
PraktikumHolonsAdapter adapter = new PraktikumHolonsAdapter();
|
|
PraktikumHolonsAdapter adapter = new PraktikumHolonsAdapter();
|
|
@@ -217,15 +242,14 @@ public class PraktikumHolonsTestClasses {
|
|
sw.add(s);
|
|
sw.add(s);
|
|
edge.add(new CpsEdge(o, s));
|
|
edge.add(new CpsEdge(o, s));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
SubNet sub = new SubNet(obj, edge, sw);
|
|
SubNet sub = new SubNet(obj, edge, sw);
|
|
|
|
|
|
assertTrue("Empty", !sub.getObjects().isEmpty() && sub.getObjects().size() == 9);
|
|
assertTrue("Empty", !sub.getObjects().isEmpty() && sub.getObjects().size() == 9);
|
|
assertTrue("Empty", !sub.getSwitches().isEmpty() && sub.getSwitches().size() == 9);
|
|
assertTrue("Empty", !sub.getSwitches().isEmpty() && sub.getSwitches().size() == 9);
|
|
assertTrue("Empty", !sub.getEdges().isEmpty() && sub.getEdges().size() == 9);
|
|
assertTrue("Empty", !sub.getEdges().isEmpty() && sub.getEdges().size() == 9);
|
|
assertTrue("Wrong Obj", sub.getObjects().get(5).getObjName().equals("F"));
|
|
assertTrue("Wrong Obj", sub.getObjects().get(5).getObjName().equals("F"));
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|