Forráskód Böngészése

new Test Class for Canvas Controller

Teh-Hai Julian Zheng 8 éve
szülő
commit
116d123781

+ 5 - 0
src/tests/praktikumHolonsTestCanvasController.java

@@ -0,0 +1,5 @@
+package tests;
+
+public class praktikumHolonsTestCanvasController {
+
+}

+ 5 - 9
src/tests/praktiumHolonTestCategoryController.java → src/tests/praktikumHolonsTestCategoryController.java

@@ -5,27 +5,23 @@ import static org.junit.Assert.*;
 import org.junit.Before;
 import org.junit.Test;
 
-import com.sun.xml.internal.ws.policy.spi.AssertionCreationException;
-
 import classes.HolonObject;
-import classes.HolonSwitch;
 import ui.controller.CategoryController;
 import ui.controller.MultiPurposeController;
 import ui.model.Model;
-import classes.Category;
 
 
 
-public class praktiumHolonTestCategoryController {
+public class praktikumHolonsTestCategoryController {
 
-	protected praktiumHolonTestCategoryController adapter;
+	protected praktikumHolonsTestCategoryController adapter;
 	protected Model model;
 	protected MultiPurposeController mp;
 	protected CategoryController controller;
 	
 	@Before
 	public void setUp() {
-		adapter = new praktiumHolonTestCategoryController();
+		adapter = new praktikumHolonsTestCategoryController();
 		model = new Model();
 		mp = new MultiPurposeController(model);
 		controller = new CategoryController(model, mp);
@@ -37,8 +33,8 @@ public class praktiumHolonTestCategoryController {
 		assertTrue("Number of Categories is not 3", model.getCategories().size() == 3);
 		assertTrue("Second Category is not Building", model.getCategories().get(1).getName().equals("Building"));
 		assertTrue("Category Building is Empty", !model.getCategories().get(1).getObjects().isEmpty());
-		assertEquals("Object is not a Power Plant", model.getCategories().get(0).getObjects().get(0).getObjName(), "Power Plant");
-		assertFalse("A Switch should not be a Holon Object", model.getCategories().get(2).getObjects().get(1) instanceof HolonObject);
+		assertEquals("Object is not a Power Plant", mp.searchCategory("Energy").getObjects().get(0).getObjName(), "Power Plant");
+		assertFalse("A Switch should not be a Holon Object", mp.searchCategoryObject(mp.searchCategory("Component"), "Switch") instanceof HolonObject);
 	}
 	
 	@Test