Tests: added checks for errors on card loading (see #4402)

This commit is contained in:
Oleg Agafonov 2018-01-12 21:10:10 +04:00
parent a63f87da2c
commit 7c2511355e
2 changed files with 33 additions and 9 deletions

View file

@ -29,10 +29,12 @@ import org.mage.test.serverside.base.CardTestAPI;
import org.mage.test.serverside.base.MageTestPlayerBase;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* API for test initialization and asserting the test results.
@ -61,11 +63,6 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
UNKNOWN
}
static {
// CardScanner.scanned = true;
CardScanner.scan();
}
/**
* Default game initialization params for red player (that plays with
* Mountains)
@ -111,6 +108,17 @@ public abstract class CardTestPlayerAPIImpl extends MageTestPlayerBase implement
addCard(Zone.LIBRARY, playerB, "Plains", 10);
}
@Before
public void checkDatabase() {
// load all cards to db from class list
ArrayList<String> errorsList = new ArrayList<>();
CardScanner.scan(errorsList);
if (errorsList.size() > 0) {
Assert.fail("Found errors on card loading: " + '\n' + errorsList.stream().collect(Collectors.joining("\n")));
}
}
@Before
public void reset() throws GameException, FileNotFoundException {
if (currentGame != null) {