Exemple #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);
 }
Exemple #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);
 }