Beispiel #1
0
 @Test
 public void testDiscount() {
   AbstractGame mockedGame = mock(AbstractGame.class);
   Level mockedLevel = mock(Level.class);
   when(mockedGame.getCurLevel()).thenReturn(mockedLevel);
   Shop shop = new Shop(mockedGame);
   assertTrue(shop.discount().getPrice() <= 75);
 }
Beispiel #2
0
 @Test
 public void testConstructor() {
   AbstractGame mockedGame = mock(AbstractGame.class);
   Level mockedLevel = mock(Level.class);
   when(mockedGame.getCurLevel()).thenReturn(mockedLevel);
   Shop shop = new Shop(mockedGame);
   assertEquals(shop.getGame(), mockedGame);
   assertFalse(shop.getInventory() == null);
 }
Beispiel #3
0
 /**
  * Default constructor for a Shop.
  *
  * @param game the game that the shop lives in.
  */
 public Shop(AbstractGame game) {
   this.game = game;
   inventory = new LinkedList<>();
   inventory.add(new SlowGameSpeed(80, game.getCurLevel()));
   inventory.add(new ExtraTime(50, game.getCurLevel()));
   inventory.add(new ExtraLife(150));
   inventory.add(new ImprovedSpeed(100));
   inventory.add(new DoubleWeaponItem(70));
   inventory.add(new ShopWeaponItem(100));
   inventory.add(new ShopShield(100, game));
 }