Search in sources :

Example 6 with ContactEvent

use of com.alexstyl.specialdates.date.ContactEvent 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 7 with ContactEvent

use of com.alexstyl.specialdates.date.ContactEvent 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 8 with ContactEvent

use of com.alexstyl.specialdates.date.ContactEvent in project Memento-Calendar by alexstyl.

the class FacebookContactFactoryTest method name.

@Test
public void name() throws DateParseException, InvalidFacebookContactException {
    HashMap<String, String> map = new HashMap<>();
    map.put("UID", "b123124@facebook.com");
    map.put("DTSTART", "20180612");
    map.put("SUMMARY", "Thanasis Thomopoulos's birthday");
    ContactEvent contactEvent = factory.createContactFrom(map);
    Contact contact = contactEvent.getContact();
    assertThat(contact.getDisplayName()).isEqualTo(DisplayName.Companion.from("Thanasis Thomopoulos"));
    assertThat(contact.getContactID()).isEqualTo(123124);
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) HashMap(java.util.HashMap) Contact(com.alexstyl.specialdates.contact.Contact) Test(org.junit.Test)

Example 9 with ContactEvent

use of com.alexstyl.specialdates.date.ContactEvent in project Memento-Calendar by alexstyl.

the class FacebookBirthdaysProviderTest method parseMockCalendar.

@Test
public void parseMockCalendar() throws CalendarFetcherException, MalformedURLException {
    FacebookContactFactory factory = new FacebookContactFactory(parser);
    FacebookBirthdaysProvider fetcher = new FacebookBirthdaysProvider(new FacebookCalendarLoader(), new ContactEventSerialiser(factory, tracker));
    URL url = new URL(CALENDAR_URL);
    List<ContactEvent> contacts = fetcher.fetchCalendarFrom(url);
    assertThat(contacts).isNotEmpty();
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) URL(java.net.URL) Test(org.junit.Test)

Example 10 with ContactEvent

use of com.alexstyl.specialdates.date.ContactEvent 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

ContactEvent (com.alexstyl.specialdates.date.ContactEvent)22 Test (org.junit.Test)13 Date (com.alexstyl.specialdates.date.Date)12 Contact (com.alexstyl.specialdates.contact.Contact)9 ArrayList (java.util.ArrayList)8 ContactEventsOnADate (com.alexstyl.specialdates.events.peopleevents.ContactEventsOnADate)3 URL (java.net.URL)3 Notification (android.app.Notification)1 PendingIntent (android.app.PendingIntent)1 ContentValues (android.content.ContentValues)1 Intent (android.content.Intent)1 Bitmap (android.graphics.Bitmap)1 Paint (android.graphics.Paint)1 NotificationCompat (android.support.v4.app.NotificationCompat)1 Spannable (android.text.Spannable)1 SpannableString (android.text.SpannableString)1 StyleSpan (android.text.style.StyleSpan)1 DisplayName (com.alexstyl.specialdates.contact.DisplayName)1 DateParseException (com.alexstyl.specialdates.date.DateParseException)1 TimePeriod (com.alexstyl.specialdates.date.TimePeriod)1