Skip to content

Commit

Permalink
Make case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
nixonwidjaja committed Nov 5, 2023
1 parent eb43021 commit 5dd6605
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public boolean equals(Object other) {
}

Address otherAddress = (Address) other;
return value.equals(otherAddress.value);
return value.equalsIgnoreCase(otherAddress.value);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public boolean equals(Object other) {
}

Email otherEmail = (Email) other;
return value.equals(otherEmail.value);
return value.equalsIgnoreCase(otherEmail.value);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public boolean equals(Object other) {
}

Name otherName = (Name) other;
return fullName.equals(otherName.fullName);
return fullName.equalsIgnoreCase(otherName.fullName);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/model/person/PersonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public void isSamePerson() {
editedAlice = new PersonBuilder(ALICE).withPhone("911").withEmail("[email protected]").build();
assertFalse(ALICE.isSamePerson(editedAlice));

// name differs in case, all other attributes same -> returns false
// 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));

// name has trailing spaces, all other attributes same -> returns true
String nameWithTrailingSpaces = VALID_NAME_BOB + " ";
Expand Down

0 comments on commit 5dd6605

Please sign in to comment.