Exemplo 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());
  }
Exemplo 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());
  }