diff options
author | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-08-23 20:14:13 +0200 |
---|---|---|
committer | Eduardo Pedroni <e.pedroni91@gmail.com> | 2015-08-23 20:14:13 +0200 |
commit | 59306d5db84daef508119f9ced39d0eb31c7b685 (patch) | |
tree | 63754c8019f4b3f4bb378ae1890915e0713bb530 /src/eu/equalparts/cardbase | |
parent | 41981711f0240976c4fffc861995a8f2efebe191 (diff) |
Added a few more CLI tests, need to figure out why they don't work properly on windows
Diffstat (limited to 'src/eu/equalparts/cardbase')
-rw-r--r-- | src/eu/equalparts/cardbase/utils/MTGUniverse.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/eu/equalparts/cardbase/utils/MTGUniverse.java b/src/eu/equalparts/cardbase/utils/MTGUniverse.java index 98067fa..dd6f6ad 100644 --- a/src/eu/equalparts/cardbase/utils/MTGUniverse.java +++ b/src/eu/equalparts/cardbase/utils/MTGUniverse.java @@ -32,11 +32,11 @@ public final class MTGUniverse { /** * The base URL from where the information is fetched. */ - private final String BASE_DATA_URL = "http://mtgjson.com/json/"; + private String BASE_DATA_URL = "http://mtgjson.com/json/"; /** * If the upstream set code list can't be loaded, this is loaded instead. */ - private final String FALLBACK_LIST_PATH = "/setlist.json"; + private final String FALLBACK_LIST_PATH = "/fallbackSetList.json"; /** * A cache of CardSets to avoid querying the server many times for the same information. */ @@ -46,6 +46,12 @@ public final class MTGUniverse { */ private HashMap<String, FullCardSet> cardSetCache = new HashMap<String, FullCardSet>(); + public MTGUniverse() {} + + public MTGUniverse(String dataLocation) { + this.BASE_DATA_URL = dataLocation; + } + /** * Returns the specified card in the form of a {@code Card} object. If the specified number does * not correspond to a card in the set or the specified set code does not correspond to a set, @@ -111,13 +117,13 @@ public final class MTGUniverse { cardSets = JSON.mapper.readValue(new URL(BASE_DATA_URL + "SetList.json"), new TypeReference<ArrayList<CardSetInformation>>() {}); } catch (Exception e) { System.out.println("Error: could not fetch or parse set code list from upstream, using fallback json..."); - e.printStackTrace(); +// e.printStackTrace(); try { cardSets = JSON.mapper.readValue(MTGUniverse.class.getResourceAsStream(FALLBACK_LIST_PATH), new TypeReference<ArrayList<CardSetInformation>>() {}); } catch (Exception f) { System.out.println("Error: could not parse fallback set code list, aborting..."); - f.printStackTrace(); +// f.printStackTrace(); System.exit(1); } } @@ -126,7 +132,7 @@ public final class MTGUniverse { } /** - * This method effectively converts different set code spellings + * This method converts different set code spellings * into the format parsed from the set code list. * <br> * For instance, if "m15" is passed as the argument, this returns |