Search in sources :

Example 16 with Date

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

the class EventLabelCreatorTest method otherIsCalculatedCorrectly.

@Test
public void otherIsCalculatedCorrectly() {
    Date date = Date.Companion.on(12, DECEMBER);
    ContactEvent event = contactEventOn(date, OTHER);
    String label = creator.createFor(event);
    assertThat(label).isEqualTo("Other on December 12");
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 17 with Date

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

the class ContactActionTest method testReturnedContactsSizeIsCorrect.

@Test
public void testReturnedContactsSizeIsCorrect() {
    Date date = Date.Companion.on(1, JANUARY, 2016);
    ArrayList<ContactEvent> contactEvent = new ArrayList<>();
    contactEvent.add(EVENT_ONE);
    contactEvent.add(EVENT_TWO);
    ContactEventsOnADate events = ContactEventsOnADate.Companion.createFrom(date, contactEvent);
    List<Contact> contacts = events.getContacts();
    assertThat(contacts.size()).isEqualTo(2);
}
Also used : ContactEvent(com.alexstyl.specialdates.date.ContactEvent) ArrayList(java.util.ArrayList) ContactEventsOnADate(com.alexstyl.specialdates.events.peopleevents.ContactEventsOnADate) ContactEventsOnADate(com.alexstyl.specialdates.events.peopleevents.ContactEventsOnADate) Date(com.alexstyl.specialdates.date.Date) Contact(com.alexstyl.specialdates.contact.Contact) Test(org.junit.Test)

Example 18 with Date

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

the class ShortDateLabelCreatorTest method givenDateWithYear_whenAskingYear_thenYearIsReturned.

@Test
public void givenDateWithYear_whenAskingYear_thenYearIsReturned() {
    Date date = Date.Companion.on(5, MAY, 1995);
    String dateToString = CREATOR.createLabelWithYearPreferredFor(date);
    assertThat(dateToString).isEqualTo("1995-05-05");
}
Also used : Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 19 with Date

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

the class ShortDateLabelCreatorTest method givenDateWithNoYear_whenAskingForYear_NoYearIsReturned.

@Test
public void givenDateWithNoYear_whenAskingForYear_NoYearIsReturned() {
    Date date = Date.Companion.on(5, MAY);
    String dateToString = CREATOR.createLabelWithYearPreferredFor(date);
    assertThat(dateToString).isEqualTo("--05-05");
}
Also used : Date(com.alexstyl.specialdates.date.Date) Test(org.junit.Test)

Example 20 with Date

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

the class DailyReminderIntentService method getDayDateToDisplay.

private Date getDayDateToDisplay() {
    if (BuildConfig.DEBUG) {
        DailyReminderDebugPreferences preferences = DailyReminderDebugPreferences.newInstance(this);
        if (preferences.isFakeDateEnabled()) {
            Date selectedDate = preferences.getSelectedDate();
            Log.d("Using DEBUG date to display: " + selectedDate);
            return selectedDate;
        }
    }
    return Date.Companion.today();
}
Also used : Date(com.alexstyl.specialdates.date.Date) NamesInADate(com.alexstyl.specialdates.events.namedays.NamesInADate)

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