Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package adventure;
- import items.Hook;
- import items.Rock;
- 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.*;
- import textgame.Item;
- /**
- *
- * @author anti
- */
- public class BackpackImplTest {
- public BackpackImplTest() {
- }
- @BeforeClass
- public static void setUpClass() throws Exception {
- }
- @AfterClass
- public static void tearDownClass() throws Exception {
- }
- @Before
- public void setUp() {
- }
- @After
- public void tearDown() {
- }
- /**
- * Test of add method, of class BackpackImpl.
- */
- @Test
- public void testAdd() {
- System.out.println("add");
- Item item = new Rock();
- BackpackImpl instance = new BackpackImpl(4);
- boolean expResult = true;
- boolean result = instance.add(item);
- assertEquals(expResult, result);
- for(int i = 0; i < instance.getCapacity(); i++)
- {
- result = instance.add(item);
- assertEquals(expResult, result);
- }
- result = instance.add(item);
- expResult = false;
- assertEquals(expResult, result);
- }
- /**
- * Test of remove method, of class BackpackImpl.
- */
- @Test
- public void testRemove() {
- System.out.println("remove");
- String string = "hak";
- BackpackImpl instance = new BackpackImpl(4);
- Item item = new Hook();
- instance.add(item);
- Item result = instance.remove(string);
- assertNotNull(result);
- }
- }
Add Comment
Please, Sign In to add comment