use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class NamedaysListTest method whenYearSpecified_thenFixedYearEventIsReturned.
@Test
public void whenYearSpecified_thenFixedYearEventIsReturned() {
Date dateWithNoYear = Date.Companion.on(1, FIXED_MONTH, FIXED_YEAR);
NamesInADate results = namedays.getNamedaysFor(dateWithNoYear);
assertThat(results.getNames().get(0)).isEqualTo(FIXED_YEAR_NAMEDAY);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class FacebookContactFactory method createContactFrom.
ContactEvent createContactFrom(Map<String, String> map) throws InvalidFacebookContactException {
try {
Date date = dateFrom(map);
DisplayName name = nameFrom(map);
long uid = idOf(map);
URI imagePath = FacebookImagePath.INSTANCE.forUid(uid);
return new ContactEvent(Optional.Companion.<Long>absent(), StandardEventType.BIRTHDAY, date, new Contact(uid, name, imagePath, SOURCE_FACEBOOK));
} catch (DateParseException | IndexOutOfBoundsException ex) {
throw new InvalidFacebookContactException(ex);
}
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class EventLabelCreatorTest method birthdayWithoutYearIsCalculatedCorrectly.
@Test
public void birthdayWithoutYearIsCalculatedCorrectly() {
Date date = Date.Companion.on(12, DECEMBER);
ContactEvent event = contactEventOn(date, BIRTHDAY);
String label = creator.createFor(event);
assertThat(label).isEqualTo("Birthday on December 12");
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class EventLabelCreatorTest method namedayIsCalculatedCorrectly.
@Test
public void namedayIsCalculatedCorrectly() {
Date date = Date.Companion.on(12, DECEMBER);
ContactEvent event = contactEventOn(date, NAMEDAY);
String label = creator.createFor(event);
assertThat(label).isEqualTo("Nameday on December 12");
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class EventLabelCreatorTest method anniversaryIsCalculatedCorrectly.
@Test
public void anniversaryIsCalculatedCorrectly() {
Date date = Date.Companion.on(12, DECEMBER);
ContactEvent event = contactEventOn(date, ANNIVERSARY);
String label = creator.createFor(event);
assertThat(label).isEqualTo("Anniversary on December 12");
}
Aggregations