public Tile getTileAt(Position p) {
   if (p.getRow() == 0 && p.getColumn() == 0) {
     return new StubTile(GameConstants.FOREST, 0, 0);
   }
   if (p.getRow() == 1 && p.getColumn() == 0) {
     return new StubTile(GameConstants.HILLS, 1, 0);
   }
   return new StubTile(GameConstants.PLAINS, 0, 1);
 }
 public Unit getUnitAt(Position p) {
   if (p.getRow() == 2 && p.getColumn() == 3
       || p.getRow() == 3 && p.getColumn() == 2
       || p.getRow() == 3 && p.getColumn() == 3) {
     return new StubUnit(GameConstants.ARCHER, Player.RED);
   }
   if (p.getRow() == 4 && p.getColumn() == 4) {
     return new StubUnit(GameConstants.ARCHER, Player.BLUE);
   }
   return null;
 }
  public City getCityAt(Position p) {
    if (p.getRow() == 1 && p.getColumn() == 1) {
      return new City() {
        public Player getOwner() {
          return Player.RED;
        }

        public int getSize() {
          return 1;
        }

        public String getProduction() {
          return null;
        }

        public String getWorkforceFocus() {
          return null;
        }

        @Override
        public int getTreasure() {
          // TODO Auto-generated method stub
          return 0;
        }
      };
    }
    return null;
  }
  public City getCityAt(Position p) {
    if (p.getRow() == 1 && p.getColumn() == 1) {
      return new City() {
        public Player getOwner() {
          return Player.RED;
        }

        public int getSize() {
          return 1;
        }

        public String getProduction() {
          return null;
        }

        public String getWorkforceFocus() {
          return null;
        }

        public int getProductionCount() {
          return 0;
        }
      };
    }
    return null;
  }
示例#5
0
 @Test
 public void getRowAndCol() {
   assertEquals(ROW, position.getRow());
   assertEquals(COL, position.getCol());
 }