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 branch 'master' into implement-delete
- Loading branch information
Showing
20 changed files
with
63 additions
and
54 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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"phone": "94351253", | ||
"email": "[email protected]", | ||
"address": "123, Jurong West Ave 6, #08-111", | ||
"tags": "High Risk" | ||
"tag": "High Risk" | ||
}, { | ||
"name": "Alice Pauline", | ||
"phone": "94351253", | ||
|
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,8 +28,8 @@ 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_PHONE_AMY = "11111111"; | ||
public static final String VALID_PHONE_BOB = "22222222"; | ||
public static final String VALID_PHONE_AMY = "99999999"; | ||
public static final String VALID_PHONE_BOB = "88888888"; | ||
public static final String VALID_EMAIL_AMY = "[email protected]"; | ||
public static final String VALID_EMAIL_BOB = "[email protected]"; | ||
public static final String VALID_ADDRESS_AMY = "Block 312, Amy Street 1"; | ||
|
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 |
---|---|---|
|
@@ -22,7 +22,7 @@ public class ParserUtilTest { | |
private static final String INVALID_TAG = "#friend"; | ||
|
||
private static final String VALID_NAME = "Rachel Walker"; | ||
private static final String VALID_PHONE = "123456"; | ||
private static final String VALID_PHONE = "98765432"; | ||
private static final String VALID_ADDRESS = "123 Main Street #0505"; | ||
private static final String VALID_EMAIL = "[email protected]"; | ||
private static final String VALID_TAG_1 = "High Risk"; | ||
|
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 |
---|---|---|
|
@@ -69,8 +69,8 @@ public void test_nameDoesNotContainKeywords_returnsFalse() { | |
assertFalse(predicate.test(new PersonBuilder().withName("Alice Bob").build())); | ||
|
||
// Keywords match phone, email and address, but does not match name | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("12345", "[email protected]", "Main", "Street")); | ||
assertFalse(predicate.test(new PersonBuilder().withName("Alice").withPhone("12345") | ||
predicate = new NameContainsKeywordsPredicate(Arrays.asList("98765432", "[email protected]", "Main", "Street")); | ||
assertFalse(predicate.test(new PersonBuilder().withName("Alice").withPhone("98765432") | ||
.withEmail("[email protected]").withAddress("Main Street").build())); | ||
} | ||
|
||
|
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 |
---|---|---|
|
@@ -26,18 +26,26 @@ public void isSamePerson() { | |
// null -> returns false | ||
assertFalse(ALICE.isSamePerson(null)); | ||
|
||
// same name, all other attributes different -> returns true | ||
// same name, all other attributes different -> returns false | ||
Person editedAlice = new PersonBuilder(ALICE).withPhone(VALID_PHONE_BOB).withEmail(VALID_EMAIL_BOB) | ||
.withAddress(VALID_ADDRESS_BOB).withTags(VALID_TAG_HIGH_RISK).build(); | ||
assertTrue(ALICE.isSamePerson(editedAlice)); | ||
.withAddress(VALID_ADDRESS_BOB).withTag(VALID_TAG_HIGH_RISK).build(); | ||
assertFalse(ALICE.isSamePerson(editedAlice)); | ||
|
||
// different name, all other attributes same -> returns false | ||
// different name, phone number same -> returns false | ||
editedAlice = new PersonBuilder(ALICE).withName(VALID_NAME_BOB).build(); | ||
assertFalse(ALICE.isSamePerson(editedAlice)); | ||
|
||
// name differs in case, all other attributes same -> returns false | ||
//different people -> returns false | ||
assertFalse(ALICE.isSamePerson(BOB)); | ||
|
||
// name differs in case, all other attributes same -> returns true | ||
Person editedBob = new PersonBuilder(BOB).withName(VALID_NAME_BOB.toLowerCase()).build(); | ||
assertFalse(BOB.isSamePerson(editedBob)); | ||
assertTrue(BOB.isSamePerson(editedBob)); | ||
|
||
//same name, same phone number, all other attributes different -> returns true | ||
editedAlice = new PersonBuilder(ALICE).withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB) | ||
.withTag(VALID_TAG_HIGH_RISK).build(); | ||
assertTrue(ALICE.isSamePerson(editedAlice)); | ||
|
||
// name has trailing spaces, all other attributes same -> returns false | ||
String nameWithTrailingSpaces = VALID_NAME_BOB + " "; | ||
|
@@ -81,7 +89,7 @@ public void equals() { | |
assertFalse(ALICE.equals(editedAlice)); | ||
|
||
// different tags -> returns false | ||
editedAlice = new PersonBuilder(ALICE).withTags(VALID_TAG_LOW_RISK).build(); | ||
editedAlice = new PersonBuilder(ALICE).withTag(VALID_TAG_LOW_RISK).build(); | ||
assertFalse(ALICE.equals(editedAlice)); | ||
|
||
} | ||
|
@@ -99,13 +107,13 @@ public void hashCode_differentPersons_differentHashCode() { | |
@Test | ||
public void constructor_allFieldsPresent_success() { | ||
Person person = new PersonBuilder().withName("Charlie") | ||
.withPhone("12345678") | ||
.withPhone("98765432") | ||
.withEmail("[email protected]") | ||
.withAddress("123, Charlies Street") | ||
.withTags("Medium Risk").build(); | ||
.withTag("Medium Risk").build(); | ||
|
||
assertEquals("Charlie", person.getName().toString()); | ||
assertEquals("12345678", person.getPhone().toString()); | ||
assertEquals("98765432", person.getPhone().toString()); | ||
assertEquals("[email protected]", person.getEmail().toString()); | ||
assertEquals("123, Charlies Street", person.getAddress().toString()); | ||
assertEquals("Medium Risk", person.getTag().toString()); | ||
|
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 |
---|---|---|
|
@@ -26,33 +26,33 @@ public class TypicalPersons { | |
public static final Person ALICE = new PersonBuilder().withName("Alice Pauline") | ||
.withAddress("123, Jurong West Ave 6, #08-111").withEmail("[email protected]") | ||
.withPhone("94351253") | ||
.withTags("High Risk").build(); | ||
.withTag("High Risk").build(); | ||
public static final Person BENSON = new PersonBuilder().withName("Benson Meier") | ||
.withAddress("311, Clementi Ave 2, #02-25") | ||
.withEmail("[email protected]").withPhone("98765432") | ||
.withTags("High Risk").build(); | ||
.withTag("High Risk").build(); | ||
public static final Person CARL = new PersonBuilder().withName("Carl Kurz").withPhone("94351253") | ||
.withEmail("[email protected]").withAddress("wall street").build(); | ||
public static final Person DANIEL = new PersonBuilder().withName("Daniel Meier").withPhone("87652533") | ||
.withEmail("[email protected]").withAddress("10th street").withTags("Low Risk").build(); | ||
.withEmail("[email protected]").withAddress("10th street").withTag("Low Risk").build(); | ||
public static final Person ELLE = new PersonBuilder().withName("Elle Meyer").withPhone("94822242") | ||
.withEmail("[email protected]").withAddress("michegan ave").withTags("Low Risk").build(); | ||
.withEmail("[email protected]").withAddress("michegan ave").withTag("Low Risk").build(); | ||
public static final Person FIONA = new PersonBuilder().withName("Fiona Kunz").withPhone("94824272") | ||
.withEmail("[email protected]").withAddress("little tokyo").withTags("Low Risk").build(); | ||
.withEmail("[email protected]").withAddress("little tokyo").withTag("Low Risk").build(); | ||
public static final Person GEORGE = new PersonBuilder().withName("George Best").withPhone("94824422") | ||
.withEmail("[email protected]").withAddress("4th street").withTags("Low Risk").build(); | ||
.withEmail("[email protected]").withAddress("4th street").withTag("Low Risk").build(); | ||
|
||
// Manually added | ||
public static final Person HOON = new PersonBuilder().withName("Hoon Meier").withPhone("84824242") | ||
.withEmail("[email protected]").withAddress("little india").withTags("High Risk").build(); | ||
.withEmail("[email protected]").withAddress("little india").withTag("High Risk").build(); | ||
public static final Person IDA = new PersonBuilder().withName("Ida Mueller").withPhone("84821312") | ||
.withEmail("[email protected]").withAddress("chicago ave").withTags("High Risk").build(); | ||
.withEmail("[email protected]").withAddress("chicago ave").withTag("High Risk").build(); | ||
|
||
// Manually added - Person's details found in {@code CommandTestUtil} | ||
public static final Person AMY = new PersonBuilder().withName(VALID_NAME_AMY).withPhone(VALID_PHONE_AMY) | ||
.withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_AMY).withTags(VALID_TAG_LOW_RISK).build(); | ||
.withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_AMY).withTag(VALID_TAG_LOW_RISK).build(); | ||
public static final Person BOB = new PersonBuilder().withName(VALID_NAME_BOB).withPhone(VALID_PHONE_BOB) | ||
.withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB).withTags(VALID_TAG_HIGH_RISK) | ||
.withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB).withTag(VALID_TAG_HIGH_RISK) | ||
.build(); | ||
|
||
public static final String KEYWORD_MATCHING_MEIER = "Meier"; // A keyword that matches MEIER | ||
|