Search in sources :

Example 1 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth in project osm-contributor by jawg.

the class OpeningMonthValueParserTest method nonStop2.

@Test
public void nonStop2() {
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingMonth.setMonthActivated(0, true);
    openingMonth.setMonthActivated(1, true);
    openingMonth.setMonthActivated(7, true);
    openingMonth.setMonthActivated(8, true);
    openingMonth.setMonthActivated(10, true);
    openingMonth.addOpeningHours(openingHours);
    openingHours.setDayActivated(0, true);
    openingHours.setDayActivated(1, true);
    openingHours.setDayActivated(2, true);
    openingHours.setDayActivated(3, true);
    openingHours.setDayActivated(4, true);
    openingHours.setDayActivated(5, true);
    openingHours.setDayActivated(6, true);
    openingHours.setFromTime(new LocalTime(23, 59));
    openingHours.setToTime(new LocalTime(23, 58));
    Assert.assertEquals(parser.toValue(openingMonth), "Jan-Feb,Aug-Sep,Nov: 24/7");
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 2 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth in project osm-contributor by jawg.

the class OpeningMonthValueParserTest method fromValue2.

@Test
public void fromValue2() {
    String monthValue = "Feb-Mar,May-Jun,Aug-Sep,Nov";
    OpeningMonth openingMonth = parser.fromValue(monthValue);
    OpeningMonth o = new OpeningMonth();
    o.setMonthActivated(1, true);
    o.setMonthActivated(2, true);
    o.setMonthActivated(4, true);
    o.setMonthActivated(5, true);
    o.setMonthActivated(7, true);
    o.setMonthActivated(8, true);
    o.setMonthActivated(10, true);
    Assert.assertEquals(o, openingMonth);
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) Test(org.junit.Test)

Example 3 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth in project osm-contributor by jawg.

the class OpeningMonthValueParserTest method parseMonths3.

@Test
public void parseMonths3() {
    OpeningMonth openingMonth = new OpeningMonth();
    openingMonth.setMonthActivated(0, true);
    openingMonth.setMonthActivated(2, true);
    openingMonth.setMonthActivated(4, true);
    openingMonth.setMonthActivated(5, true);
    openingMonth.setMonthActivated(6, true);
    openingMonth.setMonthActivated(7, true);
    openingMonth.setMonthActivated(8, true);
    openingMonth.setMonthActivated(10, true);
    openingMonth.setMonthActivated(11, true);
    openingMonth.setMonthActivated(4, false);
    Assert.assertEquals(parser.toValue(openingMonth), "Jan,Mar,Jun-Sep,Nov-Dec");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) Test(org.junit.Test)

Example 4 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseDays3.

@Test
public void parseDays3() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingMonth.addOpeningHours(openingHours);
    openingHours.setDayActivated(0, true);
    openingHours.setDayActivated(1, true);
    openingHours.setDayActivated(2, true);
    openingHours.setDayActivated(3, true);
    openingHours.setDayActivated(4, true);
    openingHours.setDayActivated(5, true);
    openingHours.setDayActivated(6, true);
    openingHours.setDayActivated(5, false);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mo-Fr,Su 08:00-18:00");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 5 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth in project osm-contributor by jawg.

the class OpeningTimeValueParserTest method parseOpeningHours1.

@Test
public void parseOpeningHours1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours1 = new OpeningHours();
    OpeningHours openingHours2 = new OpeningHours();
    openingMonth.addOpeningHours(openingHours1);
    openingMonth.addOpeningHours(openingHours2);
    openingMonth.setMonthActivated(2, true);
    openingHours1.setAllDaysActivated(false);
    openingHours1.setDayActivated(2, true);
    openingHours2.setAllDaysActivated(false);
    openingHours2.setDayActivated(5, true);
    openingHours2.setFromTime(new LocalTime(5, 30));
    openingHours2.setToTime(new LocalTime(17, 30));
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mar: We 08:00-18:00, Sa 05:30-17:30");
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Aggregations

OpeningMonth (io.jawg.osmcontributor.model.utils.OpeningMonth)21 Test (org.junit.Test)16 OpeningHours (io.jawg.osmcontributor.model.utils.OpeningHours)12 OpeningTime (io.jawg.osmcontributor.model.utils.OpeningTime)12 LocalTime (org.joda.time.LocalTime)6 RecyclerView (android.support.v7.widget.RecyclerView)2 View (android.view.View)2 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 BindView (butterknife.BindView)1 OpeningMonthAdapter (io.jawg.osmcontributor.ui.adapters.OpeningMonthAdapter)1 EditMonthsDialogFragment (io.jawg.osmcontributor.ui.dialogs.EditMonthsDialogFragment)1 PleaseApplyOpeningTimeChange (io.jawg.osmcontributor.ui.events.edition.PleaseApplyOpeningTimeChange)1 DividerItemDecoration (io.jawg.osmcontributor.ui.utils.views.DividerItemDecoration)1