You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@OverridepublicvoidaddBirthday (IndextargetIndex, BirthdaytoAdd) throwsPersonNotFoundException {
fail("This method should not be called.");
}
@OverridepublicBooleansortPersonByName(ArrayList<ReadOnlyPerson> contactList) {
fail("This method should not be called.");
returnfalse;
}
}
publicclassExtendedPersonDisplayTestextendsGuiUnitTest {
privateExtendedPersonDisplayextendedPersonDisplay;
privateExtendedPersonDisplayHandleextendedPersonDisplayHandle;
@BeforepublicvoidsetUp() {
try {
guiRobot.interact(() -> extendedPersonDisplay = newExtendedPersonDisplay());
uiPartRule.setUiPart(extendedPersonDisplay);
extendedPersonDisplayHandle = newExtendedPersonDisplayHandle(extendedPersonDisplay.getRoot());
} catch (NullPointerExceptione) {
thrownewNullPointerException();
}
}
@Testpublicvoiddisplay() {
//ReadOnlyPerson personForTesting = ALICE;postNow(newPersonPanelSelectionChangedEvent(newPersonCard(ALICE, 0)));
assertExtendedPersonCardDisplay(ALICE, extendedPersonDisplayHandle);
//personForTesting = BOB;postNow(newPersonPanelSelectionChangedEvent(newPersonCard(DANIEL, 3)));
assertExtendedPersonCardDisplay(DANIEL, extendedPersonDisplayHandle);
}
@Testpublicvoidequals() {
Personperson = newPersonBuilder().build();
PersonCardpersonCard = newPersonCard(person, 0);
// same person, same index -> returns truePersonCardcopy = newPersonCard(person, 0);
assertTrue(personCard.equals(copy));
// same object -> returns trueassertTrue(personCard.equals(personCard));
// null -> returns falseassertFalse(personCard.equals(null));
// different types -> returns falseassertFalse(personCard.equals(0));
// different person, same index -> returns falsePersondifferentPerson = newPersonBuilder().withName("differentName").build();
assertFalse(personCard.equals(newPersonCard(differentPerson, 0)));
// same person, different index -> returns falseassertFalse(personCard.equals(newPersonCard(person, 1)));
}
/** * Asserts that {@code extendedPersonDisplay} shows the details of {@code expectedPerson} correctly. */privatevoidassertExtendedPersonCardDisplay(ReadOnlyPersonexpectedPerson, ExtendedPersonDisplayHandleextendedPersonDisplayHandle) {
guiRobot.pauseForHuman();
// verify person details are displayed correctlyassertExtendedCardDisplaysPerson(expectedPerson, extendedPersonDisplayHandle);
}
}
/java/seedu/address/ui/StatusBarFooterTest.java
@BeforepublicvoidsetUp() {
StatusBarFooterstatusBarFooter = newStatusBarFooter(STUB_SAVE_LOCATION, TOTAL_NUMBER_PEOPLE);
uiPartRule.setUiPart(statusBarFooter);
statusBarFooterHandle = newStatusBarFooterHandle(statusBarFooter.getRoot());
}
@Testpublicvoiddisplay() {
// initial stateassertStatusBarContent(RELATIVE_PATH + STUB_SAVE_LOCATION, SYNC_STATUS_INITIAL, TOTAL_PEOPLE);
// after address book is updatedpostNow(EVENT_STUB);
assertStatusBarContent(RELATIVE_PATH + STUB_SAVE_LOCATION,
String.format(SYNC_STATUS_UPDATED, newDate(injectedClock.millis()).toString()), TOTAL_PEOPLE);
}
/** * Asserts that the save location matches that of {@code expectedSaveLocation}, * the expected number of people and the * sync status matches that of {@code expectedSyncStatus}. */privatevoidassertStatusBarContent(StringexpectedSaveLocation,
StringexpectedSyncStatus, StringexpectedTotalPeople) {
assertEquals(expectedSaveLocation, statusBarFooterHandle.getSaveLocation());
assertEquals(expectedSyncStatus, statusBarFooterHandle.getSyncStatus());
assertEquals(expectedTotalPeople, statusBarFooterHandle.getTotalPeople());
guiRobot.pauseForHuman();
}
}
/** * Asserts that {@code extendedCard} displays the details of {@code expectedPerson}. */publicstaticvoidassertExtendedCardDisplaysPerson(ReadOnlyPersonexpectedPerson, ExtendedPersonDisplayHandleextendedCard) {
assertEquals(expectedPerson.getName().fullName, extendedCard.getName());
assertEquals(expectedPerson.getPhone().value, extendedCard.getPhone());
assertEquals(expectedPerson.getEmail().value, extendedCard.getEmail());
assertEquals(expectedPerson.getAddress().value, extendedCard.getAddress());
assertEquals(expectedPerson.getBirthday().toString(), extendedCard.getBirthday());
}
/java/seedu/address/testutil/PersonBuilder.java
/** * Sets the {@code Birthday} of the {@code Person} that we are building. *///havent add withBirthday function to the typical persons class being builtpublicPersonBuilderwithBirthday(Stringbirthday) {
try {
this.person.setBirthday(newBirthday(birthday));
} catch (IllegalValueExceptionive) {
thrownewIllegalArgumentException("birthday is expected to be unique.");
}
returnthis;
}
publicPersonbuild() {
returnthis.person;
}
}
/** * Sets the {@code Birthday} of the {@code EditPersonDescriptor} that we are building. */publicEditPersonDescriptorBuilderwithBirthday(Stringbirthday) {
try {
ParserUtil.parseBirthday(Optional.of(birthday)).ifPresent(descriptor::setBirthday);
} catch (IllegalValueExceptionive) {
thrownewIllegalArgumentException("birthday is expected to be unique.");
}
returnthis;
}