Dev: removed test data from resources to data folder;

This commit is contained in:
Oleg Agafonov 2021-10-01 14:10:39 +04:00
parent c899c332b8
commit fa70af6131
20 changed files with 51 additions and 16 deletions

View file

@ -24,7 +24,7 @@ public class ConfigFactoryTest {
@DisplayName("should fail if config is malformed")
void failOnMalformed() {
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

View file

@ -21,9 +21,9 @@ public class JsonGsonTest {
@Test
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 {
// low level parser for unknown data structor
// low level parser for unknown data structure
JsonObject json = JsonParser.parseReader(new FileReader(sampleFileName)).getAsJsonObject();
Assert.assertEquals("Unknown data", "card", json.get("object").getAsString());
JsonArray jsonFaces = json.getAsJsonArray("card_faces");

View file

@ -26,19 +26,19 @@ public class ZipFilesReadWriteTest {
@Test
public void test_Read() {
// 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());
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());
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());
// 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());
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());
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());
// reading

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class CodDeckImportTest {
@ -23,7 +25,10 @@ public class CodDeckImportTest {
};
StringBuilder errors = new StringBuilder();
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());
TestDeckChecker.checker()

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class DecDeckImportTest {
@ -19,7 +21,10 @@ public class DecDeckImportTest {
}
};
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()
.addMain("Masticore", 4)

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class DraftLogImporterTest {
@ -19,7 +21,10 @@ public class DraftLogImporterTest {
}
};
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()
.addMain("Raging Ravine", 1)

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class MtgaImporterTest {
@ -19,7 +21,10 @@ public class MtgaImporterTest {
};
StringBuilder errors = new StringBuilder();
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()
.addMain("Niv-Mizzet Reborn", 1)

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class MtgjsonDeckImportTest {
@ -21,7 +23,10 @@ public class MtgjsonDeckImportTest {
// offline deck from https://mtgjson.com/api/v5/decks/ArcaneTempo_GRN.json
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());
TestDeckChecker.checker()
.addMain("Goblin Electromancer", 4)

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class MwsDeckImportTest {
@ -19,7 +21,10 @@ public class MwsDeckImportTest {
};
StringBuilder errors = new StringBuilder();
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()
.addMain("Mutavault", 4)

View file

@ -3,6 +3,8 @@ package mage.cards.decks.importer;
import mage.cards.decks.DeckCardLists;
import org.junit.Test;
import java.nio.file.Paths;
import static org.junit.Assert.assertEquals;
public class O8dDeckImportTest {
@ -19,7 +21,10 @@ public class O8dDeckImportTest {
};
StringBuilder errors = new StringBuilder();
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()
.addMain("Forest", 1)