diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index 19fec9d54d..c0b81e0cc1 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -16,10 +16,10 @@ data storage so that you can review your past medication intake.
@@ -277,7 +277,7 @@ Morning:
:information_source:
Info:
If you want to mark the medication you have taken, you can refer to the
Take
-Command
here.
+Command.
@@ -791,7 +791,7 @@ See the part on
:bangbang:
Danger:
@@ -868,11 +868,22 @@ This folder resides at the same level as the `meditracker.jar` file.
To transfer the data, just copy/shift the `data` folder to the new computer,
making sure it is at the same level as the `.jar` file.
+**Q**: Why does the program keep returning "Invalid index specified"?
+
+**A**: Please make sure you are referring to the correct list. MediTracker uses [`list -t all`](#all-medications)
+and [`list -t today`](#daily-medications) commands to display all medications and medications to be taken for the day,
+respectively. You may also use the `
-h` to see how the command works.
+
## Glossary
+| Term | Explanation |
+|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| .json | JSON stands for JavaScript Object Notation, which is used to save **all** medications added by the user. |
+| .txt | It represents a text file that contains plain text in the form of lines.
Medications to be taken for a particular day is saved in the text file, and a new text file is created at the start of the day. |
+| Flags | Most commands in MediTracker uses the flags with the "-" to recognise values within certain fields. Eg. `-n`, `-a`, `-l`, etc. |
diff --git a/docs/diagrams/AddCommand.puml b/docs/diagrams/AddCommand.puml
index 26d1813099..cab822ce64 100644
--- a/docs/diagrams/AddCommand.puml
+++ b/docs/diagrams/AddCommand.puml
@@ -6,7 +6,7 @@ participant "<>\n MedicationManager" as MedicationManager
participant "<>\n DailyMedicationManager" as DailyMedicationManager
participant "<>\n Ui" as Ui
-User -> AddCommand: new AddCommand(arguments)
+User -> AddCommand ** : new AddCommand(arguments)
activate AddCommand
AddCommand -> ArgumentList: parse(arguments)
activate ArgumentList
diff --git a/docs/diagrams/AddToSubLists.puml b/docs/diagrams/AddToSubLists.puml
new file mode 100644
index 0000000000..fe98b13494
--- /dev/null
+++ b/docs/diagrams/AddToSubLists.puml
@@ -0,0 +1,34 @@
+@startuml
+'https://plantuml.com/sequence-diagram
+actor User
+
+participant "<>\n :DailyMedicationManager" as DailyMedicationManager
+participant "period:Period" as Period
+participant "medication:Medication" as Medication
+
+User -> DailyMedicationManager: addToSublists(medication)
+activate DailyMedicationManager
+ loop all periods
+ DailyMedicationManager -> Period: gePeriod()
+ activate Period
+ return period
+ deactivate Period
+ DailyMedicationManager -> Medication: getDosage(), getName()
+ activate Medication
+ return dosage, name
+ deactivate Medication
+ DailyMedicationManager -> "dailyMedication:DailyMedication" as DailyMeds ** : new DailyMedication(name, dosage, period)
+ activate DailyMeds
+ return dailyMedication
+ deactivate DailyMeds
+ DailyMedicationManager -> DailyMedicationManager: addDailyMedication(dailyMedication)
+ activate DailyMedicationManager
+ return
+ participant "<>\n :FileReaderWriter" as FileReaderWriter
+ DailyMedicationManager -> FileReaderWriter: saveDailyMedicationData(null)
+ activate FileReaderWriter
+ return true
+ end
+DailyMedicationManager --> User
+deactivate DailyMedicationManager
+@enduml
\ No newline at end of file
diff --git a/docs/diagrams/ListCommand.puml b/docs/diagrams/ListCommand.puml
new file mode 100644
index 0000000000..21f10e4042
--- /dev/null
+++ b/docs/diagrams/ListCommand.puml
@@ -0,0 +1,48 @@
+@startuml
+'https://plantuml.com/sequence-diagram
+
+actor User
+
+participant ":ListCommand" as LC
+participant "ARGUMENT_LIST:ArgumentList" as AL
+
+User -> LC ** : new \nListCommand\n(argument)
+activate LC
+LC -> AL: parse(argument)
+activate AL
+AL -> "parsedArguments:ArgumentParser" as AP ** : new ArgumentParser(argument)
+activate AP
+return argumentParser.parsedArguments
+return parsedArguments
+deactivate AP
+deactivate AL
+
+participant ":ArgumentName" as AN
+participant "<>\n :MedicationManager" as MM
+participant "<>\n :DailyMedicationManager" as DM
+participant "<>\n :Ui" as UI
+LC -> AN: parsedArguments.get()
+return listTypeString
+LC -> LC: execute()
+activate LC
+ alt listTypeString.equals("all")
+ LC -> MM: printAllMeds()
+ activate MM
+ return
+ deactivate MM
+ else listTypeString.equals("today")
+ LC -> DM: printTodayMeds()
+ activate DM
+ return
+ deactivate DM
+ else else
+ LC -> UI: showErrorMessage("Unknown list type")
+ activate UI
+ return
+ deactivate UI
+ end
+LC --> LC
+deactivate LC
+LC --> User
+deactivate LC
+@enduml
\ No newline at end of file
diff --git a/docs/diagrams/ViewCommand.puml b/docs/diagrams/ViewCommand.puml
index 3883e23373..534060d0b3 100644
--- a/docs/diagrams/ViewCommand.puml
+++ b/docs/diagrams/ViewCommand.puml
@@ -1,52 +1,53 @@
@startuml
-actor User
+actor User #e67678
title View Command Sequence Diagram
participant ":ViewCommand" as ViewCommand
-participant ":ArgumentList" as ArgumentList
+participant "ARGUMENT_LIST:ArgumentList" as ArgumentList
participant ":ArgumentParser" as ArgumentParser
+participant ":ArgumentName" as ArgumentName
participant "<>\n MedicationManager" as MedicationManager
participant "<>\n Ui" as Ui
-User --> ViewCommand: new ViewCommand(args)
+User --> ViewCommand ** : new ViewCommand(argument)
activate ViewCommand
-ViewCommand -> ArgumentList: parse(args)
-
-activate ArgumentList
-ArgumentList -> ArgumentParser: parse(args)
-deactivate ArgumentList
-
-activate ArgumentParser
-ArgumentParser --> ViewCommand: return parsedArgs
+ViewCommand -> ArgumentList: parse(argument)
+activate ArgumentList #e67678
+ArgumentList -> ArgumentParser ** : New ArgumentParser(argument)
+activate ArgumentParser #a67671
+ArgumentParser --[#red]> ArgumentList: parsedArguments
deactivate ArgumentParser
+ArgumentList --[#red]> ViewCommand: parsedArguments
+deactivate ArgumentList
-alt #transparent oneParsedArgs
- ViewCommand -> ViewCommand: execute(medication)
- activate ViewCommand #65c2a6
+ViewCommand -> ViewCommand: execute(medication)
+activate ViewCommand #65c2a6
- ViewCommand -> MedicationManager: printSpecificMedication(medication)
- activate MedicationManager #d192d0
- MedicationManager -> MedicationManager: getMedication(medication)
+ alt oneParsedArgument
+ ViewCommand -> MedicationManager: printSpecificMedication(medication)
+ activate MedicationManager #d192d0
+ MedicationManager -> MedicationManager: getMedication(medication)
- MedicationManager -> Ui: printSpecificMed(medicationDetails)
- activate Ui #c6d67e
- Ui --[#red]> MedicationManager: return
- MedicationManager --[#red]> ViewCommand: return
- deactivate MedicationManager
+ MedicationManager -> Ui: printSpecificMed(medicationDetails)
+ activate Ui #c6d67e
+ Ui --[#red]> MedicationManager:
+ MedicationManager --[#red]> ViewCommand:
+ deactivate MedicationManager
- ViewCommand -> Ui: showSuccessMessage("Medication details has been retrieved")
- Ui --[#red]> ViewCommand: return
- deactivate Ui
+ ViewCommand -> Ui: showSuccessMessage("Medication details has been retrieved")
+ Ui --[#red]> ViewCommand:
+ deactivate Ui
-else #transparent more\nThanOne\nParsed\nArgs
- ViewCommand -> Ui: showErrorMessage("You can only have one flag!")
- activate Ui #c6d67e
- Ui --[#blue]> ViewCommand: return
- deactivate Ui
-end
+ else #transparent more\nThanOne\nParsed\nArgs
+ ViewCommand -> Ui: showErrorMessage("You can only have one flag!")
+ activate Ui #c6d67e
+ Ui --[#red]> ViewCommand:
+ deactivate Ui
+ end
+ViewCommand --[#blue]> ViewCommand
deactivate ViewCommand
-User <-- ViewCommand
+User <[#red]-- ViewCommand
deactivate ViewCommand
@enduml
\ No newline at end of file
diff --git a/docs/images/AddCommand.png b/docs/images/AddCommand.png
index 7552a1661b..e4cac70407 100644
Binary files a/docs/images/AddCommand.png and b/docs/images/AddCommand.png differ
diff --git a/docs/images/AddToSubLists.png b/docs/images/AddToSubLists.png
new file mode 100644
index 0000000000..ffcb329cc5
Binary files /dev/null and b/docs/images/AddToSubLists.png differ
diff --git a/docs/images/ListCommand.png b/docs/images/ListCommand.png
new file mode 100644
index 0000000000..d4b268cb51
Binary files /dev/null and b/docs/images/ListCommand.png differ
diff --git a/docs/images/ViewCommand.png b/docs/images/ViewCommand.png
index c01eeb25d4..2f740b2654 100644
Binary files a/docs/images/ViewCommand.png and b/docs/images/ViewCommand.png differ
diff --git a/docs/team/e0958902.md b/docs/team/e0958902.md
index 9b0e08244d..3532120edf 100644
--- a/docs/team/e0958902.md
+++ b/docs/team/e0958902.md
@@ -1,38 +1,101 @@
# Eric Sim Chong Li - Project Portfolio Page
+## MediTracker
+
## Overview
-The following contains my contribution summary and pull request reviews.
+The following contains my contribution summary and pull request reviews on our product, MediTracker.
+MediTracker is a command-line interface application where it allows users to keep track of their
+daily medications and get reminded of low quantity and nearing expiry medications.
+
+
+* [Overview](#overview)
+* [Summary of Contributions](#summary-of-contributions)
+ * [Code Contributed](#code-contributed)
+ * [Enhancements implemented](#enhancements-implemented)
+ * [Developer Guide Contributions](#developer-guide-contributions)
+ * [User Guide Contributions](#user-guide-contributions)
+ * [Review/mentoring contributions](#reviewmentoring-contributions)
+ * [Team-based tasks and contributions beyond the project team](#team-based-tasks-and-contributions-beyond-the-project-team)
+
+
+
+
+
### Summary of Contributions
-- Created relevant milestones labels
-- Map some of the user stories to issues
-- Reviewed multiple pull requests (PR)
-- Added guide on how to improve on ListCommand in the developer guide
-- Issue #49: list all medications from 'MedicationManager'
-- Issue #15: Show detailed view of a medication
-- Issue #162: Update view feature to have more supported flags
-- Issue #175: Fix `IndexOutOfBoundsException` for `view` command (Related issues: #171, #169, #165, #152)
-- Issue #153: Fix `NumberFormatException` for `view` command
-- Issue #181: Fix unaligned medication list output (Related issue: #166)
-- Issue #214: Fix User Guide to explicitly state the requirements for every flag
-- Issue #202: Fix Expiry date issues (Related Issued: #192, #188, #187, #186, #161)
+- Created relevant tags and milestones.
+- Map some of the user stories to issues.
+- Reviewed multiple pull requests (PR).
+- Added guide on how to improve on ListCommand and ViewCommand in the developer guide.
+- [PR #49:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/49) List all medications from 'MedicationManager'.
+- [PR #15:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/127) Show detailed view of a medication.
+- [PR #206](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/206)
+ - Update view feature to have more supported flags.
+ - Fix `IndexOutOfBoundsException` for `view` command
+ (Related issues: #171, #169, #165, #152).
+ - Fix `NumberFormatException` for `view` command.
+ - Fix unaligned medication list output (Related issue: #166).
+- [PR #214:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/214)
+Fix User Guide to explicitly state the requirements for every flag.
+- [PR #202:](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/220)
+Fix Expiry date issues (Related Issues: #192, #188, #187, #186, #161).
+
+### Code Contributed
+Here is the [RepoSense link](https://nus-cs2113-ay2324s2.github.io/tp-dashboard/?search=e0958902&breakdown=true)
+of my code contributions.
+
+### Enhancements implemented
+- Implemented the ListCommand to query relevant fields in the Medication Manager
+containing the medication list. e.g `list -t all`.
+- Implemented the ViewCommand to display all relevant fields of a medication,
+where it supports different flags with its argument. e.g `view -e 2025`.
+- Performed JUnit tests on the methods used in List and View Commands.
+- Ensured that the User Guide is consistent across all commands/features.
### Developer Guide Contributions
-- Information on how ListCommand works and how to use it.
-- Relevant user stories done in milestone v1.0
+- Information on how ListCommand and ViewCommand works, and how to use it.
+- Included relevant diagrams to illustrate how ListCommand and ViewCommand works.
+- Relevant user stories done in milestones.
### User Guide Contributions
-- Updated user guide to include listing of all medications
-- Updated user guide to include viewing of specific medications
-- Ensured that the formatting, alignment, and consistency is in place across all pages
+- Updated user guide to include listing of all medications.
+- Updated user guide to include viewing of specific medications.
+- Ensured that the formatting, alignment, and consistency is in place across all pages.
-### PR Reviews
-#9, #18, #20, #23, #53, #73, #75, #84, #88,
-#89, #90, #95, #98, #115, #116, #126, #127,
-#129, #134, #139, #210, #212, #213, #238,
-#239, #243
+
-### Team-based tasks
-- Created relevant tags and milestones.
+
+
+### Review/mentoring contributions
+- [#9](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/17) Add JavaDoc and other documentation to Ui.
+- [#18](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/18) Created class to test for searching medication from external database.
+- [#20](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/20) feat: Mark medication taken.
+- [#23](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/23) Misc: change package name and update PR Template.
+- [#53](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/53) Add medication info into daily.
+- [#73](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/73) refactor: Modify Ui to be static.
+- [#75](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/75) feat: More flags for Add command, Exception Handling and Double casting
+- [#84](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/84) Separate daily medications to sub lists.
+- [#88](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/88) Update list all medication.
+- [#89](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/89) DG: Adds DG from Lin Htet.
+- [#90](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/90) DG: Add DG by kyuichyi.
+- [#95](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/95) feat: Add take untake enhancements.
+- [#98](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/98) Update style: styling update.
+- [#115](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/115) test: add tests for search command functionality
+- [#116](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/116) Obj for each sub list.
+- [#126](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/126) refactor: Remove prompt from Argument classes.
+- [#127](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/127) Query specific medication.
+- [#129](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/129) fix(bug): ModifyCommand handle erroneous data and fix AddCommand error handling.
+- [#134](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/134) Updates UG: Lin Htet.
+- [#139](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/139) docs: Update DG for Add command with sequence diagram.
+- [#210](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/210) fix: Fix Add Command PE-D issues.
+- [#212](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/212) docs: Update Dev Guide based on comments.
+- [#213](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/213) Improve logging: Song Xuan.
+- [#238](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/238) docs: Update search in UG.
+- [#239](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/239) style: fix style.
+- [#243](https://github.com/AY2324S2-CS2113T-T09-1/tp/pull/243) test: Add modify tests.
+
+### Team-based tasks and contributions beyond the project team
+- Created relevant tags and milestones to have a soft and hard deadline.
+- Answered some questions in the forum and encouraged others to join and verify.
- Ensured that assertions is enabled in Gradle.
-- Polish up the consistency of sections in User .
\ No newline at end of file
+- Polish up the consistency of sections in the User Guide.
\ No newline at end of file
diff --git a/docs/team/t0nylin.md b/docs/team/t0nylin.md
index 7ca0d703ab..3b229451f7 100644
--- a/docs/team/t0nylin.md
+++ b/docs/team/t0nylin.md
@@ -24,20 +24,26 @@ The following contains my contribution summary and pull request reviews.
- Issue #198: Specifying the correct list index to refer when using take command
- Issue #201: Stating the usage of -h in list command
- Issue #200: Stating in UG that entering the command word alone with print the help message
+- Issue #147: Abidance to a stricter checkstyle
### Developer Guide Contributions
- Added some user stories into the table
+- Added a sequence diagram for how a medication is added into dailyMedicationManager
- Added command guide for how list -t today -m/-a/-e will print
- - Explained how the time ranges affects the addition of each medication into their sub lists
+ - Explained how the time ranges affect the addition of each medication into their sub lists
+- Added more user stories for v2.0 and v.21
+- Added a Glossary section
### User Guide Contributions
- Summary of list for the Daily Medication
- Added breakdown of sub lists within the Daily Medication list
- Helped to construct clearer instructions in UG, especially issues found from PE-D
+- Added a Glossary section
### PR Reviews
-#4, #5, #8, #10, #54, #56, #57, #68, #75, #78, #85, #88, #133, #135, #144, #207, #213 #223
+#4, #5, #8, #10, #54, #56, #57, #68, #75, #78, #85, #88, #133, #135, #144, #207, #213, #223,
+#229, #242, #247, #248
### Team-based tasks
- Book room for weekly project meetings
diff --git a/src/main/java/meditracker/dailymedication/DailyMedication.java b/src/main/java/meditracker/dailymedication/DailyMedication.java
index 46a23d2201..ed770db77e 100644
--- a/src/main/java/meditracker/dailymedication/DailyMedication.java
+++ b/src/main/java/meditracker/dailymedication/DailyMedication.java
@@ -1,10 +1,10 @@
package meditracker.dailymedication;
+import java.util.logging.Logger;
+
import meditracker.logging.MediLogger;
import meditracker.time.Period;
-import java.util.logging.Logger;
-
// @@author T0nyLin
/**
* Stores name and the status of daily medication (taken or not)
diff --git a/src/main/java/meditracker/dailymedication/DailyMedicationManager.java b/src/main/java/meditracker/dailymedication/DailyMedicationManager.java
index 6afa6664f1..296d119ec3 100644
--- a/src/main/java/meditracker/dailymedication/DailyMedicationManager.java
+++ b/src/main/java/meditracker/dailymedication/DailyMedicationManager.java
@@ -1,5 +1,9 @@
package meditracker.dailymedication;
+import java.time.LocalDate;
+import java.util.ArrayList;
+import java.util.List;
+
import meditracker.exception.InsufficientQuantityException;
import meditracker.exception.MedicationNotFoundException;
import meditracker.exception.MedicationUnchangedException;
@@ -10,10 +14,6 @@
import meditracker.time.Period;
import meditracker.ui.Ui;
-import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Manages a list of DailyMedication and CRUD-operations (Create, Read, Update, Delete)
*
@@ -355,7 +355,7 @@ public static boolean doesBelongToDailyList(Medication medication) {
switch (num) {
case 1:
- return true; //everyday
+ return true; //everyday
case 2:
return isNDay(medication, 2); //every 2 days
case 3:
@@ -384,7 +384,7 @@ private static boolean isNDay(Medication medication, int n) {
int dateNum = medication.getDayAdded();
int currentDayValue = currentDate.getDayOfYear();
int daysDiff = currentDayValue - dateNum;
- return daysDiff % n == 0; //modulo to find out if dailyMedication can be added to today's list
+ return daysDiff % n == 0; //modulo to find out if dailyMedication can be added to today's list
}
/**
diff --git a/src/test/java/meditracker/command/ListCommandTest.java b/src/test/java/meditracker/command/ListCommandTest.java
index f154c925e1..87eb4871b2 100644
--- a/src/test/java/meditracker/command/ListCommandTest.java
+++ b/src/test/java/meditracker/command/ListCommandTest.java
@@ -31,7 +31,7 @@
* This test file is to perform tests on ListCommands
*/
class ListCommandTest {
- private ArgumentList testArgumentList = new ArgumentList(
+ private final ArgumentList testArgumentList = new ArgumentList(
new NameArgument(false),
new QuantityArgument(false),
new DosageMorningArgument(false),
@@ -209,8 +209,8 @@ void listAllMedication_unknownFlagAfterCommand_showErrorMessage() {
String testArgumentString = "list -t all -asdf";
assertThrows(
- ArgumentException.class,
- () -> testArgumentList.parse(testArgumentString)
+ ArgumentException.class, ()
+ -> testArgumentList.parse(testArgumentString)
);
}
@@ -267,8 +267,8 @@ void listDailyMedication_unknownFlagAfterCommand_showErrorMessage() {
String testArgumentString = "list -t today -a -asd";
assertThrows(
- ArgumentException.class,
- () -> testArgumentList.parse(testArgumentString)
+ ArgumentException.class, ()
+ -> testArgumentList.parse(testArgumentString)
);
}
@@ -277,8 +277,8 @@ void listDailyMedication_extraWordsAfterFlag_showErrorMessage() {
String testArgumentString = "list -t today -a asdf";
assertThrows(
- ArgumentException.class,
- () -> testArgumentList.parse(testArgumentString)
+ ArgumentException.class, ()
+ -> testArgumentList.parse(testArgumentString)
);
}
}
diff --git a/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java b/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java
index 239872bafd..dd8079e8aa 100644
--- a/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java
+++ b/src/test/java/meditracker/dailymedication/DailyMedicationManagerTest.java
@@ -1,5 +1,19 @@
package meditracker.dailymedication;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
import meditracker.command.AddCommand;
import meditracker.exception.ArgumentException;
import meditracker.exception.HelpInvokedException;
@@ -11,19 +25,6 @@
import meditracker.medication.MedicationManager;
import meditracker.medication.MedicationManagerTest;
import meditracker.time.Period;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
public class DailyMedicationManagerTest {
@@ -31,8 +32,8 @@ public class DailyMedicationManagerTest {
// @@author T0nyLin
public static void resetDailyMedicationManager() throws InvocationTargetException,
IllegalAccessException, NoSuchMethodException {
- Method resetDailyMedicationManagerMethod
- = DailyMedicationManager.class.getDeclaredMethod("clearDailyMedication");
+ Method resetDailyMedicationManagerMethod =
+ DailyMedicationManager.class.getDeclaredMethod("clearDailyMedication");
resetDailyMedicationManagerMethod.setAccessible(true);
resetDailyMedicationManagerMethod.invoke(DailyMedicationManager.class);
}
@@ -129,8 +130,8 @@ public void takeDailyMedication_lowQuantityMedication_insufficientQuantity() thr
int actualIndex = 1; // 1-based indexing
assertThrows(
- InsufficientQuantityException.class,
- () -> DailyMedicationManager.takeDailyMedication(actualIndex, Period.MORNING));
+ InsufficientQuantityException.class, ()
+ -> DailyMedicationManager.takeDailyMedication(actualIndex, Period.MORNING));
}
@Test
diff --git a/src/test/java/meditracker/ui/UiTest.java b/src/test/java/meditracker/ui/UiTest.java
index 4648e3ddec..8815dce1fa 100644
--- a/src/test/java/meditracker/ui/UiTest.java
+++ b/src/test/java/meditracker/ui/UiTest.java
@@ -1,16 +1,17 @@
package meditracker.ui;
-import meditracker.dailymedication.DailyMedication;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import meditracker.dailymedication.DailyMedication;
//Solution below adapted by https://stackoverflow.com/questions/58665761
class UiTest {
@@ -36,8 +37,8 @@ void printMedsList_sizeOfMedicationList_expectPrintedList() {
for (DailyMedication dailyMedication : medications) {
int numbering = medications.indexOf(dailyMedication) + 1;
- expectedOutput.append("\t").
- append(numbering).append(". ").append(dailyMedication)
+ expectedOutput.append("\t")
+ .append(numbering).append(". ").append(dailyMedication)
.append(System.lineSeparator());
}
assertEquals(expectedOutput.toString(), output.toString());