Search in sources :

Example 1 with TxtDeckImporter

use of mage.cards.decks.importer.TxtDeckImporter in project mage by magefree.

the class TxtDeckImporterTest method testImportWithBlankLineAboveSideboard.

@Test
public void testImportWithBlankLineAboveSideboard() {
    TxtDeckImporter importer = new TxtDeckImporter(false);
    CardInfo card;
    DeckCardLists deck = new DeckCardLists();
    String[] cards = { "Plains", "Forest", "Island" };
    String[] sideboard = { "Swamp", "Mountain" };
    for (String c : cards) {
        card = CardRepository.instance.findPreferredCoreExpansionCard(c, true);
        assert card != null;
        deck.getCards().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode()));
    }
    for (String s : sideboard) {
        card = CardRepository.instance.findPreferredCoreExpansionCard(s, true);
        assert card != null;
        deck.getSideboard().add(new DeckCardInfo(card.getName(), card.getCardNumber(), card.getSetCode()));
    }
    Assert.assertEquals("Deck does not contain 3 cards, found " + deck.getCards().size(), 3, deck.getCards().size());
    Assert.assertEquals("Sideboard does not contain 2 cards, found " + deck.getSideboard().size(), 2, deck.getSideboard().size());
    DeckCardLists imported = importer.importDeck("JustLands.txt", false);
    Assert.assertEquals("Imported deck does not contain 3 cards, found " + imported.getCards().size(), 3, imported.getCards().size());
    Assert.assertEquals("Imported sideboard does not contain 2 cards, found " + imported.getSideboard().size(), 2, imported.getSideboard().size());
}
Also used : DeckCardLists(mage.cards.decks.DeckCardLists) DeckCardInfo(mage.cards.decks.DeckCardInfo) TxtDeckImporter(mage.cards.decks.importer.TxtDeckImporter) DeckCardInfo(mage.cards.decks.DeckCardInfo) CardInfo(mage.cards.repository.CardInfo) Test(org.junit.Test)

Aggregations

DeckCardInfo (mage.cards.decks.DeckCardInfo)1 DeckCardLists (mage.cards.decks.DeckCardLists)1 TxtDeckImporter (mage.cards.decks.importer.TxtDeckImporter)1 CardInfo (mage.cards.repository.CardInfo)1 Test (org.junit.Test)1