From 7d34310d35cb4a592a1679d1995d7e9681578ac6 Mon Sep 17 00:00:00 2001 From: kohkaijie Date: Fri, 10 Nov 2023 17:02:06 +0800 Subject: [PATCH] Update UG and add test cases Updated UG to resolve minor discrepancies and added test cases checking for valid NRIC involving non-caps letter inputs. --- docs/UserGuide.md | 16 ++++----- .../java/seedu/address/model/person/Ic.java | 2 +- .../address/logic/parser/ParserUtilTest.java | 33 +++++++++++++++++++ .../seedu/address/model/person/IcTest.java | 1 + 4 files changed, 43 insertions(+), 9 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 1fb7bc2921d..11c5b7d1233 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -3,7 +3,7 @@ layout: page title: User Guide --- -MediLink Contacts(MLC) is a **desktop app for managing patients and doctors details, optimized for use via a Command +MediLink Contacts (MLC) is a **desktop app for managing patients and doctors details, optimized for use via a Command Line Interface** (CLI) while still having the benefits of a Graphical User Interface (GUI). If you can type fast, MLC can get your patients management tasks done faster than traditional GUI apps. @@ -19,16 +19,16 @@ can get your patients management tasks done faster than traditional GUI apps. 1. Ensure you have Java `11` or above installed in your Computer. If you don't, install it for your relevant operating system at this link https://www.oracle.com/sg/java/technologies/javase/jdk11-archive-downloads.html -1. Download the latest `MediLink.jar` from [here](https://github.com/AY2324S1-CS2103T-T09-3/tp/releases). +2. Download the latest `MediLink.jar` from [here](https://github.com/AY2324S1-CS2103T-T09-3/tp/releases). -1. Copy the file to the folder you want to use as the _home folder_ for your MLC. +3. Copy the file to the folder you want to use as the _home folder_ for your MLC. -1. Open a command terminal, `cd` into the folder you put the jar file in, and use the `java -jar MediLink.jar` command +4. Open a command terminal, `cd` into the folder you put the jar file in, and use the `java -jar MediLink.jar` command to run the application.
A GUI similar to the below should appear in a few seconds. Note how the app contains some sample data.
![Ui](images/Ui.png) -1. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will +5. Type the command in the command box and press Enter to execute it. e.g. typing **`help`** and pressing Enter will open the help window.
Some example commands you can try: @@ -43,7 +43,7 @@ can get your patients management tasks done faster than traditional GUI apps. * `exit` : Exits the app. -1. Refer to the [Features](#features) below for details of each command. +6. Refer to the [Features](#features) below for details of each command. -------------------------------------------------------------------------------------------------------------------- ## Parameters @@ -93,7 +93,7 @@ The list below contains the parameters that are used in various commands as well ### Viewing help : `help` -Shows a message explaning how to access the help page. +Shows a message explaining how to access the help page. ![help message](images/helpMessage.png) @@ -228,7 +228,7 @@ Examples: ### Listing all persons : `list` -Shows a list of all persons in the MediLink Contacts. +Shows a list of all persons and appointments in the MediLink Contacts. Format: `list` diff --git a/src/main/java/seedu/address/model/person/Ic.java b/src/main/java/seedu/address/model/person/Ic.java index 1df4b5fa569..1ae41880bf2 100644 --- a/src/main/java/seedu/address/model/person/Ic.java +++ b/src/main/java/seedu/address/model/person/Ic.java @@ -12,7 +12,7 @@ public class Ic { public static final String MESSAGE_CONSTRAINTS = "Ic should start with S or T, followed by 7 numbers, and ends with a letter. " - + "Letters must be in all caps. Empty strings are not allowed\n"; + + "Letters inputs are case-insensitive. Empty strings are not allowed\n"; public static final String VALIDATION_REGEX = "^[TS]\\d{7}[A-Z]$"; public final String value; diff --git a/src/test/java/seedu/address/logic/parser/ParserUtilTest.java b/src/test/java/seedu/address/logic/parser/ParserUtilTest.java index c892b2a76ea..5e6e6be3fef 100644 --- a/src/test/java/seedu/address/logic/parser/ParserUtilTest.java +++ b/src/test/java/seedu/address/logic/parser/ParserUtilTest.java @@ -16,6 +16,7 @@ import seedu.address.logic.parser.exceptions.ParseException; import seedu.address.model.person.Address; import seedu.address.model.person.Email; +import seedu.address.model.person.Ic; import seedu.address.model.person.Name; import seedu.address.model.person.Phone; import seedu.address.model.tag.Tag; @@ -25,6 +26,8 @@ public class ParserUtilTest { private static final String INVALID_PHONE = "+651234"; private static final String INVALID_ADDRESS = " "; private static final String INVALID_EMAIL = "example.com"; + private static final String INVALID_IC1 = "Y9834876G"; + private static final String INVALID_IC2 = "T934865H"; private static final String INVALID_PATIENT_TAG = "priority: HIGHEST"; private static final String INVALID_DOCTOR_TAG1 = "NURSE"; @@ -32,6 +35,8 @@ public class ParserUtilTest { private static final String VALID_PHONE = "123456"; private static final String VALID_ADDRESS = "123 Main Street #0505"; private static final String VALID_EMAIL = "rachel@example.com"; + private static final String VALID_IC1 = "T1234567H"; + private static final String VALID_IC2 = "t1234567h"; private static final String VALID_TAG1 = "FRIENDS"; private static final String VALID_TAG2 = "STUDENT"; private static final String VALID_PATIENT_TAG1 = "priority: LOW"; @@ -153,6 +158,34 @@ public void parseEmail_validValueWithWhitespace_returnsTrimmedEmail() throws Exc assertEquals(expectedEmail, ParserUtil.parseEmail(emailWithWhitespace)); } + @Test + public void parseIc_null_throwsNullPointerException() { + assertThrows(NullPointerException.class, () -> ParserUtil.parseIc((String) null)); + } + + @Test + public void parseIc_invalidStartingCharacter_throwsParseException() { + assertThrows(ParseException.class, () -> ParserUtil.parseIc(INVALID_IC1)); + } + + @Test + public void parseIc_invalidNumbers_throwsParseException() { + assertThrows(ParseException.class, () -> ParserUtil.parseIc(INVALID_IC2)); + } + + @Test + public void parseIc_validIcWithCaps_returnsIc() throws Exception { + Ic expectedIc = new Ic(VALID_IC1); + assertEquals(expectedIc, ParserUtil.parseIc(VALID_IC1)); + } + + @Test + public void parseIc_validIcWithoutCaps_returnsIc() throws Exception { + String inputIc = VALID_IC2.toUpperCase(); + Ic expectedIc = new Ic(inputIc); + assertEquals(expectedIc, ParserUtil.parseIc(VALID_IC2)); + } + @Test public void parseTag_null_throwsNullPointerException() { assertThrows(NullPointerException.class, () -> ParserUtil.parseTag(null)); diff --git a/src/test/java/seedu/address/model/person/IcTest.java b/src/test/java/seedu/address/model/person/IcTest.java index eb3c4ec5de4..bb24fcdea6f 100644 --- a/src/test/java/seedu/address/model/person/IcTest.java +++ b/src/test/java/seedu/address/model/person/IcTest.java @@ -34,6 +34,7 @@ public void isValidIc() { assertFalse(Ic.isValidIc(" ")); // spaces only assertFalse(Ic.isValidIc("S333444Z")); // only 6 numbers included assertFalse(Ic.isValidIc("G2223331H")); // starting alphabet not S or T + assertFalse(Ic.isValidIc("s2223331H")); // alphabets not in caps // valid nric assertTrue(Ic.isValidIc("S0345999H")); // starting alphabet S