Tests: fixed random failed test testMysteryBooster1, removed redundant logs;

This commit is contained in:
Oleg Agafonov 2020-08-26 14:20:39 +04:00
parent 8ce5c7f907
commit 6787688610
5 changed files with 1709 additions and 1710 deletions

View file

@ -407,7 +407,6 @@ public final class Main {
private static TournamentType loadTournamentType(GamePlugin plugin) {
try {
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
logger.debug("Loading tournament type: " + plugin.getClassName());
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Tournament type not found:" + plugin.getName() + " / " + plugin.getJar() + " - check plugin folder", ex);

File diff suppressed because it is too large Load diff

View file

@ -99,8 +99,6 @@ public abstract class MageTestBase {
@BeforeClass
public static void init() {
Logger.getRootLogger().setLevel(Level.DEBUG);
logger.info("Starting MAGE tests");
logger.info("Logging level: " + logger.getLevel());
deleteSavedGames();
ConfigSettings config = ConfigSettings.instance;
config.getGameTypes().forEach((gameType) -> {
@ -148,7 +146,6 @@ public abstract class MageTestBase {
private static TournamentType loadTournamentType(GamePlugin plugin) {
try {
classLoader.addURL(new File(PLUGIN_FOLDER + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading tournament type: " + plugin.getClassName());
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
@ -174,7 +171,7 @@ public abstract class MageTestBase {
protected void parseScenario(String filename) throws FileNotFoundException {
parserState = ParserState.INIT;
File f = new File(filename);
try(Scanner scanner = new Scanner(f)) {
try (Scanner scanner = new Scanner(f)) {
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
if (line == null || line.isEmpty() || line.startsWith("#")) {

View file

@ -141,7 +141,6 @@ public abstract class MageTestPlayerBase {
private static TournamentType loadTournamentType(GamePlugin plugin) {
try {
classLoader.addURL(new File(pluginFolder + '/' + plugin.getJar()).toURI().toURL());
logger.info("Loading tournament type: " + plugin.getClassName());
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).getConstructor().newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");

View file

@ -108,8 +108,9 @@ public class BoosterGenerationTest extends MageTestBase {
Assert.assertTrue("Slot 1 is white", booster.get(0).getColor(null).isWhite());
Assert.assertTrue("Slot 2 is white", booster.get(1).getColor(null).isWhite());
Assert.assertTrue("Slot 3 is blue", booster.get(2).getColor(null).isBlue());
Assert.assertTrue("Slot 4 is blue", booster.get(3).getColor(null).isBlue());
// Wretched Gryff is colorless, but stores in blue slots
Assert.assertTrue("Slot 3 is blue", booster.get(2).getName().equals("Wretched Gryff") || booster.get(2).getColor(null).isBlue());
Assert.assertTrue("Slot 4 is blue", booster.get(3).getName().equals("Wretched Gryff") || booster.get(3).getColor(null).isBlue());
Assert.assertTrue("Slot 5 is black", booster.get(4).getColor(null).isBlack());
Assert.assertTrue("Slot 6 is black", booster.get(5).getColor(null).isBlack());