Skip to content

Commit

Permalink
Name cannot have double space
Browse files Browse the repository at this point in the history
  • Loading branch information
saiutkarsh33 committed Apr 8, 2024
1 parent 8fe6793 commit b5197cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
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 @@ -14,7 +14,7 @@ public class Name {
+ "and should not be blank";

/*
* The first character of the address must not be a whitespace,
* The first character of the name must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "[A-Z][a-z]*(\\s[A-Z][a-z]*)*";
Expand Down
1 change: 1 addition & 0 deletions src/test/java/seedu/address/model/person/NameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void isValidName() {
assertFalse(Name.isValidName("peter*")); // contains non-alphanumeric characters
assertFalse(Name.isValidName("12345")); // numbers only
assertFalse(Name.isValidName("Peter The 2nd")); // alphanumeric characters
assertFalse(Name.isValidName("Peter T")); // Double space

// valid name
assertTrue(Name.isValidName("Peter Jack")); // alphabets only
Expand Down

0 comments on commit b5197cf

Please sign in to comment.