use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class NamedaysListTest method whenNoYearSpecified_thenFixedYearEventIsNotReturned.
@Test
public void whenNoYearSpecified_thenFixedYearEventIsNotReturned() {
Date dateWithNoYear = Date.Companion.on(1, FIXED_MONTH);
NamesInADate results = namedays.getNamedaysFor(dateWithNoYear);
assertThat(results.getNames()).isEmpty();
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class NamedaysListTest method whenYearSpecified_thenRecurringEventIsReturned.
@Test
public void whenYearSpecified_thenRecurringEventIsReturned() {
Date date = Date.Companion.on(4, FIXED_MONTH, FIXED_YEAR);
NamesInADate results = namedays.getNamedaysFor(date);
assertThat(results.getNames().get(0)).isEqualTo(RECURRING_NAMEDAY);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class NamedaysListTest method whenNoYearSpecified_thenRecurringEventIsReturned.
@Test
public void whenNoYearSpecified_thenRecurringEventIsReturned() {
Date dateWithNoYear = Date.Companion.on(4, FIXED_MONTH);
NamesInADate results = namedays.getNamedaysFor(dateWithNoYear);
assertThat(results.getNames().get(0)).isEqualTo(RECURRING_NAMEDAY);
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class RomanianNamedaysTest method whenCreatingRomanianNamedaysDateIsCalculatedProperly.
@Test
public void whenCreatingRomanianNamedaysDateIsCalculatedProperly() throws Exception {
List<String> expectedNames = Arrays.asList("Florin", "Viorel", "Viorica", "Florin");
RomanianNamedays namedays = new RomanianNamedays(calculator, expectedNames);
List<Date> expectedDates = buildExpectedDates();
for (Date expectedDate : expectedDates) {
NamesInADate allNames = namedays.getNamedaysFor(expectedDate);
List<String> actualNames = allNames.getNames();
if (!expectedNames.equals(actualNames)) {
fail(String.format(Locale.US, "Year [%d] did not contain the correct names [%s]", expectedDate.getYear(), actualNames));
}
}
}
use of com.alexstyl.specialdates.date.Date in project Memento-Calendar by alexstyl.
the class EventLabelCreatorTest method birthdayWithYearIsCalculatedCorrectly.
@Test
public void birthdayWithYearIsCalculatedCorrectly() {
int age = Date.Companion.getCURRENT_YEAR() - 1990;
Date date = Date.Companion.on(12, DECEMBER, 1990);
ContactEvent event = contactEventOn(date, BIRTHDAY);
String label = creator.createFor(event);
assertThat(label).isEqualTo("Turns " + age + " on December 12");
}
Aggregations