示例#1
0
  /** Test of getDeck method, of class Hero. */
  @Test
  public void testGetDeck() {
    System.out.println("getDeck");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);
    Deck expResult = testDeck;

    Deck result = testHero.getDeck();
    assertEquals(expResult, result);
  }
示例#2
0
  /** Test of setCardPlayed method, of class Hero. */
  @Test
  public void testSetCardPlayed() {
    System.out.println("setCardPlayed");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    testHero.setCardPlayed(
        new HeroCard("testname", "testFilename", "testDescription", 1, 1, 1, 1, 1) {});
    Card result = testHero.getCardPlayed();
    assertEquals(testHero.getCardPlayed(), result);
  }
示例#3
0
  /** Test of setHitPoints method, of class Hero. */
  @Test
  public void testSetHitPoints() {
    System.out.println("SetHitPoints");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);
    testHero.setHitPoints(40);

    int expResult = 40;
    int result = testHero.getHitPoints();
    assertEquals(expResult, result);
  }
示例#4
0
  /** Test of setFinished method, of class Hero. */
  @Test
  public void testSetFinished() {
    System.out.println("setFinished");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);
    testHero.setFinished(false);

    testHero.setFinished(true);

    boolean expResult = true;
    boolean result = testHero.getFinished();
    assertEquals(expResult, result);
  }
示例#5
0
  /** Test of setMinions method, of class Hero. */
  @Test
  public void testSetMinions() {
    System.out.println("setMinions");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    ArrayList<Minion> minions = new ArrayList();
    minions.add(
        new Minion(new MinionCard("testname", "testFilename", "testDescription", 1, 1, 1) {}));
    testHero.setMinions(minions);

    ArrayList<Minion> expResult = minions;
    ArrayList<Minion> result = testHero.getMinions();
    assertEquals(expResult, result);
  }
示例#6
0
  /** Test of pullCards method, of class Hero. */
  @Test
  public void testPullCards() {
    System.out.println("pullCards");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    for (int i = 0; i < 30; i++) {
      testDeck.addCard(
          new HeroCard("testname", "testFilename", "testDescription", 1, 1, 1, 1, 1) {});
    }

    testHero.pullCards();

    ArrayList<Card> result = testHero.getInHand();
    assertNotNull(result);
  }
示例#7
0
  /** Test of setNewHand method, of class Hero. */
  @Test
  public void testSetNewHand() {
    System.out.println("setNewHand");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    ArrayList<Card> cards = new ArrayList();
    cards.add(new HeroCard("testname", "testFilename", "testDescription", 1, 1, 1, 1, 1) {});
    cards.add(new HeroCard("testname", "testFilename", "testDescription", 1, 1, 1, 1, 1) {});
    cards.add(new HeroCard("testname", "testFilename", "testDescription", 1, 1, 1, 1, 1) {});
    testHero.setNewHand(cards);

    ArrayList<Card> expResult = cards;
    ArrayList<Card> result = testHero.getInHand();
    assertEquals(expResult, result);
  }
示例#8
0
  /** Test of playCard method, of class Hero. */
  @Test
  public void testPlayCardMinions() {
    System.out.println("playCard");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    MinionCard testMinionCard =
        new MinionCard("testname", "testFilename", "testDescription", 1, 1, 1) {};
    Minion testMinion = new Minion(testMinionCard);
    ArrayList minions = new ArrayList();
    minions.add(testMinion);
    minions.add(testMinion);
    testHero.setMinions(minions);

    boolean result = testHero.playCard(testMinionCard);
    assertTrue(!result);
    assertNull(testHero.getCardPlayed());
  }
示例#9
0
  /** Test of removeMinion method, of class Hero. */
  @Test
  public void testRemoveMinion() {
    System.out.println("removeMinion");
    Player testPlayer = new Player(0, "testName", 0, 0, 0, 0, 0);
    Match testMatch = new Match(testPlayer);
    Deck testDeck = new Deck();
    Hero testHero = new Hero(testMatch, testPlayer, testDeck);

    Minion testMinion =
        new Minion(new MinionCard("testname", "testFilename", "testDescription", 1, 1, 1) {});
    ArrayList minions = new ArrayList();
    minions.add(testMinion);

    testHero.setMinions(minions);

    assertEquals(minions, testHero.getMinions());
    testHero.removeMinion(testMinion);

    ArrayList heroMinions = testHero.getMinions();

    assertTrue(heroMinions.isEmpty());
  }