aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/eu/equalparts/cardbase/CardbaseSortTest.java2
-rw-r--r--test/eu/equalparts/cardbase/CardbaseTest.java28
-rw-r--r--test/eu/equalparts/cardbase/cli/CardbaseCLITest.java18
3 files changed, 16 insertions, 32 deletions
diff --git a/test/eu/equalparts/cardbase/CardbaseSortTest.java b/test/eu/equalparts/cardbase/CardbaseSortTest.java
index 44b68be..e3a92ee 100644
--- a/test/eu/equalparts/cardbase/CardbaseSortTest.java
+++ b/test/eu/equalparts/cardbase/CardbaseSortTest.java
@@ -41,7 +41,7 @@ public class CardbaseSortTest {
public void setUp() throws Exception {
uut = new Cardbase();
for (Card card : testCards) {
- uut.addCard(card);
+ uut.addCard(card, card.count);
}
}
diff --git a/test/eu/equalparts/cardbase/CardbaseTest.java b/test/eu/equalparts/cardbase/CardbaseTest.java
index 82b05ba..424befc 100644
--- a/test/eu/equalparts/cardbase/CardbaseTest.java
+++ b/test/eu/equalparts/cardbase/CardbaseTest.java
@@ -144,7 +144,7 @@ public class CardbaseTest {
uut = new Cardbase(testFile);
assertEquals("Cardbase should contain no cards.", 0, uut.getCards().size());
- uut.addCard(testCard);
+ uut.addCard(testCard, testCard.count);
uut.writeCollection(testFile);
uut = new Cardbase(testFile);
@@ -176,7 +176,7 @@ public class CardbaseTest {
***********************************************************************************/
@Test
public void newCardIsAdded() throws Exception {
- uut.addCard(testCard);
+ uut.addCard(testCard, testCard.count);
Card addedCard = uut.getCard("M15", "281");
assertNotNull("Card was not found in cardbase.", addedCard);
@@ -186,10 +186,10 @@ public class CardbaseTest {
@Test
public void existingCardIsIncremented() throws Exception {
Card shivanClone = testCard.clone();
- uut.addCard(shivanClone);
+ uut.addCard(shivanClone, shivanClone.count);
Card shivanClone2 = testCard.clone();
shivanClone2.count = 2;
- uut.addCard(shivanClone2);
+ uut.addCard(shivanClone2, shivanClone2.count);
Card addedCard = uut.getCard("M15", "281");
assertNotNull("Card was not found in cardbase.", addedCard);
@@ -202,7 +202,7 @@ public class CardbaseTest {
@Test
public void cardAddedIsNull() throws Exception {
exception.expect(NullPointerException.class);
- uut.addCard(null);
+ uut.addCard(null, 0);
}
/***********************************************************************************
@@ -212,9 +212,9 @@ public class CardbaseTest {
public void cardRemoveCountIsLessThanCardCount() throws Exception {
Card shivanClone = testCard.clone();
shivanClone.count = 5;
- uut.addCard(shivanClone);
+ uut.addCard(shivanClone, shivanClone.count);
- int removed = uut.removeCard(testCard);
+ int removed = uut.removeCard(testCard, testCard.count);
Card removedCard = uut.getCard("M15", "281");
assertNotNull("Card was not found in cardbase.", removedCard);
@@ -225,9 +225,9 @@ public class CardbaseTest {
@Test
public void cardRemoveCountIsEqualToCardCount() throws Exception {
Card shivanClone = testCard.clone();
- uut.addCard(shivanClone);
+ uut.addCard(shivanClone, shivanClone.count);
- int removed = uut.removeCard(testCard);
+ int removed = uut.removeCard(testCard, testCard.count);
Card removedCard = uut.getCard("M15", "281");
assertNull("Card was not removed from cardbase.", removedCard);
@@ -238,11 +238,11 @@ public class CardbaseTest {
public void cardRemoveCountIsGreaterThanCardCount() throws Exception {
Card shivanClone = testCard.clone();
shivanClone.count = 3;
- uut.addCard(shivanClone);
+ uut.addCard(shivanClone, shivanClone.count);
Card shivanClone2 = testCard.clone();
shivanClone2.count = 5;
- int removed = uut.removeCard(shivanClone2);
+ int removed = uut.removeCard(shivanClone2, shivanClone2.count);
Card removedCard = uut.getCard("M15", "281");
assertNull("Card was not removed from cardbase.", removedCard);
@@ -255,12 +255,12 @@ public class CardbaseTest {
@Test
public void removedCardIsNull() throws Exception {
exception.expect(NullPointerException.class);
- uut.removeCard(null);
+ uut.removeCard(null, 0);
}
@Test
public void removedCardIsNotInCardbase() throws Exception {
- int removed = uut.removeCard(testCard);
+ int removed = uut.removeCard(testCard, testCard.count);
assertEquals("Removed count should be 0.", 0, removed);
}
@@ -270,7 +270,7 @@ public class CardbaseTest {
***********************************************************************************/
@Test
public void correctCardIsReturnedByGetter() throws Exception {
- uut.addCard(testCard.clone());
+ uut.addCard(testCard.clone(), testCard.count);
Card card = uut.getCard("M15", "281");
diff --git a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
index 5756337..9a98469 100644
--- a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
+++ b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
@@ -7,10 +7,7 @@ import java.io.File;
import java.io.PrintStream;
import java.util.Scanner;
-import org.junit.After;
-import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -44,24 +41,11 @@ public class CardbaseCLITest {
@Rule
public TemporaryFolder tempFolder = new TemporaryFolder();
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
-
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
@Before
public void setUp() throws Exception {
uut = new CardbaseCLI(TEST_REMOTE);
testOutput.reset();
}
-
- @After
- public void tearDown() throws Exception {
- }
/***********************************************************************************
* Start up tests, happy path
@@ -1065,7 +1049,7 @@ public class CardbaseCLITest {
} finally {
System.setOut(console);
}
- assertEquals("Wrong glance.", "20 Cunning Strike (FRF, 150)\nTotal: 20" + EOL, testOutput.toString());
+ assertEquals("Wrong glance.", "20 Cunning Strike (FRF, 150)\nTotal: 20" + EOL, testOutput.toString());
}
/*