1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- package tests;
- import static org.junit.Assert.assertEquals;
- import static org.junit.Assert.assertFalse;
- import static org.junit.Assert.assertTrue;
- import org.junit.Before;
- import org.junit.Test;
- import classes.HolonObject;
- import ui.controller.CategoryController;
- import ui.controller.MultiPurposeController;
- import ui.controller.ObjectController;
- import ui.model.Model;
- public class praktikumHolonsTestObjectController {
-
- protected praktikumHolonsAdapter adapter;
- protected Model model;
- protected MultiPurposeController mp;
- protected CategoryController cg;
- protected ObjectController controller;
- @Before
- public void setUp() {
- adapter = new praktikumHolonsAdapter();
- model = new Model();
- mp = new MultiPurposeController(model);
- cg = new CategoryController(model, mp);
- controller = new ObjectController(model, mp);
- }
-
- @Test
- public void testInitialHolonElements() {
- assertTrue("Number of Elements does not Match", model.getCategories().size() == 5);
- 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", 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);
- }
- }
|