コード例 #1
0
  @SuppressWarnings("MagicNumber")
  @Test
  public void checkForCollision() {
    RoomFFA ffa = new RoomFFA("test");
    GameProfile enemy = getTestGameProfileForRoom(ffa, 125, 125, 180);
    GameProfile me = getTestGameProfileForRoom(ffa, 100, 100, 35);

    moveActionStrategy.checkCollision(me, ffa);

    assertFalse("enemy was not killed", enemy.isKilled());
    assertTrue("me should not be killed", me.isKilled());

    enemy.setIsKilled(false);
    enemy.setDirection(225);

    moveActionStrategy.checkCollision(me, ffa);
    boolean directAttack = me.isKilled() || enemy.isKilled();
    assertTrue("someone must be killed", directAttack);
  }
コード例 #2
0
  @SuppressWarnings("MagicNumber")
  @Test
  public void checkForDirectAttack() {
    RoomFFA ffa = new RoomFFA("test");
    GameProfile enemy = getTestGameProfileForRoom(ffa, 125, 125, 225);
    GameProfile me = getTestGameProfileForRoom(ffa, 100, 100, 35);

    moveActionStrategy.checkCollision(me, ffa);
    boolean directAttack = me.isKilled() || enemy.isKilled();
    assertTrue("someone must be killed", directAttack);
  }