PraktikumHolonsTestGlobalController.java 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package tests;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. import static org.junit.Assert.assertTrue;
  5. import java.util.ArrayList;
  6. import ui.controller.GlobalController;
  7. import ui.model.Model;
  8. /**
  9. * Test for the GlobalController.
  10. *
  11. * @author Gruppe14
  12. */
  13. public class PraktikumHolonsTestGlobalController {
  14. protected Model model;
  15. protected GlobalController controller;
  16. /**
  17. * Setup.
  18. */
  19. @Before
  20. public void setUp() {
  21. model = new Model();
  22. controller = new GlobalController(model);
  23. }
  24. /**
  25. * Test for GlobalControls.
  26. */
  27. @Test
  28. public void testGlobalControls() {
  29. int prevScale = controller.getScale();
  30. int prevScaleDiv2 = controller.getScaleDiv2();
  31. int prevNumberSav = controller.getNumbersOfSaves();
  32. boolean sim = model.getIsSimulation();
  33. int timer = model.getTimerSpeed();
  34. int it = model.getCurIteration();
  35. controller.setScale(100);
  36. controller.setNumberOfSaves(50);
  37. controller.setIsSimulation(true);
  38. controller.setTimerSpeed(2000);
  39. controller.setCurIteration(10);
  40. assertTrue("Scale was not changed", controller.getScale() != prevScale);
  41. assertTrue("ScaleDiv2 was not changed ", model.getScaleDiv2() != prevScaleDiv2);
  42. assertTrue("Number of Saves was not changed", controller.getNumbersOfSaves() != prevNumberSav);
  43. assertTrue("Simulation State was not Set", sim != model.getIsSimulation());
  44. assertTrue("Timer speed was not changed", timer != model.getTimerSpeed());
  45. assertTrue("Curr Iteration was not Set", it != model.getCurIteration());
  46. }
  47. }