aboutsummaryrefslogtreecommitdiffstats
path: root/test/eu/equalparts/cardbase/cli
diff options
context:
space:
mode:
Diffstat (limited to 'test/eu/equalparts/cardbase/cli')
-rw-r--r--test/eu/equalparts/cardbase/cli/CardbaseCLITest.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
index 9a98469..87755db 100644
--- a/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
+++ b/test/eu/equalparts/cardbase/cli/CardbaseCLITest.java
@@ -860,6 +860,36 @@ public class CardbaseCLITest {
assertEquals("Please select a set before removing cards." + EOL, testOutput.toString());
}
+ @Test
+ public void removeIntegerOverflowAmount() throws Exception {
+ uut = new CardbaseCLI(TEST_REMOTE, path("/testbase.cb"));
+ uut.interpretInput("set FRF");
+
+ try {
+ System.setOut(new PrintStream(testOutput));
+ uut.interpretInput("remove 129 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+ } finally {
+ System.setOut(console);
+ }
+
+ assertEquals("9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 is not a valid number of cards." + EOL, testOutput.toString());
+ }
+
+ @Test
+ public void removeNonIntAmount() throws Exception {
+ uut = new CardbaseCLI(TEST_REMOTE, path("/testbase.cb"));
+ uut.interpretInput("set FRF");
+
+ try {
+ System.setOut(new PrintStream(testOutput));
+ uut.interpretInput("remove 129 1OO");
+ } finally {
+ System.setOut(console);
+ }
+
+ assertEquals("1OO is not a valid number of cards." + EOL, testOutput.toString());
+ }
+
/***********************************************************************************
* add() tests, happy path
***********************************************************************************/
@@ -1252,6 +1282,34 @@ public class CardbaseCLITest {
assertEquals("Total: 0" + EOL, testOutput.toString());
}
+ @Test
+ public void addIntegerOverflowAmount() throws Exception {
+ uut.interpretInput("set FRF");
+
+ try {
+ System.setOut(new PrintStream(testOutput));
+ uut.interpretInput("129 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999");
+ } finally {
+ System.setOut(console);
+ }
+
+ assertEquals("9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 is not a valid number of cards." + EOL, testOutput.toString());
+ }
+
+ @Test
+ public void addNonIntAmount() throws Exception {
+ uut.interpretInput("set FRF");
+
+ try {
+ System.setOut(new PrintStream(testOutput));
+ uut.interpretInput("129 1OO");
+ } finally {
+ System.setOut(console);
+ }
+
+ assertEquals("1OO is not a valid number of cards." + EOL, testOutput.toString());
+ }
+
/***********************************************************************************
* undo() tests, happy path
***********************************************************************************/