package vee;
import vee.items.weapons.Sword;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;
public class InventoryTest {
public InventoryTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Testing adding an Item to the first and only, empty bag.
*/
@Test
public void testAddItemToEmptyFirstBag() {
System.out.println("Adding an Item to an empty, first bag.");
Sword s = new Sword();
Inventory inventory = new Inventory();
inventory.addBag();
boolean result = inventory.addItem(s);
boolean expResult = true;
assertEquals(expResult, result);
assertEquals(inventory.containsItem(s), true);
}
/**
* Testing adding an Item to the first and only, full bag.
*/
@Test
public void testAddItemToFullFirstBag() {
System.out.println("Adding an Item to a full, first bag.");
Sword s = new Sword();
Inventory inventory = new Inventory();
inventory.addBag(0);
boolean result = inventory.addItem(s);
boolean expResult = false;
assertEquals(expResult, result);
assertEquals(inventory.containsItem(s), false);
}
/**
* Testing adding an Item to the last, empty bag.
*/
@Test
public void testAddItemToEmptyLastBag() {
System.out.println("Adding an Item to the empty, last bag.");
Sword s = new Sword();
Inventory inventory = new Inventory();
inventory.addBag(0);
inventory.addBag(16);
boolean result = inventory.addItem(s);
boolean expResult = true;
assertEquals(expResult, result);
assertEquals(inventory.containsItem(s), true);
}
/**
* Testing adding an Item to the last, full bag.
*/
@Test
public void testAddItemToFullLastBag() {
System.out.println("Adding an Item to the full, last bag.");
Sword s = new Sword();
Inventory inventory = new Inventory();
inventory.addBag(0);
inventory.addBag(0);
boolean result = inventory.addItem(s);
boolean expResult = false;
assertEquals(expResult, result);
assertEquals(inventory.containsItem(s), false);
}
}