Пример #1
0
  private void assertState() {
    assertEquals(NAME, State.getPlayerName());
    assertEquals(COINS, State.getCoins());
    assertEquals(SCORE, State.getHighscore());
    assertEquals(SOUNDTRACK_VOLUME, State.getSoundtrackVolume(), StateTest.DELTA);
    assertEquals(SOUNDEFFECT_VOLUME, State.getSoundEffectVolume(), StateTest.DELTA);

    assertEquals(false, ShopItemUnlocker.getUnlockedShopItem("Andy"));
    assertEquals(true, ShopItemUnlocker.getUnlockedShopItem("Noob"));
    assertEquals(true, ShopItemUnlocker.getUnlockedShopItem("Iron Man"));
    assertEquals(true, ShopItemUnlocker.getUnlockedShopItem("Plank"));

    assertEquals(false, ShopItemUnlocker.getUnlockedShopItem("Animals"));
    assertEquals(true, ShopItemUnlocker.getUnlockedShopItem("Radioactive"));
    assertEquals(false, ShopItemUnlocker.getUnlockedShopItem("Duck Tales"));
    assertEquals(true, ShopItemUnlocker.getUnlockedShopItem("Mario"));
    assertEquals(false, ShopItemUnlocker.getUnlockedShopItem("Nyan Cat"));
    assertEquals(false, ShopItemUnlocker.getUnlockedShopItem("Shake It Off"));

    assertEquals(ShopItemLoader.loadSkinsToList().get(1), CurrentItems.getSkin());
    assertEquals(ShopItemLoader.loadSoundtracksToList().get(1), CurrentItems.getSoundtrack());

    assertEquals(false, State.isSoundtrackEnabled());
    assertEquals(false, State.isSoundEffectsEnabled());
  }
Пример #2
0
  @Test
  public void testSaveGame() {
    initState();

    Writer.saveGame(fileFolder + "saveGameWriterTest.ses");
    State.resetAll();
    Parser.loadGame(fileFolder + "saveGameWriterTest.ses");

    assertState();
  }
Пример #3
0
  private void initState() {
    ShopItemUnlocker.createUnlockedShopItemsMap();

    State.setPlayerName(NAME);
    State.setCoins(COINS);
    State.setHighscore(SCORE);
    State.setSoundtrackVolume(SOUNDTRACK_VOLUME);
    State.setSoundEffectVolume(SOUNDEFFECT_VOLUME);

    ShopItemUnlocker.setUnlockedShopItem("Iron Man", true);
    ShopItemUnlocker.setUnlockedShopItem("Plank", true);
    ShopItemUnlocker.setUnlockedShopItem("Mario", true);
    CurrentItems.setSkin(ShopItemLoader.loadSkinsToList().get(1));
    CurrentItems.setSoundtrack(ShopItemLoader.loadSoundtracksToList().get(1));
    State.setSoundtrackEnabled(false);
    State.setSoundEffectsEnabled(false);
  }