Search in sources :

Example 11 with Date

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

Example 12 with Date

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);
    }
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) DateParseException(com.alexstyl.specialdates.date.DateParseException) DisplayName(com.alexstyl.specialdates.contact.DisplayName) URI(java.net.URI) Date(com.alexstyl.specialdates.date.Date) Contact(com.alexstyl.specialdates.contact.Contact)

Example 13 with Date

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

Example 14 with Date

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

Example 15 with Date

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");
}
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