diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 87b738cbd0..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index db6060fe4b..4b7e1f3d38 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Sep 16 09:26:14 SGT 2019 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index af6708ff22..8e25e6c19d 100755 --- a/gradlew +++ b/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m"' +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" diff --git a/gradlew.bat b/gradlew.bat index 6d57edc706..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/savedWallet.txt b/savedWallet.txt index f9a44637c2..e3f6f2314d 100644 --- a/savedWallet.txt +++ b/savedWallet.txt @@ -1,4 +1,4 @@ 1000.0 out $250.0 /date 2019-11-07 /tags -out $100.0 /date 2019-11-07 /tags -in $100.0 /date 2019-11-07 /tags +out $100.0 /date 2019-11-07 /tags +in $100.0 /date 2019-11-07 /tags diff --git a/src/test/java/CommandGetSpendingByMonthTest.java b/src/test/java/CommandGetSpendingByMonthTest.java index 704d36a4fb..3e23a33911 100644 --- a/src/test/java/CommandGetSpendingByMonthTest.java +++ b/src/test/java/CommandGetSpendingByMonthTest.java @@ -11,65 +11,62 @@ public class CommandGetSpendingByMonthTest { @Test void execute() { - StorageManager storageManager = new StorageManager(); - - Receipt receipt1 = new Receipt(5.0); - receipt1.addTag("food"); - receipt1.setDate(LocalDate.parse("2019-10-10")); - storageManager.getWallet().addReceipt(receipt1); - - Receipt receipt2 = new Receipt(5.0); - receipt2.addTag("food"); - receipt2.setDate(LocalDate.parse("2019-11-10")); - storageManager.getWallet().addReceipt(receipt2); - - - CommandGetSpendingByMonth c1 = new CommandGetSpendingByMonth("expendedmonth october /year 2019"); - c1.execute(storageManager); - String ans1 = c1.getInfoCapsule().getOutputStr(); - - CommandGetSpendingByMonth c2 = new CommandGetSpendingByMonth("expendedmonth november /year 2019"); - c2.execute(storageManager); - String ans2 = c2.getInfoCapsule().getOutputStr(); - - CommandGetSpendingByMonth c3 = new CommandGetSpendingByMonth("expendedmonth nov /year 2019"); - c3.execute(storageManager); - String ans3 = c3.getInfoCapsule().getOutputStr(); - - CommandGetSpendingByMonth c4 = new CommandGetSpendingByMonth("expendedmonth november /year 209"); - c4.execute(storageManager); - String ans4 = c4.getInfoCapsule().getOutputStr(); + StorageManager storageManager = new StorageManager(); + + Receipt receipt1 = new Receipt(5.0); + receipt1.addTag("food"); + receipt1.setDate(LocalDate.parse("2019-10-10")); + storageManager.getWallet().addReceipt(receipt1); + + Receipt receipt2 = new Receipt(5.0); + receipt2.addTag("food"); + receipt2.setDate(LocalDate.parse("2019-11-10")); + storageManager.getWallet().addReceipt(receipt2); + + CommandGetSpendingByMonth c1 = new CommandGetSpendingByMonth("expendedmonth october /year 2019"); + c1.execute(storageManager); + String ans1 = c1.getInfoCapsule().getOutputStr(); + assertEquals("The total amount of money spent in october 2019 : $5.0\n", ans1); + + CommandGetSpendingByMonth c2 = new CommandGetSpendingByMonth("expendedmonth november /year 2019"); + c2.execute(storageManager); + String ans2 = c2.getInfoCapsule().getOutputStr(); + assertEquals("The total amount of money spent in november 2019 : $5.0\n", ans2); + + CommandGetSpendingByMonth c3 = new CommandGetSpendingByMonth("expendedmonth nov /year 2019"); + c3.execute(storageManager); + String ans3 = c3.getInfoCapsule().getOutputStr(); + assertEquals("Wrong month input. Check Spelling", ans3); + + CommandGetSpendingByMonth c4 = new CommandGetSpendingByMonth("expendedmonth november /year 209"); + c4.execute(storageManager); + String ans4 = c4.getInfoCapsule().getOutputStr(); + assertEquals("Year input contains lesser/extra number of variables. " + + "\nFORMAT : expendedmonth /year ", ans4); CommandGetSpendingByMonth c5 = new CommandGetSpendingByMonth("expendedmonth november /yea 2019"); c5.execute(storageManager); String ans5 = c5.getInfoCapsule().getOutputStr(); + assertEquals("Wrong format! FORMAT : expendedmonth /year ", ans5); CommandGetSpendingByMonth c6 = new CommandGetSpendingByMonth("expendedmonth november /year 1750"); c6.execute(storageManager); String ans6 = c6.getInfoCapsule().getOutputStr(); + assertEquals("Year is too far back into the past", ans6); CommandGetSpendingByMonth c7 = new CommandGetSpendingByMonth("expendedmonth november /year 2750"); c7.execute(storageManager); String ans7 = c7.getInfoCapsule().getOutputStr(); + assertEquals("Future year entered is invalid!", ans7); CommandGetSpendingByMonth c8 = new CommandGetSpendingByMonth("expendedmonth november /year"); c8.execute(storageManager); String ans8 = c8.getInfoCapsule().getOutputStr(); + assertEquals("No year input detected. FORMAT : expendedmonth /year ", ans8); CommandGetSpendingByMonth c9 = new CommandGetSpendingByMonth("expendedmonth /year 2019"); c9.execute(storageManager); String ans9 = c9.getInfoCapsule().getOutputStr(); - - assertEquals("The total amount of money spent in october 2019 : $5.0\n", ans1); - assertEquals("The total amount of money spent in november 2019 : $5.0\n", ans2); - assertEquals("Wrong month input. Check Spelling", ans3); - assertEquals("Year input contains lesser/extra number of variables. " - + "\nFORMAT : expendedmonth /year ", ans4); - assertEquals("Wrong format! FORMAT : expendedmonth /year ", ans5); - assertEquals("Year is too far back into the past", ans6); - assertEquals("Future year entered is invalid!", ans7); - assertEquals("No year input detected. FORMAT : expendedmonth /year ", ans8); - assertEquals("No month input detected. FORMAT : expendedmonth /year ", ans9); + assertEquals("No month input detected. FORMAT : expendedmonth /year ", ans9); } - } diff --git a/src/test/java/CommandGetSpendingByYearTest.java b/src/test/java/CommandGetSpendingByYearTest.java index 5a0a29d77f..857aa78b2f 100644 --- a/src/test/java/CommandGetSpendingByYearTest.java +++ b/src/test/java/CommandGetSpendingByYearTest.java @@ -27,34 +27,40 @@ void execute() { CommandGetSpendingByYear c1 = new CommandGetSpendingByYear("expendedyear 2019"); c1.execute(storageManager); String ans1 = c1.getInfoCapsule().getOutputStr(); + assertEquals("The total amount of money spent in 2019 : $10.0\n", ans1); CommandGetSpendingByYear c2 = new CommandGetSpendingByYear("expendedyear"); c2.execute(storageManager); String ans2 = c2.getInfoCapsule().getOutputStr(); + assertEquals("No year input detected.\nFORMAT : expendedyear 2019\n", ans2); CommandGetSpendingByYear c3 = new CommandGetSpendingByYear("expendedyear 201"); c3.execute(storageManager); String ans3 = c3.getInfoCapsule().getOutputStr(); + assertEquals("Year input contains lesser/extra number of variables.\n" + + " FORMAT : expendedyear 2019\n", ans3); CommandGetSpendingByYear c4 = new CommandGetSpendingByYear("expendedyear 2091"); c4.execute(storageManager); String ans4 = c4.getInfoCapsule().getOutputStr(); + assertEquals("Future year entered is invalid!" + "\n", ans4); CommandGetSpendingByYear c5 = new CommandGetSpendingByYear("expendedyear 1750"); c5.execute(storageManager); String ans5 = c5.getInfoCapsule().getOutputStr(); + assertEquals("Year is too far back into the past" + "\n", ans5); CommandGetSpendingByYear c6 = new CommandGetSpendingByYear("expendedyear abcd"); c6.execute(storageManager); String ans6 = c6.getInfoCapsule().getOutputStr(); - - assertEquals("The total amount of money spent in 2019 : $10.0\n", ans1); - assertEquals("No year input detected.\nFORMAT : expendedyear 2019\n", ans2); - assertEquals("Year input contains lesser/extra number of variables.\n" - + " FORMAT : expendedyear 2019\n", ans3); - assertEquals("Future year entered is invalid!" + "\n", ans4); - assertEquals("Year is too far back into the past" + "\n", ans5); assertEquals("Year input is either a double or contains String values.\n" + "FORMAT : expendedyear 2019\n", ans6); + + + + + + + } } diff --git a/src/test/java/ui/MainGuiTest.java b/src/test/java/ui/MainGuiTest.java index bcd55b0018..71a08d30fa 100644 --- a/src/test/java/ui/MainGuiTest.java +++ b/src/test/java/ui/MainGuiTest.java @@ -9,6 +9,11 @@ public class MainGuiTest extends MainGui { private String walletPath = "savedWallet.txt"; private MainWindow mainWindowController; + /** + * Tests the working of the GUI. + * @param taskPath is the path the leads to the task content + * @param walletPath is the path that leads to the wallet contents + */ public void initialize(String taskPath, String walletPath) { String[] args = {}; this.taskPath = taskPath;