From 3a25d47f187fe7499d2d481d9a0a3411a92bfa11 Mon Sep 17 00:00:00 2001 From: Eduardo Pedroni Date: Sun, 21 Aug 2016 01:14:38 +0200 Subject: Switched from ant to gradle, had to refactor some of the tests because of the new build structure, a bit ugly but should pass --- .../equalparts/cardbase/cli/CardbaseCLITest.java | 23 ++++++++++++++++++++-- .../equalparts/cardbase/cli/expectedFallbackList | 20 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) (limited to 'test/eu/equalparts/cardbase') diff --git a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java index 87755db..64a1030 100644 --- a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java +++ b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java @@ -5,9 +5,12 @@ import static org.junit.Assert.*; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.PrintStream; +import java.net.URI; +import java.net.URISyntaxException; import java.util.Scanner; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -33,7 +36,7 @@ public class CardbaseCLITest { * The test remote URL to "query" from, this is actually the same directory * as the test class. Test files need to be placed accordingly. */ - private final String TEST_REMOTE = getClass().getResource("").toString(); + private static String TEST_REMOTE; @Rule public ExpectedException exception = ExpectedException.none(); @@ -41,12 +44,17 @@ public class CardbaseCLITest { @Rule public TemporaryFolder tempFolder = new TemporaryFolder(); + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TEST_REMOTE = getResourceLocation("SetList.json"); + } + @Before public void setUp() throws Exception { uut = new CardbaseCLI(TEST_REMOTE); testOutput.reset(); } - + /*********************************************************************************** * Start up tests, happy path ***********************************************************************************/ @@ -1566,6 +1574,17 @@ public class CardbaseCLITest { /*********************************************************************************** * Utility methods for dealing with files ***********************************************************************************/ + /** + * For deriving the location of local resources for this class from the location + * of a specific resource. + * + * @return the URI of the resource directory as a string. + */ + private static String getResourceLocation(String resourceName) throws URISyntaxException { + URI location = new URI(CardbaseCLITest.class.getResource(resourceName).getPath()); + return "file:" + location.resolve(".").toString(); + } + /** * Returns the contents of a resource file by reading it with a {@code Scanner}. The file is * loaded using {@code getClass().getResourceAsStream()}, so make sure to address it relative diff --git a/test/eu/equalparts/cardbase/cli/expectedFallbackList b/test/eu/equalparts/cardbase/cli/expectedFallbackList index 93a0d03..00896d7 100644 --- a/test/eu/equalparts/cardbase/cli/expectedFallbackList +++ b/test/eu/equalparts/cardbase/cli/expectedFallbackList @@ -3,6 +3,8 @@ LEA : Limited Edition Alpha LEB : Limited Edition Beta ARN : Arabian Nights 2ED : Unlimited Edition +CED : Collector's Edition +CEI : International Collector's Edition pDRC : Dragon Con ATQ : Antiquities 3ED : Revised Edition @@ -79,7 +81,7 @@ SOK : Saviors of Kamigawa 9ED : Ninth Edition RAV : Ravnica: City of Guilds p2HG : Two-Headed Giant Tournament -pWPN : WPN and Gateway +pGTW : Gateway GPT : Guildpact pCMP : Champs and States DIS : Dissension @@ -105,6 +107,7 @@ pSUM : Summer of Magic EVE : Eventide DRB : From the Vault: Dragons ME2 : Masters Edition II +pWPN : Wizards Play Network ALA : Shards of Alara DD2 : Duel Decks: Jace vs. Chandra CON : Conflux @@ -163,6 +166,7 @@ MD1 : Modern Event Deck 2014 CNS : Magic: The Gathering—Conspiracy VMA : Vintage Masters M15 : Magic 2015 Core Set +CPK : Clash Pack V14 : From the Vault: Annihilation (2014) DDN : Duel Decks: Speed vs. Cunning KTK : Khans of Tarkir @@ -176,4 +180,16 @@ FRF : Fate Reforged DDO : Duel Decks: Elspeth vs. Kiora DTK : Dragons of Tarkir TPR : Tempest Remastered -MM2 : Modern Masters 2015 Edition \ No newline at end of file +MM2 : Modern Masters 2015 Edition +ORI : Magic Origins +V15 : From the Vault: Angels +DDP : Duel Decks: Zendikar vs. Eldrazi +BFZ : Battle for Zendikar +EXP : Zendikar Expeditions +C15 : Commander 2015 +OGW : Oath of the Gatewatch +DDQ : Duel Decks: Blessed vs. Cursed +W16 : Welcome Deck 2016 +SOI : Shadows over Innistrad +EMA : Eternal Masters +EMN : Eldritch Moon \ No newline at end of file -- cgit v1.2.3