diff options
-rw-r--r-- | src/eu/equalparts/cardbase/Cardbase.java | 4 | ||||
-rw-r--r-- | src/eu/equalparts/cardbase/decks/ReferenceDeck.java | 27 | ||||
-rw-r--r-- | test/eu/equalparts/cardbase/CardbaseTest.java | 8 | ||||
-rw-r--r-- | test/eu/equalparts/cardbase/decks/ReferenceDeckTest.java | 45 |
4 files changed, 82 insertions, 2 deletions
diff --git a/src/eu/equalparts/cardbase/Cardbase.java b/src/eu/equalparts/cardbase/Cardbase.java index fac4ace..10908c8 100644 --- a/src/eu/equalparts/cardbase/Cardbase.java +++ b/src/eu/equalparts/cardbase/Cardbase.java @@ -23,13 +23,13 @@ public class Cardbase extends StandaloneCardContainer { /** * The decks which have been saved along with this collection of cards. */ - @JsonProperty private Map<Integer, Object> decks; +// @JsonProperty private Map<Integer, Object> decks; /** * Creates a clean cardbase. */ public Cardbase() { - decks = new HashMap<>(); + } /** diff --git a/src/eu/equalparts/cardbase/decks/ReferenceDeck.java b/src/eu/equalparts/cardbase/decks/ReferenceDeck.java new file mode 100644 index 0000000..8c8e227 --- /dev/null +++ b/src/eu/equalparts/cardbase/decks/ReferenceDeck.java @@ -0,0 +1,27 @@ +package eu.equalparts.cardbase.decks; + +import eu.equalparts.cardbase.cardstorage.ReferenceCardContainer; + +public class ReferenceDeck extends ReferenceCardContainer { + private String name = ""; + + public ReferenceDeck() {} + + public ReferenceDeck(String name) { + this.name = name; + } + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name the name to set + */ + public void setName(String name) { + this.name = name; + } +} diff --git a/test/eu/equalparts/cardbase/CardbaseTest.java b/test/eu/equalparts/cardbase/CardbaseTest.java index 47ad027..832880a 100644 --- a/test/eu/equalparts/cardbase/CardbaseTest.java +++ b/test/eu/equalparts/cardbase/CardbaseTest.java @@ -181,4 +181,12 @@ public class CardbaseTest { exception.expect(NullPointerException.class); uut = Cardbase.load(null); } + + /*********************************************************************************** + * Deck tests + ***********************************************************************************/ + @Test + public void test() throws Exception { + + } } diff --git a/test/eu/equalparts/cardbase/decks/ReferenceDeckTest.java b/test/eu/equalparts/cardbase/decks/ReferenceDeckTest.java new file mode 100644 index 0000000..928c167 --- /dev/null +++ b/test/eu/equalparts/cardbase/decks/ReferenceDeckTest.java @@ -0,0 +1,45 @@ +package eu.equalparts.cardbase.decks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.Test; + +import eu.equalparts.cardbase.cardstorage.ReferenceCardContainer; + +public class ReferenceDeckTest { + private ReferenceDeck uut; + + @Before + public void setUp() throws Exception { + uut = new ReferenceDeck(); + } + + /*********************************************************************************** + * Typing + ***********************************************************************************/ + @Test + public void deckIsReferenceCardContainer() throws Exception { + assertTrue("Deck should be instance of ReferenceCardContainer.", uut instanceof ReferenceCardContainer); + } + + /*********************************************************************************** + * Name tests + ***********************************************************************************/ + @Test + public void deckHasName() throws Exception { + assertEquals("Deck should not have a name to begin with.", "", uut.getName()); + + uut.setName("Test Name"); + + assertEquals("Wrong name.", "Test Name", uut.getName()); + } + + @Test + public void deckNameInConstructor() throws Exception { + uut = new ReferenceDeck("Another Test"); + + assertEquals("Deck should have a name to begin with.", "Another Test", uut.getName()); + } +} |