@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); }
@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); }