|
@@ -50,13 +50,13 @@ public class PraktikumHolonsTestCanvasController {
|
|
public void testAddingObjects() {
|
|
public void testAddingObjects() {
|
|
// just adding a few things
|
|
// just adding a few things
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
|
|
- HolonObject a = new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant"));
|
|
|
|
|
|
+ HolonObject a = new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant"));
|
|
a.setPosition(100, 100);
|
|
a.setPosition(100, 100);
|
|
controller.addNewObject(a);
|
|
controller.addNewObject(a);
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(1).getName().equals("Power Plant"));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(1).getName().equals("Power Plant"));
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(1) instanceof HolonObject);
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(1) instanceof HolonObject);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 1);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 1);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
/* trick drag&drop replace by moving a to 100 100 and then back to a, so
|
|
/* trick drag&drop replace by moving a to 100 100 and then back to a, so
|
|
* the rest of new objects won't know which one to replace
|
|
* the rest of new objects won't know which one to replace
|
|
*/
|
|
*/
|
|
@@ -64,27 +64,27 @@ public class PraktikumHolonsTestCanvasController {
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(2).getName().equals("Power Plant"));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(2).getName().equals("Power Plant"));
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(2) instanceof HolonObject);
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(2) instanceof HolonObject);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 2);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 2);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(3).getName().equals("Power Plant"));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(3).getName().equals("Power Plant"));
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(3) instanceof HolonObject);
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(3) instanceof HolonObject);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 3);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 3);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 4);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 4);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 5);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 5);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(6).getName().equals("House"));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(6).getName().equals("House"));
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(6) instanceof HolonObject);
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(6) instanceof HolonObject);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 6);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 6);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 7);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 7);
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 8);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 8);
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(9).getName().equals("Switch"));
|
|
assertTrue("ID of the Object does not Match", mp.searchByID(9).getName().equals("Switch"));
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(9) instanceof HolonSwitch);
|
|
assertTrue("Type of the Object does not Match", mp.searchByID(9) instanceof HolonSwitch);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 9);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 9);
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -94,16 +94,16 @@ public class PraktikumHolonsTestCanvasController {
|
|
@Test(expected = NullPointerException.class)
|
|
@Test(expected = NullPointerException.class)
|
|
public void testDeletingObject() {
|
|
public void testDeletingObject() {
|
|
// Adding Objects on Canvas.. without Coordinates
|
|
// Adding Objects on Canvas.. without Coordinates
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
+ controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
|
+ controller.addNewObject(new HolonObject((HolonObject)mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
|
+ controller.addNewObject(new HolonSwitch((HolonObject)mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
|
|
|
controller.deleteObjectOnCanvas(mp.searchByID(4));
|
|
controller.deleteObjectOnCanvas(mp.searchByID(4));
|
|
assertTrue("Object:4 was not deleted", mp.searchByID(4) == null);
|
|
assertTrue("Object:4 was not deleted", mp.searchByID(4) == null);
|