Search in sources :

Example 6 with OpeningTime

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

the class OpeningTimeValueParserTest method parseAllFields1.

@Test
public void parseAllFields1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth1 = new OpeningMonth();
    OpeningHours openingHours1 = new OpeningHours();
    OpeningHours openingHours2 = new OpeningHours();
    openingMonth1.addOpeningHours(openingHours1);
    openingMonth1.addOpeningHours(openingHours2);
    openingMonth1.setMonthActivated(1, true);
    openingMonth1.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));
    OpeningMonth openingMonth2 = new OpeningMonth();
    OpeningHours openingHours3 = new OpeningHours();
    OpeningHours openingHours4 = new OpeningHours();
    openingMonth2.addOpeningHours(openingHours3);
    openingMonth2.addOpeningHours(openingHours4);
    openingMonth2.setMonthActivated(3, true);
    openingMonth2.setMonthActivated(4, true);
    openingHours3.setAllDaysActivated(false);
    openingHours3.setDayActivated(6, true);
    openingHours4.setAllDaysActivated(false);
    openingHours4.setDayActivated(5, true);
    openingHours4.setFromTime(new LocalTime(8, 10));
    openingHours4.setToTime(new LocalTime(19, 45));
    openingTime.addOpeningMonth(openingMonth1);
    openingTime.addOpeningMonth(openingMonth2);
    Assert.assertEquals(parser.toValue(openingTime), "Feb-Mar: We 08:00-18:00, Sa 05:30-17:30; Apr-May: Su 08:00-18:00, Sa 08:10-19:45");
}
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)

Example 7 with OpeningTime

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

the class OpeningTimeValueParserTest method parseMonths1.

@Test
public void parseMonths1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    openingMonth.setMonthActivated(0, true);
    openingMonth.setMonthActivated(1, true);
    openingMonth.setMonthActivated(7, true);
    openingMonth.setMonthActivated(8, true);
    openingMonth.setMonthActivated(10, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Jan-Feb,Aug-Sep,Nov");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) OpeningTime(io.jawg.osmcontributor.model.utils.OpeningTime) Test(org.junit.Test)

Example 8 with OpeningTime

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

the class OpeningTimeValueParserTest method parseDays2.

@Test
public void parseDays2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    openingTime.addOpeningMonth(openingMonth);
    openingHours.setDayActivated(5, true);
    Assert.assertEquals(parser.toValue(openingTime), "Sa 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 9 with OpeningTime

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

the class OpeningTimeValueParserTest method parseMonthAndDays1.

@Test
public void parseMonthAndDays1() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    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);
    openingHours.setDayActivated(0, true);
    openingHours.setDayActivated(1, true);
    openingHours.setDayActivated(6, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Jan,Mar,May-Sep,Nov-Dec: Mo-Tu,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 10 with OpeningTime

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

the class OpeningTimeValueParserTest method parseOpeningHours2.

@Test
public void parseOpeningHours2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours1 = new OpeningHours();
    OpeningHours openingHours2 = new OpeningHours();
    OpeningHours openingHours3 = new OpeningHours();
    openingMonth.addOpeningHours(openingHours1);
    openingMonth.addOpeningHours(openingHours2);
    openingMonth.addOpeningHours(openingHours3);
    openingMonth.setMonthActivated(2, true);
    openingMonth.setMonthActivated(3, true);
    openingMonth.setMonthActivated(5, true);
    openingMonth.setMonthActivated(6, true);
    openingMonth.setMonthActivated(10, true);
    openingHours1.setAllDaysActivated(false);
    openingHours1.setDayActivated(2, true);
    openingHours1.setDayActivated(4, true);
    openingHours1.setDayActivated(5, true);
    openingHours1.setFromTime(new LocalTime(10, 45));
    openingHours1.setToTime(new LocalTime(19, 15));
    openingHours2.setAllDaysActivated(false);
    openingHours2.setDayActivated(5, true);
    openingHours2.setDayActivated(6, true);
    openingHours2.setDayActivated(1, true);
    openingHours2.setFromTime(new LocalTime(5, 30));
    openingHours2.setToTime(new LocalTime(17, 30));
    openingHours3.setAllDaysActivated(false);
    openingHours3.setDayActivated(2, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mar-Apr,Jun-Jul,Nov: We,Fr-Sa 10:45-19:15, Tu,Sa-Su 05:30-17:30, We 08:00-18:00");
}
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)12 OpeningTime (io.jawg.osmcontributor.model.utils.OpeningTime)12 Test (org.junit.Test)10 OpeningHours (io.jawg.osmcontributor.model.utils.OpeningHours)9 LocalTime (org.joda.time.LocalTime)4 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 OpeningMonthAdapter (io.jawg.osmcontributor.ui.adapters.OpeningMonthAdapter)1 DividerItemDecoration (io.jawg.osmcontributor.ui.utils.views.DividerItemDecoration)1