Package vee

Source Code of vee.CharacterTest

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/

package vee;

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 vee.enemies.Henchwoman;
import vee.items.armors.Corset;
import vee.items.armors.Doublet;
import vee.items.armors.Stilleto;
import vee.items.weapons.Sword;


public class CharacterTest {

  public CharacterTest() {
  }

  @BeforeClass
  public static void setUpClass() {
  }

  @AfterClass
  public static void tearDownClass() {
  }

  @Before
  public void setUp() {
  }

  @After
  public void tearDown() {
  }


  /**
   * Testing equipping a piece of equipment to an empty slot.
   */
  @Test
  public void testEquipToEmptySlot() {
    System.out.println("Testing equipping a piece of equipment to an empty slot");

    Corset corset = new Corset();
    Henchwoman h = new Henchwoman();
    h.inventory.addBag();

    boolean result = h.equip(corset);
    assertEquals(result, true);

  }

  /**
   * Testing equipping a piece of equipment to an already equipped slot.
   */
  @Test
  public void testEquipToAlreadyEquippedSlot() {
    System.out.println("Testing equipping a piece of equipment to an already equipped slot");

    Corset corset = new Corset();
    Doublet doublet = new Doublet();
    Henchwoman h = new Henchwoman();
    h.inventory.addBag();

    h.equip(corset);
    boolean result = h.equip(doublet);

    assertEquals(result, true);
    assertEquals(h.isEquipped(doublet), true);
    assertEquals(h.isEquipped(corset), false);


  }

  /**
   * Testing equipping over a piece of equipment with no bag causes issues.
   */
  @Test
  public void testEquipOverEquipmentWithNoBag() {
    System.out.println("Testing equipping over a piece of equipment with no bag causes issues");

    Corset corset = new Corset();
    Corset corset2 = new Corset();


    Player player = new Player();

    player.equip(corset);
    assertEquals(player.isEquipped(corset), true);

    player.equip(corset2);
    assertEquals(player.isEquipped(corset2), true);
    assertEquals(player.inInventory(corset), false);


  }

  /**
   * Testing equipping and unequipping a piece of equipment.
   */
  @Test
  public void testUnequip() {
    System.out.println("Testing equipping and unequipping a piece of equipment");

    Corset corset = new Corset();

    Henchwoman h = new Henchwoman();
    h.inventory.addBag();

    h.equip(corset);
    assertEquals(h.isEquipped(corset), true);

    h.unequip(corset);
    assertEquals(h.isEquipped(corset), false);
    assertEquals(h.inInventory(corset), true);


  }

  /**
   * Testing adding a bunch of items to the inventory returns true when
   * checking if they're in the inventory.
   */
  @Test
  public void testInInventory() {
    System.out.println("Testing truth of inventory items being contained");

    Corset corset = new Corset();
    Doublet doublet = new Doublet();
    Sword sword = new Sword();
    Stilleto stilleto = new Stilleto();
    Stilleto stilleto2 = new Stilleto();

    Henchwoman h = new Henchwoman();
    h.inventory.addBag();

    h.addToInventory(corset);
    h.addToInventory(doublet);
    h.addToInventory(sword);
    h.addToInventory(stilleto);

    assertEquals(h.inInventory(corset), true);
    assertEquals(h.inInventory(doublet), true);
    assertEquals(h.inInventory(sword), true);
    assertEquals(h.inInventory(stilleto), true);
    assertEquals(h.inInventory(stilleto2), false);

  }
}
TOP

Related Classes of vee.CharacterTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.