praktikumHolonsTestObjectController.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package tests;
  2. import static org.junit.Assert.assertEquals;
  3. import static org.junit.Assert.assertFalse;
  4. import static org.junit.Assert.assertTrue;
  5. import org.junit.Before;
  6. import org.junit.Test;
  7. import classes.HolonObject;
  8. import ui.controller.CategoryController;
  9. import ui.controller.MultiPurposeController;
  10. import ui.controller.ObjectController;
  11. import ui.model.Model;
  12. public class praktikumHolonsTestObjectController {
  13. protected praktikumHolonsAdapter adapter;
  14. protected Model model;
  15. protected MultiPurposeController mp;
  16. protected CategoryController cg;
  17. protected ObjectController controller;
  18. @Before
  19. public void setUp() {
  20. adapter = new praktikumHolonsAdapter();
  21. model = new Model();
  22. mp = new MultiPurposeController(model);
  23. cg = new CategoryController(model, mp);
  24. controller = new ObjectController(model, mp);
  25. }
  26. @Test
  27. public void testInitialHolonElements() {
  28. assertTrue("Number of Elements does not Match", model.getCategories().size() == 5);
  29. assertTrue("Second Category is not Building", model.getCategories().get(1).getName().equals("Building"));
  30. assertTrue("Category Building is Empty", !model.getCategories().get(1).getObjects().isEmpty());
  31. assertEquals("Object is not a Power Plant", mp.searchCategory("Energy").getObjects().get(0).getObjName(),
  32. "Power Plant");
  33. assertFalse("A Switch should not be a Holon Object",
  34. mp.searchCategoryObject(mp.searchCategory("Component"), "Switch") instanceof HolonObject);
  35. }
  36. }