use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop7.
@Test
public void isNonStop7() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(23, 59));
openingHours.setToTime(new LocalTime(23, 58));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop6.
@Test
public void isNonStop6() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(0, 2));
openingHours.setToTime(new LocalTime(0, 1));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
use of org.joda.time.LocalTime in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method fromOpeningHoursValue3.
@Test
public void fromOpeningHoursValue3() {
String value = "07:30-17:30, Mo,Th 01:00-02:00";
List<OpeningHours> openingHoursList = parser.fromValue(value);
Assert.assertTrue(openingHoursList.size() == 2);
// OPENING 1
OpeningHours openingHours1 = openingHoursList.get(0);
OpeningHours openingHours1Expected = new OpeningHours();
openingHours1Expected.setAllDaysActivated(false);
openingHours1Expected.setFromTime(new LocalTime(7, 30));
openingHours1Expected.setToTime(new LocalTime(17, 30));
Assert.assertEquals(openingHours1Expected, openingHours1);
// OPENING 2
OpeningHours openingHours2 = openingHoursList.get(1);
OpeningHours openingHours2Expected = new OpeningHours();
openingHours2Expected.setAllDaysActivated(false);
openingHours2Expected.setDayActivated(0, true);
openingHours2Expected.setDayActivated(3, true);
openingHours2Expected.setFromTime(new LocalTime(1, 0));
openingHours2Expected.setToTime(new LocalTime(2, 0));
Assert.assertEquals(openingHours2Expected, openingHours2);
}
use of org.joda.time.LocalTime 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");
}
use of org.joda.time.LocalTime 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");
}
Aggregations