From c0b13ba381bad56e0767efd745a8fd23762ba1f9 Mon Sep 17 00:00:00 2001 From: Maxmtg Date: Mon, 26 Mar 2012 21:16:55 +0000 Subject: [PATCH] carving away some code we won't ever need. --- .gitattributes | 2 +- src/main/java/forge/AllZone.java | 4 +- src/main/java/forge/CardReader.java | 39 --- src/main/java/forge/card/BoosterData.java | 23 +- .../java/forge/game/limited/BoosterDraft.java | 10 +- .../java/forge/game/limited/SealedDeck.java | 8 +- src/main/java/forge/item/FatPack.java | 3 +- src/main/java/forge/item/OpenablePack.java | 27 +- .../forge/view/match/QuestWinLoseHandler.java | 20 +- .../braids/util/UtilFunctions.java | 280 +----------------- src/test/java/forge/CardReaderTest.java | 36 +-- src/test/java/forge/model/BuildInfoTest.java | 2 +- .../util/testng/BraidsAssertFunctions.java | 1 - .../braids/util/testng}/ClumsyRunnable.java | 2 +- 14 files changed, 49 insertions(+), 408 deletions(-) rename src/{main/java/net/slightlymagic/braids/util => test/java/net/slightlymagic/braids/util/testng}/ClumsyRunnable.java (96%) diff --git a/.gitattributes b/.gitattributes index 3eb471b3a27..102b7b24078 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11842,7 +11842,6 @@ src/main/java/forge/view/match/ViewWinLose.java -text src/main/java/forge/view/match/package-info.java svneol=native#text/plain src/main/java/forge/view/package-info.java svneol=native#text/plain src/main/java/net/slightlymagic/braids/LICENSE.txt svneol=native#text/plain -src/main/java/net/slightlymagic/braids/util/ClumsyRunnable.java svneol=native#text/plain src/main/java/net/slightlymagic/braids/util/ImmutableIterableFrom.java svneol=native#text/plain src/main/java/net/slightlymagic/braids/util/UtilFunctions.java svneol=native#text/plain src/main/java/net/slightlymagic/braids/util/generator/FindNonDirectoriesSkipDotDirectoriesGenerator.java svneol=native#text/plain @@ -11883,5 +11882,6 @@ src/test/java/forge/gui/game/CardDetailPanelTest.java svneol=native#text/plain src/test/java/forge/model/BuildInfoTest.java -text src/test/java/forge/model/FModelTest.java -text src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java svneol=native#text/plain +src/test/java/net/slightlymagic/braids/util/testng/ClumsyRunnable.java svneol=native#text/plain src/test/java/net/slightlymagic/braids/util/testng/LICENSE.txt svneol=native#text/plain src/test/java/net/slightlymagic/braids/util/testng/package-info.java -text diff --git a/src/main/java/forge/AllZone.java b/src/main/java/forge/AllZone.java index 9e4da52297c..c0d4692d449 100644 --- a/src/main/java/forge/AllZone.java +++ b/src/main/java/forge/AllZone.java @@ -20,7 +20,6 @@ package forge; import java.util.Arrays; import java.util.List; -import net.slightlymagic.braids.util.UtilFunctions; import forge.Constant.Zone; import forge.card.cardfactory.CardFactoryInterface; import forge.card.cardfactory.PreloadingCardFactory; @@ -239,8 +238,7 @@ public final class AllZone { * @param factory * the factory to set */ - public static void setCardFactory(final CardFactoryInterface factory) { - UtilFunctions.checkNotNull("factory", factory); + private static void setCardFactory(final CardFactoryInterface factory) { AllZone.cardFactory = factory; } diff --git a/src/main/java/forge/CardReader.java b/src/main/java/forge/CardReader.java index 7267e416765..e65d870c8a4 100644 --- a/src/main/java/forge/CardReader.java +++ b/src/main/java/forge/CardReader.java @@ -35,7 +35,6 @@ import java.util.zip.ZipFile; import javax.swing.SwingUtilities; -import net.slightlymagic.braids.util.UtilFunctions; import net.slightlymagic.braids.util.generator.FindNonDirectoriesSkipDotDirectoriesGenerator; import net.slightlymagic.braids.util.generator.GeneratorFunctions; @@ -622,42 +621,4 @@ public class CardReader implements Runnable { return buf.toString(); } - - /** - * Attempt to load a card by its canonical ASCII name. - * - * @param canonicalASCIIName - * the canonical ASCII name of the card - * - * @return a new Card instance having that name, or null if not found - */ - public final Card findCard(final String canonicalASCIIName) { - // Braids on - // 8/18/11 - // 11:08 PM - UtilFunctions.checkNotNull("canonicalASCIIName", canonicalASCIIName); - - final String cardFilePath = this.toMostLikelyPath(canonicalASCIIName); - - Card result = null; - - if (this.zip != null) { - final ZipEntry entry = this.zip.getEntry(cardFilePath); - - if (entry != null) { - result = this.loadCard(entry); - } - } - - if (result == null) { - result = this.loadCard(new File(this.cardsfolder, cardFilePath)); - } - - if ((result == null) || !(result.getName().equals(canonicalASCIIName))) { - // System.err.println(":Could not find \"" + cardFilePath + "\"."); - result = this.loadCardsUntilYouFind(canonicalASCIIName); - } - - return result; - } } diff --git a/src/main/java/forge/card/BoosterData.java b/src/main/java/forge/card/BoosterData.java index 2bc781ae332..c010f500934 100644 --- a/src/main/java/forge/card/BoosterData.java +++ b/src/main/java/forge/card/BoosterData.java @@ -14,7 +14,11 @@ public class BoosterData { public final String getEdition() { return edition; } - + private final String landEdition; + public final String getLandEdition() { + return landEdition; + } + private final int nCommon; private final int nUncommon; private final int nRare; @@ -39,10 +43,10 @@ public class BoosterData { * @param nDF * the n df */ - public BoosterData(final String edition, final int nC, final int nU, final int nR, final int nS, final int nDF) { + public BoosterData(final String edition, final String editionLand, final int nC, final int nU, final int nR, final int nS, final int nDF) { // if this booster has more that 10 cards, there must be a land in // 15th slot unless it's already taken - this(edition, nC, nU, nR, nS, nDF, (nC + nR + nU + nS + nDF) > 10 ? BoosterData.CARDS_PER_BOOSTER - nC - nR - nU + this(edition, editionLand, nC, nU, nR, nS, nDF, (nC + nR + nU + nS + nDF) > 10 ? BoosterData.CARDS_PER_BOOSTER - nC - nR - nU - nS - nDF : 0, 68); } @@ -64,7 +68,7 @@ public class BoosterData { * @param oneFoilPer * the one foil per */ - public BoosterData(final String edition0, final int nC, final int nU, final int nR, final int nS, final int nDF, final int nL, + public BoosterData(final String edition0, final String editionLand, final int nC, final int nU, final int nR, final int nS, final int nDF, final int nL, final int oneFoilPer) { this.nCommon = nC; this.nUncommon = nU; @@ -74,6 +78,7 @@ public class BoosterData { this.nLand = nL > 0 ? nL : 0; this.foilRate = oneFoilPer; this.edition = edition0; + this.landEdition = editionLand; } /** @@ -88,7 +93,9 @@ public class BoosterData { public final Predicate getEditionFilter() { return CardPrinted.Predicates.printedInSets(edition); } - + public final Predicate getLandEditionFilter() { + return CardPrinted.Predicates.printedInSets(landEdition); + } /** * Gets the uncommon. * @@ -179,7 +186,11 @@ public class BoosterData { int nDf = section.getInt("DoubleFaced", 0); int nLand = section.getInt("BasicLands", 0); int nFoilRate = section.getInt("FoilRate", 68); - return new BoosterData(section.get("Set"), nC, nU, nR, nS, nDf, nLand, nFoilRate); + String edition = section.get("Set"); + String editionLand = section.get("LandSet"); + if( editionLand == null ) + editionLand = edition; + return new BoosterData(edition, editionLand, nC, nU, nR, nS, nDf, nLand, nFoilRate); } } } diff --git a/src/main/java/forge/game/limited/BoosterDraft.java b/src/main/java/forge/game/limited/BoosterDraft.java index 5ea83ce1aea..519bc8e72ab 100644 --- a/src/main/java/forge/game/limited/BoosterDraft.java +++ b/src/main/java/forge/game/limited/BoosterDraft.java @@ -28,7 +28,6 @@ import java.util.TreeMap; import javax.swing.JOptionPane; -import net.slightlymagic.braids.util.UtilFunctions; import forge.Card; import forge.CardList; import forge.Constant; @@ -93,9 +92,12 @@ public final class BoosterDraft implements IBoosterDraft { case Block: // Draft from cards by block or set - final Object o = GuiUtils.chooseOne("Choose Block", UtilFunctions.iteratorToArray(Singletons.getModel().getBlocks().iterator(), new CardBlock[]{})); - final CardBlock block = (CardBlock) o; - + List blocks = new ArrayList(); + for(CardBlock b : Singletons.getModel().getBlocks()) { + blocks.add(b); + } + final CardBlock block = GuiUtils.chooseOne("Choose Block", blocks); + final CardEdition[] cardSets = block.getSets(); final String[] sets = new String[cardSets.length]; for (int k = cardSets.length - 1; k >= 0; --k) { diff --git a/src/main/java/forge/game/limited/SealedDeck.java b/src/main/java/forge/game/limited/SealedDeck.java index b359391d7b6..56c3ce79a43 100644 --- a/src/main/java/forge/game/limited/SealedDeck.java +++ b/src/main/java/forge/game/limited/SealedDeck.java @@ -23,7 +23,6 @@ import java.util.List; import javax.swing.JOptionPane; -import net.slightlymagic.braids.util.UtilFunctions; import forge.AllZone; import forge.Card; import forge.CardList; @@ -79,8 +78,11 @@ public class SealedDeck { this.getLandSetCode()[0] = CardDb.instance().getCard("Plains").getEdition(); } else if (sealedType.equals("Block")) { - final Object o = GuiUtils.chooseOne("Choose Block", UtilFunctions.iteratorToArray(Singletons.getModel().getBlocks().iterator(), new CardBlock[]{})); - final CardBlock block = (CardBlock) o; + List blocks = new ArrayList(); + for(CardBlock b : Singletons.getModel().getBlocks()) { + blocks.add(b); + } + final CardBlock block = GuiUtils.chooseOne("Choose Block", blocks); final CardEdition[] cardSets = block.getSets(); final String[] sets = new String[cardSets.length]; diff --git a/src/main/java/forge/item/FatPack.java b/src/main/java/forge/item/FatPack.java index c247163a137..bec6a2e50a4 100644 --- a/src/main/java/forge/item/FatPack.java +++ b/src/main/java/forge/item/FatPack.java @@ -71,8 +71,7 @@ public class FatPack extends OpenablePack { for (int i = 0; i < fpData.getCntBoosters(); i++) { result.addAll(super.generate()); } - CardEdition landEdition = Singletons.getModel().getEditions().get(fpData.getLandsEdition()); - result.addAll(getRandomBasicLands(landEdition, fpData.getCntLands())); + result.addAll(getRandomBasicLands(fpData.getLandsEdition(), fpData.getCntLands())); return result; } diff --git a/src/main/java/forge/item/OpenablePack.java b/src/main/java/forge/item/OpenablePack.java index 1b35f702796..9cbb3c1fee2 100644 --- a/src/main/java/forge/item/OpenablePack.java +++ b/src/main/java/forge/item/OpenablePack.java @@ -17,14 +17,10 @@ */ package forge.item; -import java.util.Arrays; import java.util.List; -import net.slightlymagic.braids.util.UtilFunctions; -import forge.Singletons; import forge.card.BoosterData; import forge.card.BoosterGenerator; -import forge.card.CardEdition; import forge.card.CardRules; import forge.util.Predicate; @@ -148,24 +144,11 @@ public abstract class OpenablePack implements InventoryItemFromSet { final int cntLands = this.contents.getLand(); if (cntLands > 0) { - myCards.add(this.getLandFromNearestSet()); + myCards.add(this.getRandomBasicLand(this.contents.getLandEdition())); } return myCards; } - private CardPrinted getLandFromNearestSet() { - final CardEdition[] editions = UtilFunctions.iteratorToArray(Singletons.getModel().getEditions().iterator(), - new CardEdition[] {}); - final int iThisSet = Arrays.binarySearch(editions, this.contents); - for (int iSet = iThisSet; iSet < editions.length; iSet++) { - final CardPrinted land = this.getRandomBasicLand(editions[iSet]); - if (null != land) { - return land; - } - } - // if not found (though that's impossible) - return this.getRandomBasicLand(Singletons.getModel().getEditions().get("M12")); - } /** * Gets the random basic land. @@ -173,8 +156,8 @@ public abstract class OpenablePack implements InventoryItemFromSet { * @param set the set * @return the random basic land */ - protected CardPrinted getRandomBasicLand(final CardEdition set) { - return this.getRandomBasicLands(set, 1).get(0); + protected CardPrinted getRandomBasicLand(final String setCode) { + return this.getRandomBasicLands(setCode, 1).get(0); } /** @@ -184,8 +167,8 @@ public abstract class OpenablePack implements InventoryItemFromSet { * @param count the count * @return the random basic lands */ - protected List getRandomBasicLands(final CardEdition set, final int count) { - return Predicate.and(CardPrinted.Predicates.printedInSets(set.getCode()), + protected List getRandomBasicLands(final String setCode, final int count) { + return Predicate.and(CardPrinted.Predicates.printedInSets(setCode), CardRules.Predicates.Presets.IS_BASIC_LAND, CardPrinted.FN_GET_RULES).random( CardDb.instance().getAllCards(), count); } diff --git a/src/main/java/forge/view/match/QuestWinLoseHandler.java b/src/main/java/forge/view/match/QuestWinLoseHandler.java index 199c7f625e8..b04d6952d23 100644 --- a/src/main/java/forge/view/match/QuestWinLoseHandler.java +++ b/src/main/java/forge/view/match/QuestWinLoseHandler.java @@ -49,8 +49,6 @@ import forge.quest.bazaar.QuestItemType; import forge.quest.data.QuestAssets; import forge.quest.data.QuestPreferences.QPref; import forge.util.MyRandom; -import net.slightlymagic.braids.util.UtilFunctions; - import java.awt.Color; import java.awt.Dimension; import java.util.ArrayList; @@ -534,18 +532,18 @@ public class QuestWinLoseHandler extends ControlWinLose { * */ private void awardBooster() { - final GameFormat[] formats = UtilFunctions.iteratorToArray(Singletons.getModel().getFormats().iterator(), new GameFormat[]{}); - final ListChooser ch = new ListChooser("Choose bonus booster format", 1, formats); - + final List formats = new ArrayList(); String prefferedFormat = Singletons.getModel().getQuestPreferences().getPreference(QPref.BOOSTER_FORMAT); - int index = 0; - for (int i = 0; i < formats.length; i++) { - if (formats[i].toString().equals(prefferedFormat)) { + + int index = 0, i = 0; + for (GameFormat f : Singletons.getModel().getFormats()) { + formats.add(f); + if (f.toString().equals(prefferedFormat)) index = i; - break; - } + i++; } - + + final ListChooser ch = new ListChooser("Choose bonus booster format", 1, formats); ch.show(index); final GameFormat selected = ch.getSelectedValue(); diff --git a/src/main/java/net/slightlymagic/braids/util/UtilFunctions.java b/src/main/java/net/slightlymagic/braids/util/UtilFunctions.java index 508d9752301..2024c69fddd 100644 --- a/src/main/java/net/slightlymagic/braids/util/UtilFunctions.java +++ b/src/main/java/net/slightlymagic/braids/util/UtilFunctions.java @@ -21,10 +21,6 @@ package net.slightlymagic.braids.util; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - import javax.swing.SwingUtilities; /** @@ -39,40 +35,6 @@ public final class UtilFunctions { // empty } - /** - * Throws a NullPointerException if param is null. - * - * @param paramName - * the name of the parameter; may be null - * @param param - * the parameter to test - */ - public static void checkNotNull(final String paramName, final Object param) { - if (param != null) { - return; - } - - NullPointerException exn = null; - - if (paramName == null) { - exn = new NullPointerException(); - // 11:19 PM - } else { - exn = new NullPointerException(paramName + " must not be null"); - // by - // Braids - // on - // 8/18/11 - // 11:19 - // PM - } - - // Doctor the exception to appear to come from the caller. - final StackTraceElement[] trace = exn.getStackTrace(); - final int len = UtilFunctions.getSliceLength(trace, 1); - exn.setStackTrace(UtilFunctions.slice(new StackTraceElement[len], trace, 1)); - throw exn; - } /** * Invoke the given Runnable in an Event Dispatch Thread and wait for it to @@ -109,184 +71,7 @@ public final class UtilFunctions { } } - /** - * Create an array from the (rest of) an iterator's output; this function is - * horribly inefficient. - * - * Please, only use it on small iterators. - * - * @param - * (inferred automatically) - * - * @param iter - * the iterator to traverse - * - * @return an array of (the rest of) the iterator's values - */ - public static T[] iteratorToArray(final Iterator iter, T[] destArray) { - final ArrayList list = new ArrayList(); - - T item; - while (iter.hasNext()) { - item = iter.next(); - list.add(item); - } - - final T[] result = list.toArray(destArray); - return result; - } - - /** - * Returns the rightmost portion of an array, Python-style. - * - * @param - * (inferred automatically) - * - * @param dstArray - * the array in which to place new items - * - * @param srcArray - * the array to copy (shallowly) - * - * @param startIndexIn - * if positive, the index (from the left) at which to start - * copying; if negative, we treat this as the index from the - * right. For example, calling this with startIndex = -2 returns - * the last two items in the array, if it has that many. - * - * @return a shallow copy of array starting at startIndex; this may return - * an empty array if the startIndex is out of bounds. - */ - public static T[] slice(final T[] dstArray, final T[] srcArray, final int startIndexIn) { - int startIndex = startIndexIn; - if (startIndex < 0) { - startIndex = srcArray.length + startIndex; - if (startIndex < 0) { - startIndex = 0; - } - } - - if (dstArray == null) { - throw new NullPointerException(); - // 11:19 PM - } - - if (srcArray == null) { - throw new NullPointerException(); - // 11:19 PM - } - - final int resultLength = UtilFunctions.getSliceLength(srcArray, startIndex); - - if (dstArray.length != resultLength) { - throw new ArrayIndexOutOfBoundsException("First parameter must have length " + resultLength - + ", but length is " + dstArray.length + "."); - } - - int srcIx = startIndex; - - for (int dstIx = 0; (dstIx < resultLength) && (srcIx < srcArray.length); dstIx++, srcIx++) { - dstArray[dstIx] = srcArray[srcIx]; - } - - return dstArray; - } - - /** - * Get a slice's length in preparation for taking a slice. - * - * I do not like the fact that I have to use this function, but Java left me - * with little choice. - * - * @param - * (inferred automatically) - * @param srcArray - * the array that would be copied (shallowly) - * @param startIndexIn - * if positive, the index (from the left) at which copying would - * start; if negative, we treat this as the index from the right. - * For example, calling this with startIndex = -2 computes the - * length if slice would return the last two items in the array, - * if it has that many. - * @return the length of the array that would result from calling - * slice(Object[], Object[], int) with the given srcArray and - * startIndex. - * @see #slice(Object[], Object[], int) - */ - public static int getSliceLength(final T[] srcArray, final int startIndexIn) { - int startIndex = startIndexIn; - - if (startIndex < 0) { - startIndex = srcArray.length + startIndex; - if (startIndex < 0) { - startIndex = 0; - } - } - - final int resultLength = srcArray.length - startIndex; - return resultLength; - } - - /** - * Handles the boilerplate null and isinstance check for an equals method. - * - * Example: - * - *
-     * public boolean equals(Object obj) {
-     *     MyClassName that = checkNullOrNotInstance(this, obj);
-     *     if (that == null) {
-     *         return false;
-     *     }
-     *     // ...
-     * }
-     * 
- * - * @param - * (inferred automatically) - * - * @param goodInstance - * a non-null instance of type T; looks neater than passing in - * goodInstance.getClass() - * - * @param obj - * the object to test - * - * @return null if obj is null or not an instance of goodInstance's class; - * otherwise, we return obj cast to goodInstance's type - */ - public static T checkNullOrNotInstance(final T goodInstance, final Object obj) { - if (goodInstance == null) { - throw new NullPointerException("first parameter must not be null"); - // by - // Braids - // on - // 8/18/11 - // 11:19 - // PM - } - - @SuppressWarnings("unchecked") - final Class classT = (Class) goodInstance.getClass(); - - boolean viable = true; - - if (obj == null) { - viable = false; - } else if (!(classT.isInstance(obj))) { - viable = false; - } - - T result; - if (viable) { - result = classT.cast(obj); - } else { - result = null; - } - - return result; - } - + /** * Safely converts an object to a String. * @@ -307,68 +92,5 @@ public final class UtilFunctions { return result; } - /** - * Remove nulls and duplicate items from the list. - * - * This may change the list's ordering. It uses the items' equals methods to - * determine equality. - * - * Advantages over HashSet: This consumes no unnecessary heap-memory, nor - * does it require objects to implement hashCode. It is OK if (o1.equals(o2) - * does not imply o1.hashCode() == o2.hashCode()). - * - * Advantages over TreeSet: This does not require a comparator. - * - * Disadvantages over HashSet and TreeSet: This runs in O(n*n) time. - * - * @param - * (inferred automatically) - * - * @param list - * the list to modify; this is fastest with ArrayList. - */ - public static void smartRemoveDuplicatesAndNulls(final List list) { - // Get rid of pesky leading nulls. - UtilFunctions.smartRemoveDuplicatesAndNullsHelper(list, 0, null); - - for (int earlierIx = 0; earlierIx < list.size(); earlierIx++) { - for (int laterIx = earlierIx + 1; laterIx < list.size(); laterIx++) { - final T itemAtEarlierIx = list.get(earlierIx); - - UtilFunctions.smartRemoveDuplicatesAndNullsHelper(list, laterIx, itemAtEarlierIx); - } - - } - } - - /** - * Helper method for smartRemoveDuplicatesAndNulls that is subject to - * change; if you call this directly, you do so at your own risk!. - * - * @param - * (inferred automatically) - * @param list - * the list to modify; if all items from startIx to the end are - * either null or equal to objSeenPreviously, then we truncate - * the list just before startIx. - * @param startIx - * the index to examine; we only move items within the range of - * [startIx, list.size()-1]. - * @param objSeenPreviously - * the object with which to compare list[startIx]; may be null. - */ - public static void smartRemoveDuplicatesAndNullsHelper(final List list, final int startIx, - final T objSeenPreviously) { - while ((startIx < list.size()) - && ((list.get(startIx) == null) || (list.get(startIx) == objSeenPreviously) || list.get(startIx) - .equals(objSeenPreviously))) { - final int lastItemIx = list.size() - 1; - - // Overwrite the item at laterIx with the one at the end, - // then delete the one at the end. - list.set(startIx, list.get(lastItemIx)); - list.remove(lastItemIx); - } - } } diff --git a/src/test/java/forge/CardReaderTest.java b/src/test/java/forge/CardReaderTest.java index ef2d199ceaa..3a69ebc7615 100644 --- a/src/test/java/forge/CardReaderTest.java +++ b/src/test/java/forge/CardReaderTest.java @@ -5,8 +5,8 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import net.slightlymagic.braids.util.ClumsyRunnable; import net.slightlymagic.braids.util.testng.BraidsAssertFunctions; +import net.slightlymagic.braids.util.testng.ClumsyRunnable; import org.testng.Assert; import org.testng.annotations.Test; @@ -99,40 +99,6 @@ public class CardReaderTest { BraidsAssertFunctions.assertThrowsException(RuntimeException.class, withScissors); } - /** - * Test_ read card_find card_zip. - */ - @Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT, enabled = false) - public final void test_ReadCard_findCard_zip() { - final Map map = new HashMap(); - final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER); - final CardReader cardReader = new CardReader(cardsfolder, map); - - final File zipFile = new File(cardsfolder, "cardsfolder.zip"); - - Assert.assertTrue(zipFile.exists(), "zip file exists"); - - final Card elvishWarrior = cardReader.findCard("Elvish Warrior"); - - Assert.assertNotNull(elvishWarrior); - Assert.assertEquals(elvishWarrior.getName(), "Elvish Warrior", "name is correct"); - } - - /** - * Test_ read card_find card_nonzip. - */ - @Test(groups = { "UnitTest", "fast" }, timeOut = CardReaderTest.TEST_TIMEOUT) - public final void test_ReadCard_findCard_nonzip() { - final Map map = new HashMap(); - final File cardsfolder = ForgeProps.getFile(NewConstants.CARDSFOLDER); - final CardReader cardReader = new CardReader(cardsfolder, map, null, false); - - final Card savannahLions = cardReader.findCard("Savannah Lions"); - - Assert.assertNotNull(savannahLions); - Assert.assertEquals(savannahLions.getName(), "Savannah Lions", "name is correct"); - } - /** * Test_ read card_run_nonzip. */ diff --git a/src/test/java/forge/model/BuildInfoTest.java b/src/test/java/forge/model/BuildInfoTest.java index 343efec3905..020ab46d770 100644 --- a/src/test/java/forge/model/BuildInfoTest.java +++ b/src/test/java/forge/model/BuildInfoTest.java @@ -6,8 +6,8 @@ import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import net.slightlymagic.braids.util.ClumsyRunnable; import net.slightlymagic.braids.util.testng.BraidsAssertFunctions; +import net.slightlymagic.braids.util.testng.ClumsyRunnable; import org.testng.Assert; import org.testng.annotations.Test; diff --git a/src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java b/src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java index aa0f6e6b281..ab61017d760 100644 --- a/src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java +++ b/src/test/java/net/slightlymagic/braids/util/testng/BraidsAssertFunctions.java @@ -1,6 +1,5 @@ package net.slightlymagic.braids.util.testng; -import net.slightlymagic.braids.util.ClumsyRunnable; import org.testng.Assert; diff --git a/src/main/java/net/slightlymagic/braids/util/ClumsyRunnable.java b/src/test/java/net/slightlymagic/braids/util/testng/ClumsyRunnable.java similarity index 96% rename from src/main/java/net/slightlymagic/braids/util/ClumsyRunnable.java rename to src/test/java/net/slightlymagic/braids/util/testng/ClumsyRunnable.java index 9fb7e024a16..7dcacaef598 100644 --- a/src/main/java/net/slightlymagic/braids/util/ClumsyRunnable.java +++ b/src/test/java/net/slightlymagic/braids/util/testng/ClumsyRunnable.java @@ -18,7 +18,7 @@ * limitations under the Apache License. * */ -package net.slightlymagic.braids.util; +package net.slightlymagic.braids.util.testng; /** * Like Runnable, but it can throw any Exception.