Esempio n. 1
0
 /** Test of giveBall method, of class Player. Keksi miten vertaillaan booleaneita */
 @Test
 public void testGiveBall() {
   System.out.println("giveBall");
   PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
   int[] alkupaikka1 = {5, 5};
   RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
   Player qb = new Player(pManning, testiOff);
   qb.setLocation(alkupaikka1);
   Player instance = qb;
   instance.giveBall();
   System.out.println("Peytonilla on pallo " + instance.isBallCarrier());
 }
Esempio n. 2
0
 /** Test of isBallCarrier method, of class Player. */
 @Test
 public void testIsBallCarrier() {
   System.out.println("isBallCarrier");
   PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
   int[] alkupaikka1 = {5, 5};
   RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
   Player qb = new Player(pManning, testiOff);
   qb.setLocation(alkupaikka1);
   Player instance = qb;
   boolean expResult = false;
   boolean result = instance.isBallCarrier();
   assertEquals(expResult, result);
 }
Esempio n. 3
0
 /** Test of setLocation method, of class Player. */
 @Test
 public void testSetLocation() {
   System.out.println("setLocation");
   int[] location = {2, 2};
   Player instance =
       new Player(
           new PlayerInfo("String", 0, "String"),
           new RouteRunner(new int[] {1, 1}, "String", "String"));
   instance.setLocation(location);
   int[] expResult = {2, 2};
   int[] result = instance.getLocation();
   assertArrayEquals(expResult, result);
 }
Esempio n. 4
0
 /** Test of getLocation method, of class Player. */
 @Test
 public void testGetLocation() {
   System.out.println("getLocation");
   PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
   int[] alkupaikka1 = {5, 5};
   RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
   Player qb = new Player(pManning, testiOff);
   qb.setLocation(alkupaikka1);
   Player instance = qb;
   int[] expResult = new int[] {5, 5};
   int[] result = instance.getLocation();
   assertArrayEquals(expResult, result);
 }
Esempio n. 5
0
  /** Test of setPlayerStrategy method, of class Player. */
  @Test
  public void testSetPlayerStrategy() {
    System.out.println("setPlayerStrategy");

    PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
    int[] alkupaikka1 = {5, 5};
    RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
    Player qb = new Player(pManning, testiOff);
    qb.setLocation(alkupaikka1);

    PlayerStrategy strategy = new RouteRunner("666");
    Player instance = qb;
    instance.setPlayerStrategy(strategy);
  }
Esempio n. 6
0
  /** Test of playerMoved method, of class Player. */
  @Test
  public void testPlayerMoved() {
    System.out.println("playerMoved");

    PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
    int[] alkupaikka1 = {5, 5};
    RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
    Player qb = new Player(pManning, testiOff);
    qb.setLocation(alkupaikka1);

    int[] where = {6, 6};
    Player instance = qb;
    instance.playerMoved(where);
  }
Esempio n. 7
0
 @Test
 public void testTryMovePlayer9() {
   System.out.println("tryMovePlayer");
   int direction = 9;
   PlayerInfo pManning = new PlayerInfo("Peyton Manning", 18);
   int[] alkupaikka1 = {5, 5};
   RouteRunner testiOff = new RouteRunner(alkupaikka1, "879987", "Q");
   Player qb = new Player(pManning, testiOff);
   qb.setLocation(alkupaikka1);
   Player instance = qb;
   int[] expResult = {6, 6};
   int[] result = instance.tryMovePlayer(direction);
   assertArrayEquals(expResult, result);
 }