|
@@ -11,6 +11,9 @@ import org.junit.Test;
|
|
|
|
|
|
public class PraktikumHolonsTestClasses {
|
|
public class PraktikumHolonsTestClasses {
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for the Category Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testCategory() {
|
|
public void testCategory() {
|
|
Category test1 = new Category("Test1");
|
|
Category test1 = new Category("Test1");
|
|
@@ -35,6 +38,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("Shoud not be empty", !arr.isEmpty());
|
|
assertTrue("Shoud not be empty", !arr.isEmpty());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for the HolonObject Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonObject() {
|
|
public void testHolonObject() {
|
|
|
|
|
|
@@ -42,9 +48,7 @@ public class PraktikumHolonsTestClasses {
|
|
HolonObject test2 = new HolonObject("Test2");
|
|
HolonObject test2 = new HolonObject("Test2");
|
|
HolonObject test3 = new HolonObject(test1);
|
|
HolonObject test3 = new HolonObject(test1);
|
|
HolonElement ele = new HolonElement("Element", 1, 10);
|
|
HolonElement ele = new HolonElement("Element", 1, 10);
|
|
-
|
|
|
|
ArrayList<HolonElement> arr = new ArrayList<>();
|
|
ArrayList<HolonElement> arr = new ArrayList<>();
|
|
-
|
|
|
|
assertTrue("Should be Empty", test1.getElements().isEmpty());
|
|
assertTrue("Should be Empty", test1.getElements().isEmpty());
|
|
test1.setElements(arr);
|
|
test1.setElements(arr);
|
|
assertTrue("Should be Empty", test1.getElements().isEmpty());
|
|
assertTrue("Should be Empty", test1.getElements().isEmpty());
|
|
@@ -61,7 +65,6 @@ public class PraktikumHolonsTestClasses {
|
|
test2.deleteElement(0);
|
|
test2.deleteElement(0);
|
|
test2.addElements(ele);
|
|
test2.addElements(ele);
|
|
assertTrue("Current Energy not corrent", test2.getCurrentEnergy() == 20);
|
|
assertTrue("Current Energy not corrent", test2.getCurrentEnergy() == 20);
|
|
-
|
|
|
|
assertTrue("Should be Empty", test3.getElements().isEmpty());
|
|
assertTrue("Should be Empty", test3.getElements().isEmpty());
|
|
test3.setElements(test2.copyElements(test2.getElements()));
|
|
test3.setElements(test2.copyElements(test2.getElements()));
|
|
assertTrue("Should be Empty", !test3.getElements().isEmpty());
|
|
assertTrue("Should be Empty", !test3.getElements().isEmpty());
|
|
@@ -86,18 +89,19 @@ public class PraktikumHolonsTestClasses {
|
|
Color color = test3.getColor();
|
|
Color color = test3.getColor();
|
|
test3.setColor(new Color(0, 255, 255));
|
|
test3.setColor(new Color(0, 255, 255));
|
|
assertTrue(color.getBlue() != test3.getColor().getBlue());
|
|
assertTrue(color.getBlue() != test3.getColor().getBlue());
|
|
-
|
|
|
|
test3.addElements(new HolonElement("Element3", 3, 50));
|
|
test3.addElements(new HolonElement("Element3", 3, 50));
|
|
test3.setState();
|
|
test3.setState();
|
|
assertTrue("Should be state 3", test3.getState() == 3);
|
|
assertTrue("Should be state 3", test3.getState() == 3);
|
|
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());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for HolonSwitch Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonSwitch() {
|
|
public void testHolonSwitch() {
|
|
HolonSwitch test1 = new HolonSwitch("Test1");
|
|
HolonSwitch test1 = new HolonSwitch("Test1");
|
|
@@ -123,6 +127,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue(test1.getGraphPoints() == test2.getGraphPoints());
|
|
assertTrue(test1.getGraphPoints() == test2.getGraphPoints());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for CpsEdge Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testCpsEdge() {
|
|
public void testCpsEdge() {
|
|
CpsNode node1 = new CpsNode("Node1");
|
|
CpsNode node1 = new CpsNode("Node1");
|
|
@@ -164,6 +171,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("Tags Empty", !edge1.getTags().isEmpty());
|
|
assertTrue("Tags Empty", !edge1.getTags().isEmpty());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for HolonElement Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testHolonElement() {
|
|
public void testHolonElement() {
|
|
HolonElement ele1 = new HolonElement("TV", 2, -20);
|
|
HolonElement ele1 = new HolonElement("TV", 2, -20);
|
|
@@ -186,6 +196,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("SAV not correct", ele3.getSav().equals("CVS"));
|
|
assertTrue("SAV not correct", ele3.getSav().equals("CVS"));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for Position Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testPosition() {
|
|
public void testPosition() {
|
|
Position pos1 = new Position(100, 200);
|
|
Position pos1 = new Position(100, 200);
|
|
@@ -196,6 +209,9 @@ public class PraktikumHolonsTestClasses {
|
|
assertTrue("not (-1,-1)", pos2.x == -1 && pos2.y == -1);
|
|
assertTrue("not (-1,-1)", pos2.x == -1 && pos2.y == -1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Tests for SubNet Class.
|
|
|
|
+ */
|
|
@Test
|
|
@Test
|
|
public void testSubNet() {
|
|
public void testSubNet() {
|
|
PraktikumHolonsAdapter adapter = new PraktikumHolonsAdapter();
|
|
PraktikumHolonsAdapter adapter = new PraktikumHolonsAdapter();
|