mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
Dev: removed test data from resources to data folder;
This commit is contained in:
parent
c899c332b8
commit
fa70af6131
20 changed files with 51 additions and 16 deletions
|
@ -24,7 +24,7 @@ public class ConfigFactoryTest {
|
||||||
@DisplayName("should fail if config is malformed")
|
@DisplayName("should fail if config is malformed")
|
||||||
void failOnMalformed() {
|
void failOnMalformed() {
|
||||||
assertThatExceptionOfType(ConfigurationException.class)
|
assertThatExceptionOfType(ConfigurationException.class)
|
||||||
.isThrownBy(() -> ConfigFactory.loadFromFile(Paths.get("src", "test", "resources", "config_error.xml").toString()));
|
.isThrownBy(() -> ConfigFactory.loadFromFile(Paths.get("src", "test", "data", "config_error.xml").toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -21,9 +21,9 @@ public class JsonGsonTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_ReadByStreamParser() {
|
public void test_ReadByStreamParser() {
|
||||||
String sampleFileName = Paths.get("src", "test", "resources", "scryfall-card.json").toString();
|
String sampleFileName = Paths.get("src", "test", "data", "scryfall-card.json").toString();
|
||||||
try {
|
try {
|
||||||
// low level parser for unknown data structor
|
// low level parser for unknown data structure
|
||||||
JsonObject json = JsonParser.parseReader(new FileReader(sampleFileName)).getAsJsonObject();
|
JsonObject json = JsonParser.parseReader(new FileReader(sampleFileName)).getAsJsonObject();
|
||||||
Assert.assertEquals("Unknown data", "card", json.get("object").getAsString());
|
Assert.assertEquals("Unknown data", "card", json.get("object").getAsString());
|
||||||
JsonArray jsonFaces = json.getAsJsonArray("card_faces");
|
JsonArray jsonFaces = json.getAsJsonArray("card_faces");
|
||||||
|
|
|
@ -26,19 +26,19 @@ public class ZipFilesReadWriteTest {
|
||||||
@Test
|
@Test
|
||||||
public void test_Read() {
|
public void test_Read() {
|
||||||
// exists
|
// exists
|
||||||
TFile fileZip = new TFile(Paths.get("src", "test", "resources", "images.zip").toString());
|
TFile fileZip = new TFile(Paths.get("src", "test", "data", "images.zip").toString());
|
||||||
Assert.assertTrue(fileZip.exists());
|
Assert.assertTrue(fileZip.exists());
|
||||||
TFile fileZipDir = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET").toString());
|
TFile fileZipDir = new TFile(Paths.get("src", "test", "data", "images.zip", "SET").toString());
|
||||||
Assert.assertTrue(fileZipDir.exists());
|
Assert.assertTrue(fileZipDir.exists());
|
||||||
TFile fileZipFile = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET", "image1.png").toString());
|
TFile fileZipFile = new TFile(Paths.get("src", "test", "data", "images.zip", "SET", "image1.png").toString());
|
||||||
Assert.assertTrue(fileZipFile.exists());
|
Assert.assertTrue(fileZipFile.exists());
|
||||||
|
|
||||||
// not exists
|
// not exists
|
||||||
TFile fileNotZip = new TFile(Paths.get("src", "test", "resources", "images-FAIL.zip").toString());
|
TFile fileNotZip = new TFile(Paths.get("src", "test", "data", "images-FAIL.zip").toString());
|
||||||
Assert.assertFalse(fileNotZip.exists());
|
Assert.assertFalse(fileNotZip.exists());
|
||||||
TFile fileNotZipDir = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET-FAIL").toString());
|
TFile fileNotZipDir = new TFile(Paths.get("src", "test", "data", "images.zip", "SET-FAIL").toString());
|
||||||
Assert.assertFalse(fileNotZipDir.exists());
|
Assert.assertFalse(fileNotZipDir.exists());
|
||||||
TFile fileNotZipFile = new TFile(Paths.get("src", "test", "resources", "images.zip", "SET", "image1-FAIL.png").toString());
|
TFile fileNotZipFile = new TFile(Paths.get("src", "test", "data", "images.zip", "SET", "image1-FAIL.png").toString());
|
||||||
Assert.assertFalse(fileNotZipFile.exists());
|
Assert.assertFalse(fileNotZipFile.exists());
|
||||||
|
|
||||||
// reading
|
// reading
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class CodDeckImportTest {
|
public class CodDeckImportTest {
|
||||||
|
@ -23,7 +25,10 @@ public class CodDeckImportTest {
|
||||||
};
|
};
|
||||||
StringBuilder errors = new StringBuilder();
|
StringBuilder errors = new StringBuilder();
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.cod", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.cod").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
assertEquals("Deck Name", deck.getName());
|
assertEquals("Deck Name", deck.getName());
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class DecDeckImportTest {
|
public class DecDeckImportTest {
|
||||||
|
@ -19,7 +21,10 @@ public class DecDeckImportTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.dec", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.dec").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Masticore", 4)
|
.addMain("Masticore", 4)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class DraftLogImporterTest {
|
public class DraftLogImporterTest {
|
||||||
|
@ -19,7 +21,10 @@ public class DraftLogImporterTest {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.draft", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.draft").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Raging Ravine", 1)
|
.addMain("Raging Ravine", 1)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class MtgaImporterTest {
|
public class MtgaImporterTest {
|
||||||
|
@ -19,7 +21,10 @@ public class MtgaImporterTest {
|
||||||
};
|
};
|
||||||
StringBuilder errors = new StringBuilder();
|
StringBuilder errors = new StringBuilder();
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.mtga", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.mtga").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Niv-Mizzet Reborn", 1)
|
.addMain("Niv-Mizzet Reborn", 1)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class MtgjsonDeckImportTest {
|
public class MtgjsonDeckImportTest {
|
||||||
|
@ -21,7 +23,10 @@ public class MtgjsonDeckImportTest {
|
||||||
|
|
||||||
// offline deck from https://mtgjson.com/api/v5/decks/ArcaneTempo_GRN.json
|
// offline deck from https://mtgjson.com/api/v5/decks/ArcaneTempo_GRN.json
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.json", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.json").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
assertEquals("Arcane Tempo", deck.getName());
|
assertEquals("Arcane Tempo", deck.getName());
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Goblin Electromancer", 4)
|
.addMain("Goblin Electromancer", 4)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class MwsDeckImportTest {
|
public class MwsDeckImportTest {
|
||||||
|
@ -19,7 +21,10 @@ public class MwsDeckImportTest {
|
||||||
};
|
};
|
||||||
StringBuilder errors = new StringBuilder();
|
StringBuilder errors = new StringBuilder();
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.mwDeck", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.mwDeck").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Mutavault", 4)
|
.addMain("Mutavault", 4)
|
||||||
|
|
|
@ -3,6 +3,8 @@ package mage.cards.decks.importer;
|
||||||
import mage.cards.decks.DeckCardLists;
|
import mage.cards.decks.DeckCardLists;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
public class O8dDeckImportTest {
|
public class O8dDeckImportTest {
|
||||||
|
@ -19,7 +21,10 @@ public class O8dDeckImportTest {
|
||||||
};
|
};
|
||||||
StringBuilder errors = new StringBuilder();
|
StringBuilder errors = new StringBuilder();
|
||||||
DeckCardLists deck = importer.importDeck(
|
DeckCardLists deck = importer.importDeck(
|
||||||
"src/test/java/mage/cards/decks/importer/samples/testdeck.o8d", errors, false);
|
Paths.get("src", "test", "data", "importer", "testdeck.o8d").toString(),
|
||||||
|
errors,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
TestDeckChecker.checker()
|
TestDeckChecker.checker()
|
||||||
.addMain("Forest", 1)
|
.addMain("Forest", 1)
|
||||||
|
|
Loading…
Reference in a new issue