Esempio n. 1
0
  @Test
  public void testRemoveAmount() throws Exception {
    ItemPack pack = new ItemPack(TestItem.test4, 4);
    assertEquals(3, pack.removeAmount(3));
    assertEquals(1, pack.getAmount());

    assertEquals(1, pack.removeAmount(2));
    assertEquals(0, pack.getAmount());
  }
Esempio n. 2
0
  @Test
  public void testAddAmount() throws Exception {
    ItemPack pack = new ItemPack(TestItem.test4, 4);
    assertEquals(0, pack.addAmount(2));
    assertEquals(4, pack.getAmount());

    ItemPack pack2 = new ItemPack(TestItem.test4, 2);
    assertEquals(2, pack2.addAmount(2));
    assertEquals(4, pack2.getAmount());
  }