コード例 #1
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
 /** 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());
 }
コード例 #2
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
 /** 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);
 }
コード例 #3
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
 /** 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);
 }
コード例 #4
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
 /** 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);
 }
コード例 #5
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
  /** 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);
  }
コード例 #6
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
  /** 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);
  }
コード例 #7
0
ファイル: PlayerTest.java プロジェクト: ijtynkky/1st-and-Goal
 @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);
 }