Search in sources :

Example 41 with Date

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();
}
Also used : Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 42 with Date

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);
}
Also used : Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 43 with Date

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);
}
Also used : Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 44 with Date

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));
        }
    }
}
Also used : Date(com.alexstyl.specialdates.date.Date) RomanianNamedays(com.alexstyl.specialdates.events.namedays.calendar.resource.RomanianNamedays) Test(org.junit.Test)

Example 45 with Date

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");
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Aggregations

Date (com.alexstyl.specialdates.date.Date)53 Test (org.junit.Test)34 ContactEvent (com.alexstyl.specialdates.date.ContactEvent)12 Contact (com.alexstyl.specialdates.contact.Contact)6 ContactEventsOnADate (com.alexstyl.specialdates.events.peopleevents.ContactEventsOnADate)6 ArrayList (java.util.ArrayList)4 View (android.view.View)3 Intent (android.content.Intent)2 RecyclerView (android.support.v7.widget.RecyclerView)2 TextView (android.widget.TextView)2 NamedayBundle (com.alexstyl.specialdates.events.namedays.NamedayBundle)2 NamedaysList (com.alexstyl.specialdates.events.namedays.NamedaysList)2 NamesInADate (com.alexstyl.specialdates.events.namedays.NamesInADate)2 Calendar (java.util.Calendar)2 DatePickerDialog (android.app.DatePickerDialog)1 PendingIntent (android.app.PendingIntent)1 DialogInterface (android.content.DialogInterface)1 Preference (android.preference.Preference)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RemoteViews (android.widget.RemoteViews)1