Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing testcases to person #32

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions src/test/java/seedu/address/model/person/PersonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,34 +102,51 @@ public void toStringMethod() {
assertEquals(expected, ALICE.toString());
}
@Test
public void getName() {
assertEquals(VALID_NAME_BOB, BOB.getName().toString());
}
@Test
public void getPhone() {
assertEquals(VALID_PHONE_BOB, BOB.getPhone().toString());
}
@Test
public void getEmail() {
assertEquals(VALID_EMAIL_BOB, BOB.getEmail().toString());
}
@Test
public void getAddress() {
assertEquals(VALID_ADDRESS_BOB, BOB.getAddress().toString());
}
@Test
public void getUuidString() {
Person person = new PersonBuilder().build();
String personUuidString = person.getUuidString();
// Solution below adapted from Github Copilot
String uuidFormat = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$";
assertTrue(personUuidString.matches(uuidFormat));
}

@Test public void getUuidString_differentUuids() {
@Test
public void getUuidString_differentUuids() {
Person person1 = new PersonBuilder().build();
Person person2 = new PersonBuilder().build();
assertFalse(person1.getUuidString().equals(person2.getUuidString()));
}

@Test public void equalsUuid_samePerson_true() {
@Test
public void equalsUuid_samePerson_true() {
Person person1 = new PersonBuilder().build();
assertTrue(person1.equalsUuid(person1));
}
@Test public void equalsUuid_differentUuids_false() {
@Test
public void equalsUuid_differentUuids_false() {
Person person1 = new PersonBuilder().build();
Person person2 = new PersonBuilder().build();
assertFalse(person1.equalsUuid(person2));
}
@Test public void equalsUuid_notPerson_false() {
@Test
public void equalsUuid_notPerson_false() {
Person person1 = new PersonBuilder().build();
assertFalse(person1.equalsUuid("not a person"));
}

@Test
public void getUuid() {
assertTrue(ALICE.getUuid() != null);
Expand Down
Loading