mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Renamed and optimised implementation for getTheLatestOfAllTheOriginalEditionsOfCardsIn + tests
`getTheLatestOfAllTheOriginalEditionsOfCardsIn` is the new name for `getEarliestEditionWithAllCards` which better clarifies the intent of the method. The implementation has been optimised, according to the new CardDb behaviour and APIs. The tests have been extended to verify that the output of the method is always consistent regardless of the edition of cards in the input CardPool.
This commit is contained in:
@@ -13,7 +13,7 @@ import static org.testng.Assert.assertEquals;
|
||||
public class CardEditionCollectionTestCase extends ForgeCardMockTestCase {
|
||||
|
||||
@Test
|
||||
public void getEarliestEditionWithAllCardsNotWorkingAsExpected(){
|
||||
public void testGetTheLatestOfAllTheOriginalEditionsOfCardsInPoolWithOriginalSets(){
|
||||
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
||||
|
||||
CardDb cardDb = FModel.getMagicDb().getCommonCards();
|
||||
@@ -30,7 +30,29 @@ public class CardEditionCollectionTestCase extends ForgeCardMockTestCase {
|
||||
|
||||
CardPool pool = new CardPool();
|
||||
pool.add(cards);
|
||||
CardEdition ed = editions.getEarliestEditionWithAllCards(pool);
|
||||
CardEdition ed = editions.getTheLatestOfAllTheOriginalEditionsOfCardsIn(pool);
|
||||
assertEquals(ed.getCode(), "ALL");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTheLatestOfAllTheOriginalEditionsOfCardsInPoolWithLatestArtSets(){
|
||||
CardEdition.Collection editions = FModel.getMagicDb().getEditions();
|
||||
|
||||
CardDb cardDb = FModel.getMagicDb().getCommonCards();
|
||||
String[] cardNames = {"Shivan Dragon", "Animate Wall", "Balance", "Blessing", "Force of Will"};
|
||||
String[] expectedSets = {"M20", "MED", "SLD", "M14", "2XM"};
|
||||
List<PaperCard> cards = new ArrayList<>();
|
||||
for (int i=0; i < 5; i++){
|
||||
String cardName = cardNames[i];
|
||||
String expectedSet = expectedSets[i];
|
||||
PaperCard card = cardDb.getCardFromEditions(cardName, CardDb.CardArtPreference.LATEST_ART_ALL_EDITIONS);
|
||||
assertEquals(card.getEdition(), expectedSet, "Assertion Failed for "+cardName);
|
||||
cards.add(card);
|
||||
}
|
||||
|
||||
CardPool pool = new CardPool();
|
||||
pool.add(cards);
|
||||
CardEdition ed = editions.getTheLatestOfAllTheOriginalEditionsOfCardsIn(pool);
|
||||
assertEquals(ed.getCode(), "ALL");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user