From fa70af6131e6eed275997f0bdd6f3dd0146a9b8a Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 1 Oct 2021 14:10:39 +0400 Subject: [PATCH] Dev: removed test data from resources to data folder; --- .../src/test/{resources => data}/config_error.xml | 0 .../java/mage/server/util/ConfigFactoryTest.java | 2 +- Mage.Tests/src/test/{resources => data}/images.zip | Bin .../src/test/{resources => data}/scryfall-card.json | 0 .../test/java/org/mage/test/utils/JsonGsonTest.java | 4 ++-- .../org/mage/test/utils/ZipFilesReadWriteTest.java | 12 ++++++------ .../importer/samples => data/importer}/testdeck.cod | 0 .../importer/samples => data/importer}/testdeck.dec | 0 .../samples => data/importer}/testdeck.draft | 0 .../samples => data/importer}/testdeck.json | 0 .../samples => data/importer}/testdeck.mtga | 0 .../samples => data/importer}/testdeck.mwDeck | 0 .../importer/samples => data/importer}/testdeck.o8d | 0 .../cards/decks/importer/CodDeckImportTest.java | 7 ++++++- .../cards/decks/importer/DecDeckImportTest.java | 7 ++++++- .../cards/decks/importer/DraftLogImporterTest.java | 7 ++++++- .../mage/cards/decks/importer/MtgaImporterTest.java | 7 ++++++- .../cards/decks/importer/MtgjsonDeckImportTest.java | 7 ++++++- .../cards/decks/importer/MwsDeckImportTest.java | 7 ++++++- .../cards/decks/importer/O8dDeckImportTest.java | 7 ++++++- 20 files changed, 51 insertions(+), 16 deletions(-) rename Mage.Server/src/test/{resources => data}/config_error.xml (100%) rename Mage.Tests/src/test/{resources => data}/images.zip (100%) rename Mage.Tests/src/test/{resources => data}/scryfall-card.json (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.cod (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.dec (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.draft (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.json (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.mtga (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.mwDeck (100%) rename Mage/src/test/{java/mage/cards/decks/importer/samples => data/importer}/testdeck.o8d (100%) diff --git a/Mage.Server/src/test/resources/config_error.xml b/Mage.Server/src/test/data/config_error.xml similarity index 100% rename from Mage.Server/src/test/resources/config_error.xml rename to Mage.Server/src/test/data/config_error.xml diff --git a/Mage.Server/src/test/java/mage/server/util/ConfigFactoryTest.java b/Mage.Server/src/test/java/mage/server/util/ConfigFactoryTest.java index 3563287fad..c487037479 100644 --- a/Mage.Server/src/test/java/mage/server/util/ConfigFactoryTest.java +++ b/Mage.Server/src/test/java/mage/server/util/ConfigFactoryTest.java @@ -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 diff --git a/Mage.Tests/src/test/resources/images.zip b/Mage.Tests/src/test/data/images.zip similarity index 100% rename from Mage.Tests/src/test/resources/images.zip rename to Mage.Tests/src/test/data/images.zip diff --git a/Mage.Tests/src/test/resources/scryfall-card.json b/Mage.Tests/src/test/data/scryfall-card.json similarity index 100% rename from Mage.Tests/src/test/resources/scryfall-card.json rename to Mage.Tests/src/test/data/scryfall-card.json diff --git a/Mage.Tests/src/test/java/org/mage/test/utils/JsonGsonTest.java b/Mage.Tests/src/test/java/org/mage/test/utils/JsonGsonTest.java index beb358fd84..9ce4cb2f41 100644 --- a/Mage.Tests/src/test/java/org/mage/test/utils/JsonGsonTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/utils/JsonGsonTest.java @@ -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"); diff --git a/Mage.Tests/src/test/java/org/mage/test/utils/ZipFilesReadWriteTest.java b/Mage.Tests/src/test/java/org/mage/test/utils/ZipFilesReadWriteTest.java index a88497f360..f90aa7e5d9 100644 --- a/Mage.Tests/src/test/java/org/mage/test/utils/ZipFilesReadWriteTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/utils/ZipFilesReadWriteTest.java @@ -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 diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.cod b/Mage/src/test/data/importer/testdeck.cod similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.cod rename to Mage/src/test/data/importer/testdeck.cod diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.dec b/Mage/src/test/data/importer/testdeck.dec similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.dec rename to Mage/src/test/data/importer/testdeck.dec diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.draft b/Mage/src/test/data/importer/testdeck.draft similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.draft rename to Mage/src/test/data/importer/testdeck.draft diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.json b/Mage/src/test/data/importer/testdeck.json similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.json rename to Mage/src/test/data/importer/testdeck.json diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.mtga b/Mage/src/test/data/importer/testdeck.mtga similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.mtga rename to Mage/src/test/data/importer/testdeck.mtga diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.mwDeck b/Mage/src/test/data/importer/testdeck.mwDeck similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.mwDeck rename to Mage/src/test/data/importer/testdeck.mwDeck diff --git a/Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.o8d b/Mage/src/test/data/importer/testdeck.o8d similarity index 100% rename from Mage/src/test/java/mage/cards/decks/importer/samples/testdeck.o8d rename to Mage/src/test/data/importer/testdeck.o8d diff --git a/Mage/src/test/java/mage/cards/decks/importer/CodDeckImportTest.java b/Mage/src/test/java/mage/cards/decks/importer/CodDeckImportTest.java index c6ccb49714..c087b837ce 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/CodDeckImportTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/CodDeckImportTest.java @@ -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() diff --git a/Mage/src/test/java/mage/cards/decks/importer/DecDeckImportTest.java b/Mage/src/test/java/mage/cards/decks/importer/DecDeckImportTest.java index 1c7078d6ef..8dd592af01 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/DecDeckImportTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/DecDeckImportTest.java @@ -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) diff --git a/Mage/src/test/java/mage/cards/decks/importer/DraftLogImporterTest.java b/Mage/src/test/java/mage/cards/decks/importer/DraftLogImporterTest.java index 80a2ea9309..38a044e815 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/DraftLogImporterTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/DraftLogImporterTest.java @@ -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) diff --git a/Mage/src/test/java/mage/cards/decks/importer/MtgaImporterTest.java b/Mage/src/test/java/mage/cards/decks/importer/MtgaImporterTest.java index f4d186ac5c..54632b4fd6 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/MtgaImporterTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/MtgaImporterTest.java @@ -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) diff --git a/Mage/src/test/java/mage/cards/decks/importer/MtgjsonDeckImportTest.java b/Mage/src/test/java/mage/cards/decks/importer/MtgjsonDeckImportTest.java index 84bb4cb1ad..00d28cae70 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/MtgjsonDeckImportTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/MtgjsonDeckImportTest.java @@ -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) diff --git a/Mage/src/test/java/mage/cards/decks/importer/MwsDeckImportTest.java b/Mage/src/test/java/mage/cards/decks/importer/MwsDeckImportTest.java index ef2b1a96ba..f449e1f710 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/MwsDeckImportTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/MwsDeckImportTest.java @@ -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) diff --git a/Mage/src/test/java/mage/cards/decks/importer/O8dDeckImportTest.java b/Mage/src/test/java/mage/cards/decks/importer/O8dDeckImportTest.java index be230c36ba..c5a51c30d6 100644 --- a/Mage/src/test/java/mage/cards/decks/importer/O8dDeckImportTest.java +++ b/Mage/src/test/java/mage/cards/decks/importer/O8dDeckImportTest.java @@ -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)