Browse Source

comments for momentane Tests. Namen müssen noch geändert werden

Kevin Trometer 7 years ago
parent
commit
f49bbdc594

+ 1 - 1
src/classes/HolonObject.java

@@ -102,7 +102,7 @@ public class HolonObject extends AbstractCpsObject {
 	}
 
 	/**
-	 * add an Element to the Object.
+	 * adds an Element to the Object.
 	 * 
 	 * @param element
 	 *            the Element to add

+ 9 - 9
src/tests/praktikumHolonsAdapter.java

@@ -18,8 +18,8 @@ public class praktikumHolonsAdapter {
 
 	
 	/**
-	 * Generate Sequence of Categories from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Categories from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateCategories(ArrayList<Category> arr) {
 		for (int i = 0; i < 18279; i++) {
@@ -28,8 +28,8 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Sequence of Objects from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Objects from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateObjects(ArrayList<HolonObject> arr) {
 		for (int i = 0; i < 18279; i++) {
@@ -38,8 +38,8 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Sequence of Elements from A - ZZZ
-	 * @param arr
+	 * Generate Sequence of Elements from A - ZZZ.
+	 * @param arr ArrayList of Categories
 	 */
 	public void generateElements(ArrayList<HolonElement> arr) {
 		for (int i = 0; i < 18279; i++) {
@@ -48,9 +48,9 @@ public class praktikumHolonsAdapter {
 	}
 	
 	/**
-	 * Generate Alphabetical Sequences
-	 * @param n
-	 * @return
+	 * Generate Alphabetical Sequences.
+	 * @param n Generator
+	 * @return A generated Alphabetical Sequence
 	 */
 	public String generate(int n) {
 	    char[] buf = new char[(int) floor(log(25 * (n + 1)) / log(26))];

+ 9 - 3
src/tests/praktikumHolonsTestAutoSaveController.java

@@ -25,6 +25,9 @@ public class praktikumHolonsTestAutoSaveController {
 	protected idCounter id;
 	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
 
+	/**
+	 * Setup for the test.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -40,8 +43,11 @@ public class praktikumHolonsTestAutoSaveController {
 		File file = new File(path);
 		file.mkdirs();
 	}
-	
-	public void autoSaveMinimal(){
-		
+
+	/**
+	 *  kommentar hier hin.
+	 */
+	public void autoSaveMinimal() {
+
 	}
 }

+ 30 - 18
src/tests/praktikumHolonsTestCanvasController.java

@@ -1,20 +1,20 @@
 package tests;
 
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import classes.CpsEdge;
 import classes.AbstractCpsObject;
+import classes.CpsEdge;
 import classes.HolonObject;
 import classes.HolonSwitch;
+
 import ui.controller.CanvasController;
 import ui.controller.CategoryController;
 import ui.controller.MultiPurposeController;
 import ui.model.Model;
 import ui.model.idCounter;
 
+import org.junit.Test;
+import org.junit.Before;
+import static org.junit.Assert.assertTrue;
+
 public class praktikumHolonsTestCanvasController {
 
 	protected praktikumHolonsAdapter adapter;
@@ -23,6 +23,9 @@ public class praktikumHolonsTestCanvasController {
 	protected CategoryController cg;
 	protected CanvasController controller;
 
+	/**
+	 * Setup for the tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -33,9 +36,12 @@ public class praktikumHolonsTestCanvasController {
 		idCounter.setCounter(1);
 	}
 
+	/**
+	 * Tests adding objects.
+	 */
 	@Test
 	public void testAddingObjects() {
-		//just adding a few things
+		// just adding a few things
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 0);
 		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"));
@@ -68,7 +74,9 @@ public class praktikumHolonsTestCanvasController {
 		controller.addNewObject(new HolonSwitch(mp.searchCatObj(mp.searchCat("Component"), "Switch")));
 		assertTrue("Number of Objects does not Match", model.getObjectsOnCanvas().size() == 10);
 	}
-
+	/**
+	 * Tests deleting Objects.
+	 */
 	@Test(expected = NullPointerException.class)
 	public void testDeletingObject() {
 		// Adding Objects on Canvas.. without Coordinates
@@ -97,37 +105,41 @@ public class praktikumHolonsTestCanvasController {
 		controller.deleteObjectOnCanvas(mp.searchByID(4));
 	}
 
+	/**
+	 * Tests adding and deleting Edges.
+	 */
 	@Test
 	public void testAddingAndDeletingEdges() {
-		HolonObject A = new HolonObject("A");
-		controller.addNewObject(new HolonObject(A));
+		HolonObject a = new HolonObject("A");
+		controller.addNewObject(new HolonObject(a));
 		int n = 0;
 
-		//creates vertices A - Z
+		// creates vertices A - Z
 		for (int i = 2; i < 27; i++) {
-			//adds Object on canvas
+			// adds Object on canvas
 			HolonObject temp = new HolonObject(adapter.generate(i));
 			controller.addNewObject(new HolonObject(temp));
-			//connect current vertice with all other vertices
+			// connect current vertice with all other vertices
 			for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
 				if (!cps.equals(mp.searchByID(i)))
 					controller.addEdgeOnCanvas(new CpsEdge(mp.searchByID(i), cps));
 			}
 
-			//test how many connections current vertice got
+			// test how many connections current vertice got
 			assertTrue("Number of Connections does not Match", mp.searchByID(i).getConnectedTo().size() == i - 1);
 			// some mathematical shit we got here. actually just means if its a
 			// complete graph -> all vertices connected all other vertices
 			n = model.getObjectsOnCanvas().size();
 			assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
 		}
-		//same as above
+		// same as above
 		n = model.getObjectsOnCanvas().size();
 		assertTrue("Number of Edges does not Match", model.getEdgesOnCanvas().size() == (n * (n - 1)) / 2);
-		
-		//here starts the deleting
+
+		// here starts the deleting
 		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("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.searchEdge(13, 14) == null);
 
 		controller.deleteObjectOnCanvas(mp.searchByID(13));

+ 21 - 0
src/tests/praktikumHolonsTestCategoryController.java

@@ -17,6 +17,9 @@ public class praktikumHolonsTestCategoryController {
 	protected MultiPurposeController mp;
 	protected CategoryController controller;
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -25,6 +28,9 @@ public class praktikumHolonsTestCategoryController {
 		controller = new CategoryController(model, mp);
 	}
 
+	/**
+	 * tests for the Initial Categories.
+	 */
 	@Test
 	public void testInitialCategories() {
 		assertTrue("Number of Categories is not 3", model.getCategories().size() == 3);
@@ -36,6 +42,9 @@ public class praktikumHolonsTestCategoryController {
 				mp.searchCatObj(mp.searchCat("Component"), "Switch") instanceof HolonObject);
 	}
 
+	/**
+	 * Basic tests for adding new Categories.
+	 */
 	@Test
 	public void testAddingCategoriesMinimal() {
 		controller.addNewCategory("University");
@@ -51,6 +60,9 @@ public class praktikumHolonsTestCategoryController {
 				model.getCategories().get(6).getName().equals("Energy_1"));
 	}
 
+	/**
+	 * Basic tests for deleting Categories.
+	 */
 	@Test
 	public void testDeletingCategoriesMinimal() {
 		assertTrue("Number of Categories is not 3", model.getCategories().size() == 3);
@@ -63,6 +75,9 @@ public class praktikumHolonsTestCategoryController {
 		assertTrue("1st Category was not Component", model.getCategories().get(0).getName().equals("Component"));
 	}
 
+	/**
+	 * Extended tests for adding and deleting Categories.
+	 */
 	@Test
 	public void testAddingAndDeletingCategoriesExtended() {
 		for (int i = 1; i <= 50; i++) {
@@ -92,6 +107,9 @@ public class praktikumHolonsTestCategoryController {
 		assertEquals("Category does not match", model.getCategories().get(3).getName(), "L");
 	}
 
+	/**
+	 * Basic tests for adding and deleting Objects.
+	 */
 	@Test
 	public void testAddingAndDeletingObjectsMinimal() {
 		controller.addNewHolonObject(mp.searchCat("Energy"), "Power Plant", null, "");
@@ -116,6 +134,9 @@ public class praktikumHolonsTestCategoryController {
 		assertTrue("Number of Objects in Energy is not 4", mp.searchCat("Energy").getObjects().size() == 4);
 	}
 
+	/**
+	 * Extended tests for adding and deleting Objects.
+	 */
 	@Test
 	public void testAddingAndDeletingObjectsExtended() {
 

+ 23 - 1
src/tests/praktikumHolonsTestLoadAndStoreController.java

@@ -44,6 +44,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 	protected idCounter id;
 	protected String path = System.getProperty("user.home") + "/HolonGUI/Test/";
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -60,6 +63,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		file.mkdirs();
 	}
 
+	/**
+	 * minimal tests for saving.
+	 */
 	@Test
 	public void testStoreMinimal() {
 		try {
@@ -83,6 +89,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * basic tests for saving.
+	 */
 	@Test
 	public void testStoreBasic() {
 
@@ -123,6 +132,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 
+	/**
+	 * advanced tests for saving.
+	 */
 	@Test
 	public void testStoreAdvanced() {
 
@@ -158,6 +170,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 
 	}
 
+	/**
+	 * minimal tests for loading a save file.
+	 */
 	@Test
 	public void testLoadMinimal() {
 		try {
@@ -193,6 +208,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * basic tests for loading a save file.
+	 */
 	@Test
 	public void testLoadBasic() {
 		assertTrue("Non-Existant Category Exists", mp.searchCat("J") == null);
@@ -235,6 +253,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 		}
 	}
 	
+	/**
+	 * advanced tests for loading a save file.
+	 */
 	@Test
 	public void testLoadAdvanced() {
 		
@@ -256,8 +277,9 @@ public class praktikumHolonsTestLoadAndStoreController {
 	}
 
 	/**
+	 * sets the graph points in all elements of an Object.
 	 * 
-	 * @param obj
+	 * @param obj the Object
 	 */
 	public void setGraphPoints(HolonObject obj) {
 		LinkedList<Point> list = new LinkedList<>();

+ 12 - 2
src/tests/praktikumHolonsTestObjectController.java

@@ -1,7 +1,5 @@
 package tests;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Before;
@@ -24,6 +22,9 @@ public class praktikumHolonsTestObjectController {
 	protected CanvasController cvs;
 	protected ObjectController controller;
 
+	/**
+	 * Setup for the Tests.
+	 */
 	@Before
 	public void setUp() {
 		adapter = new praktikumHolonsAdapter();
@@ -34,6 +35,9 @@ public class praktikumHolonsTestObjectController {
 		controller = new ObjectController(model, mp);
 	}
 
+	/**
+	 * Tests for the Initial HolonElements.
+	 */
 	@Test
 	public void testInitialHolonElements() {
 		assertTrue("Number of Elements does not Match",
@@ -51,6 +55,9 @@ public class praktikumHolonsTestObjectController {
 				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "") == null);
 	}
 
+	/**
+	 * Tests for adding and Deleting in Categories.
+	 */
 	@Test
 	public void testAddingAndDeletingInCategory() {
 		controller.addNewElementIntoCategoryObject("Building", "House", "A", 1, -10);
@@ -89,6 +96,9 @@ public class praktikumHolonsTestObjectController {
 				mp.searchEle((HolonObject) mp.searchCatObj(mp.searchCat("Building"), "House"), "TV") == null);
 	}
 
+	/**
+	 * Tests for Adding and Deleting Objects on the Canvas.
+	 */
 	@Test
 	public void testAddingAndDeletingInCanvas() {
 		for (int i = 0; i < 100; i++) {

+ 5 - 1
src/tests/praktikumHolonsTestSuite.java

@@ -7,7 +7,11 @@ import junit.framework.TestSuite;
 public class praktikumHolonsTestSuite {
 
 
-	//Test Suite
+	/**
+	 * Test Suite.
+	 * 
+	 * @return suite
+	 */
 	public static Test suite() {
 		TestSuite suite = new TestSuite("Tests for prakikum-holons");
 		suite.addTest(new JUnit4TestAdapter(praktikumHolonsTestCategoryController.class));