From e31a88db28c22b1db6a7840a83fd5ef855fe4274 Mon Sep 17 00:00:00 2001 From: "marcin.sciesinski" Date: Fri, 13 Apr 2018 15:15:51 -0700 Subject: [PATCH] Added test --- .../draft2/builder/DraftChoiceBuilder.java | 10 +++--- .../draft2/SoloDraftDefinitionsTest.java | 34 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 gemp-lotr/gemp-lotr-server/src/test/java/com/gempukku/lotro/draft2/SoloDraftDefinitionsTest.java diff --git a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/draft2/builder/DraftChoiceBuilder.java b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/draft2/builder/DraftChoiceBuilder.java index 83c333dd3..a192f3f10 100644 --- a/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/draft2/builder/DraftChoiceBuilder.java +++ b/gemp-lotr/gemp-lotr-server/src/main/java/com/gempukku/lotro/draft2/builder/DraftChoiceBuilder.java @@ -72,8 +72,9 @@ public class DraftChoiceBuilder { public CardCollection getCardsForChoiceId(String choiceId, long seed, int stage) { List cardIds = cardsMap.get(choiceId); DefaultCardCollection cardCollection = new DefaultCardCollection(); - for (String cardId : cardIds) - cardCollection.addItem(cardId, 1); + if (cardIds != null) + for (String cardId : cardIds) + cardCollection.addItem(cardId, 1); return cardCollection; } @@ -95,7 +96,7 @@ public class DraftChoiceBuilder { final List shuffledCards = getShuffledCards(seed, stage); List draftableCards = new ArrayList(count); - for (int i=0; i shuffledCards = getShuffledCards(seed, stage); - for (int i=0; i availableChoices = soloDraft.getAvailableChoices(0, 0); + String choiceId = availableChoices.iterator().next().getChoiceId(); + + CardCollection firstPickCards = soloDraft.getCardsForChoiceId(choiceId, 0, 0); + assertFalse(firstPickCards.getAll().isEmpty()); + + assertTrue(soloDraft.getCardsForChoiceId("madeUpChoiceId", 0, 0).getAll().isEmpty()); + + assertTrue(soloDraft.hasNextStage(0, 1)); + Iterable secondChoices = soloDraft.getAvailableChoices(0, 1); + String secondChoiceId = secondChoices.iterator().next().getChoiceId(); + + assertFalse(soloDraft.getCardsForChoiceId(secondChoiceId, 0, 1).getAll().isEmpty()); + assertTrue(soloDraft.getCardsForChoiceId("madeUpChoiceId", 0, 1).getAll().isEmpty()); + } +} \ No newline at end of file