You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.4 KiB

  1. package base;
  2. import static org.junit.Assert.assertTrue;
  3. import org.junit.jupiter.api.AfterEach;
  4. import org.junit.jupiter.api.BeforeEach;
  5. import org.junit.jupiter.api.Test;
  6. import playground.Level1;
  7. import playground.Level2;
  8. import playground.Level3;
  9. import playground.Level4;
  10. /**
  11. * Tests {@link BuggyGame} for
  12. * <ol>
  13. * <li>loading correctly 4 levels {@link playground.Level1} {@link playground.Level2}
  14. * {@link playground.Level3} and {@link playground.Level4}
  15. * </ol>
  16. *
  17. *
  18. */
  19. class BuggyGameTest {
  20. BuggyGame myGame;
  21. @BeforeEach
  22. void setUp() throws Exception {
  23. myGame = new BuggyGame();
  24. }
  25. @AfterEach
  26. void tearDown() throws Exception {
  27. // nothing to do afterwards
  28. }
  29. @Test
  30. void testNumberOfLevelsIsFour() {
  31. assertTrue("levels Array has two entries", myGame.levels != null && myGame.levels.size() == 4);
  32. }
  33. @Test
  34. void testCorrectFourLevelsOrder() {
  35. assertTrue("levels Array has four entries", myGame.levels != null && myGame.levels.size() == 4);
  36. assertTrue("first level is Level1",
  37. myGame.levels.get(0).getClass().equals(new Level1().getClass()));
  38. assertTrue("second level is Level2",
  39. myGame.levels.get(1).getClass().equals(new Level2().getClass()));
  40. assertTrue("third level is Level3",
  41. myGame.levels.get(2).getClass().equals(new Level3().getClass()));
  42. assertTrue("fourth (last) level is Level4",
  43. myGame.levels.get(3).getClass().equals(new Level4().getClass()));
  44. }
  45. }