Пример #1
0
 /**
  * @param gameFile
  * @throws TegRequestException
  */
 @Test
 public void testExchanges() throws TegRequestException {
   Iterator<PlayerRequest> it = _save.iterator(_g);
   while (it.hasNext()) {
     PlayerRequest req = it.next();
     int exchangesBefore = -1;
     if (req instanceof ExchangeCards)
       exchangesBefore = _g.getExchangesPerformed(_g.getPlayer(req.getOwner()));
     req.perform(_g);
     if (exchangesBefore > -1) {
       Assert.assertEquals(
           "exchange amount should be updated",
           exchangesBefore + 1,
           _g.getExchangesPerformed(_g.getPlayer(req.getOwner())));
     }
   }
 }
Пример #2
0
 /**
  * @param gameFile
  * @throws TegRequestException
  */
 @Test
 public void testCountriesOk() throws TegRequestException {
   int reqNum = 0;
   Iterator<PlayerRequest> it = _save.iterator(_g);
   while (it.hasNext()) {
     PlayerRequest req = it.next();
     if (_g.getState().atLeast(GameState.FIRST_PUT)) {
       for (Country c : _g.getBoard().getCountries()) {
         if (_g.getOwner(c) == null || _g.getArmies(c) < 1)
           Assert.fail(
               "#"
                   + reqNum
                   + ".Country "
                   + c.getName()
                   + " is owned by "
                   + (_g.getOwner(c))
                   + " with armies "
                   + _g.getArmies(c)
                   + " at req "
                   + req);
       }
     }
     req.perform(_g);
     reqNum++;
   }
 }
Пример #3
0
 private void printBoard(TegGame g) {
   for (Country c : g.getBoard().getCountries()) {
     System.out.println(c.getName() + "|" + (g.getOwner(c)) + "|" + g.getArmies(c));
   }
 }