PraktikumHolonsTestGlobalController.java 1.3 KB

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