forked from nus-cs2103-AY2425S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from dasha3412/branch-addFeature
Make Address optional
- Loading branch information
Showing
13 changed files
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,18 +28,22 @@ public class CommandTestUtil { | |
|
||
public static final String VALID_NAME_AMY = "Amy Bee"; | ||
public static final String VALID_NAME_BOB = "Bob Choo"; | ||
public static final String VALID_NAME_CLIVE = "Clive Fairfield"; | ||
public static final String VALID_NAME_DOMINIC = "Dominic Cheung"; | ||
public static final String VALID_NAME_ERIC = "Eric Caroll"; | ||
public static final String VALID_PHONE_AMY = "11111111"; | ||
public static final String VALID_PHONE_BOB = "22222222"; | ||
public static final String VALID_PHONE_CLIVE = "33333333"; | ||
public static final String VALID_PHONE_DOMINIC = ""; | ||
public static final String VALID_PHONE_ERIC = "65555656"; | ||
public static final String VALID_EMAIL_AMY = "[email protected]"; | ||
public static final String VALID_EMAIL_BOB = "[email protected]"; | ||
public static final String VALID_EMAIL_CLIVE = "[email protected]"; | ||
public static final String VALID_EMAIL_DOMINIC = "[email protected]"; | ||
public static final String VALID_EMAIL_ERIC = ""; | ||
public static final String VALID_ADDRESS_AMY = "Block 312, Amy Street 1"; | ||
public static final String VALID_ADDRESS_BOB = "Block 123, Bobby Street 3"; | ||
public static final String VALID_ADDRESS_BLANK = ""; | ||
public static final String VALID_ADDRESS_DOMINIC = "Block 9192, Dominican Street 4"; | ||
public static final String VALID_ADDRESS_ERIC = "Avenue 4, 201/1112"; | ||
public static final String VALID_TAG_HUSBAND = "husband"; | ||
|
@@ -48,14 +52,17 @@ public class CommandTestUtil { | |
|
||
public static final String NAME_DESC_AMY = " " + PREFIX_NAME + VALID_NAME_AMY; | ||
public static final String NAME_DESC_BOB = " " + PREFIX_NAME + VALID_NAME_BOB; | ||
public static final String NAME_DESC_CLIVE = " " + PREFIX_NAME + VALID_NAME_CLIVE; | ||
public static final String NAME_DESC_DOMINIC = " " + PREFIX_NAME + VALID_NAME_DOMINIC; | ||
public static final String NAME_DESC_ERIC = " " + PREFIX_NAME + VALID_NAME_ERIC; | ||
public static final String PHONE_DESC_AMY = " " + PREFIX_PHONE + VALID_PHONE_AMY; | ||
public static final String PHONE_DESC_BOB = " " + PREFIX_PHONE + VALID_PHONE_BOB; | ||
public static final String PHONE_DESC_CLIVE = " " + PREFIX_PHONE + VALID_PHONE_CLIVE; | ||
public static final String PHONE_DESC_DOMINIC = " " + PREFIX_PHONE + VALID_PHONE_DOMINIC; | ||
public static final String PHONE_DESC_ERIC = " " + PREFIX_PHONE + VALID_PHONE_ERIC; | ||
public static final String EMAIL_DESC_AMY = " " + PREFIX_EMAIL + VALID_EMAIL_AMY; | ||
public static final String EMAIL_DESC_BOB = " " + PREFIX_EMAIL + VALID_EMAIL_BOB; | ||
public static final String EMAIL_DESC_CLIVE = " " + PREFIX_EMAIL + VALID_EMAIL_CLIVE; | ||
public static final String EMAIL_DESC_DOMINIC = " " + PREFIX_EMAIL + VALID_EMAIL_DOMINIC; | ||
public static final String EMAIL_DESC_ERIC = " " + PREFIX_EMAIL + VALID_EMAIL_ERIC; | ||
public static final String ADDRESS_DESC_AMY = " " + PREFIX_ADDRESS + VALID_ADDRESS_AMY; | ||
|
@@ -64,15 +71,15 @@ public class CommandTestUtil { | |
public static final String ADDRESS_DESC_ERIC = " " + PREFIX_ADDRESS + VALID_ADDRESS_ERIC; | ||
public static final String TAG_DESC_FRIEND = " " + PREFIX_TAG + VALID_TAG_FRIEND; | ||
public static final String TAG_DESC_HUSBAND = " " + PREFIX_TAG + VALID_TAG_HUSBAND; | ||
public static final String TAG_DESC_NEIGHBOR = " " + PREFIX_TAG + VALID_TAG_NEIGHBOR; | ||
|
||
public static final String INVALID_NAME_DESC = " " + PREFIX_NAME + "James&"; // '&' not allowed in names | ||
public static final String INVALID_PHONE_DESC = " " + PREFIX_PHONE + "911a"; // 'a' not allowed in phones | ||
// phone numbers must be at least 2 digits | ||
public static final String INVALID_PHONE_DESC_TOO_SHORT = " " + PREFIX_PHONE + "91"; | ||
public static final String INVALID_EMAIL_DESC = " " + PREFIX_EMAIL + "bob!yahoo"; // missing '@' symbol | ||
public static final String INVALID_ADDRESS_DESC = " " + PREFIX_ADDRESS; // empty string not allowed for addresses | ||
public static final String INVALID_TAG_DESC = " " + PREFIX_TAG + "hubby*"; // '*' not allowed in tags | ||
|
||
public static final String BLANK_ADDRESS_DESC = " " + PREFIX_ADDRESS + VALID_ADDRESS_BLANK; | ||
public static final String PREAMBLE_WHITESPACE = "\t \r \n"; | ||
public static final String PREAMBLE_NON_EMPTY = "NonEmptyPreamble"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,6 @@ | |
public class ParserUtilTest { | ||
private static final String INVALID_NAME = "R@chel"; | ||
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_TAG = "#friend"; | ||
|
||
|
@@ -33,7 +32,7 @@ public class ParserUtilTest { | |
private static final String VALID_EMAIL = "[email protected]"; | ||
private static final String VALID_TAG_1 = "friend"; | ||
private static final String VALID_TAG_2 = "neighbour"; | ||
|
||
private static final String BLANK_ADDRESS = ""; | ||
private static final String WHITESPACE = " \t\r\n"; | ||
|
||
@Test | ||
|
@@ -108,8 +107,9 @@ public void parseAddress_null_throwsNullPointerException() { | |
} | ||
|
||
@Test | ||
public void parseAddress_invalidValue_throwsParseException() { | ||
assertThrows(ParseException.class, () -> ParserUtil.parseAddress(INVALID_ADDRESS)); | ||
public void parseAddress_blankValue_returnsBlankAddressTrimmed() throws Exception { | ||
Address expectedAddress = new Address(BLANK_ADDRESS); | ||
assertEquals(expectedAddress, ParserUtil.parseAddress(WHITESPACE)); | ||
} | ||
|
||
@Test | ||
|
Oops, something went wrong.