Search in sources :

Example 16 with OpeningMonth

use of io.jawg.osmcontributor.model.utils.OpeningMonth 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)

Example 17 with OpeningMonth

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

the class OpeningTimeValueParserTest method parseDays1.

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

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

the class OpeningTimeValueParserTest method parseMonthAndDays2.

@Test
public void parseMonthAndDays2() {
    OpeningTime openingTime = new OpeningTime();
    OpeningMonth openingMonth = new OpeningMonth();
    OpeningHours openingHours = new OpeningHours();
    openingHours.setAllDaysActivated(false);
    openingMonth.addOpeningHours(openingHours);
    openingMonth.setMonthActivated(2, true);
    openingHours.setDayActivated(2, true);
    openingTime.addOpeningMonth(openingMonth);
    Assert.assertEquals(parser.toValue(openingTime), "Mar: We 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 19 with OpeningMonth

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

the class OpeningMonthValueParserTest method parseMonths2.

@Test
public void parseMonths2() {
    OpeningMonth openingMonth = new OpeningMonth();
    openingMonth.setMonthActivated(5, true);
    Assert.assertEquals(parser.toValue(openingMonth), "Jun");
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) Test(org.junit.Test)

Example 20 with OpeningMonth

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

the class OpeningMonthValueParserTest method fromValue1.

@Test
public void fromValue1() {
    String monthValue = "Jan-Apr,Sep";
    OpeningMonth openingMonth = parser.fromValue(monthValue);
    OpeningMonth o = new OpeningMonth();
    o.setMonthActivated(0, true);
    o.setMonthActivated(1, true);
    o.setMonthActivated(2, true);
    o.setMonthActivated(3, true);
    o.setMonthActivated(8, true);
    Assert.assertEquals(o, openingMonth);
}
Also used : OpeningMonth(io.jawg.osmcontributor.model.utils.OpeningMonth) 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