|
@@ -39,51 +39,51 @@ public class praktikumHolonsTestCanvasController {
|
|
|
public void testAddingObjects() {
|
|
|
//just adding a few things
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "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("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 1);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "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("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 2);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "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("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 3);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 4);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Energy"), "Power Plant")));
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 5);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "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("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 6);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 7);
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
+ controller.addNewObject(new HolonObject(mp.searchCatObj(mp.searchCat("Building"), "House")));
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 8);
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCategoryObject(mp.searchCategory("Component"), "Switch")));
|
|
|
+ controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "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("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 9);
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCategoryObject(mp.searchCategory("Component"), "Switch")));
|
|
|
+ controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
|
|
|
assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
|
|
|
}
|
|
|
|
|
|
@Test(expected = NullPointerException.class)
|
|
|
public void testDeletingObject() {
|
|
|
// Adding Objects on Canvas.. without Coordinates
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCategoryObject(mp.searchCategory("Component"), "Switch")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Energy"), "Power Plant")));
|
|
|
- controller.addNewObject(new HolonObject(mp.searchCategoryObject(mp.searchCategory("Building"), "House")));
|
|
|
- controller.addNewObject(new HolonSwitch(mp.searchCategoryObject(mp.searchCategory("Component"), "Switch")));
|
|
|
+ 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.deleteObjectOnCanvas(mp.searchByID(4));
|
|
|
assertTrue("Object:4 was not deleted", mp.searchByID(4) == null);
|
|
@@ -128,9 +128,22 @@ public class praktikumHolonsTestCanvasController {
|
|
|
assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
|
|
|
|
|
|
//here starts the deleting
|
|
|
- controller.removeEdgesOnCanvas(mp.searchCpsEdge(13, 14));
|
|
|
+ controller.removeEdgesOnCanvas(mp.searchEdge(13, 14));
|
|
|
assertTrue("Number of Connection of Vertice M does not Match", mp.searchByID(13).getConnections().size() == model.getObjectsOnCanvas().size() - 2);
|
|
|
- assertTrue("Edge-M-N was not deleted", mp.searchCpsEdge(13, 14) == null);
|
|
|
+ assertTrue("Edge-M-N was not deleted", mp.searchEdge(13, 14) == null);
|
|
|
|
|
|
+ controller.deleteObjectOnCanvas(mp.searchByID(13));
|
|
|
+ assertTrue("Object:13 was not deleted", mp.searchByID(13) == null);
|
|
|
+ assertTrue("Edge-A-M was not deleted", mp.searchEdge(1, 13) == null);
|
|
|
+ assertTrue("Edge-B-M was not deleted", mp.searchEdge(2, 13) == null);
|
|
|
+ assertTrue("Edge-C-M was not deleted", mp.searchEdge(3, 13) == null);
|
|
|
+ assertTrue("Edge-D-M was not deleted", mp.searchEdge(4, 13) == null);
|
|
|
+ assertTrue("Edge-E-M was not deleted", mp.searchEdge(5, 13) == null);
|
|
|
+ assertTrue("Edge-F-M was not deleted", mp.searchEdge(6, 13) == null);
|
|
|
+ assertTrue("Edge-M-O was not deleted", mp.searchEdge(13, 16) == null);
|
|
|
+ assertTrue("Edge-M-P was not deleted", mp.searchEdge(13, 17) == null);
|
|
|
+ assertTrue("Edge-M-Q was not deleted", mp.searchEdge(13, 18) == null);
|
|
|
+ assertTrue("Edge-M-R was not deleted", mp.searchEdge(13, 19) == null);
|
|
|
+ assertTrue("Edge-M-S was not deleted", mp.searchEdge(13, 20) == null);
|
|
|
}
|
|
|
}
|