use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop3.
@Test
public void isNonStop3() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(0, 0));
openingHours.setToTime(new LocalTime(23, 49));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertFalse(parser.isNonStop(openingHours));
}
use of io.jawg.osmcontributor.model.utils.OpeningHours 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");
}
use of io.jawg.osmcontributor.model.utils.OpeningHours 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");
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningTimeValueParserTest method fromValue1.
@Test
public void fromValue1() {
String value = "Apr-May: Mo-Fr 10:15-01:30";
OpeningTime openingTime = parser.fromValue(value);
OpeningTime openingTimeExpected = new OpeningTime();
OpeningMonth openingMonth = new OpeningMonth();
openingTimeExpected.addOpeningMonth(openingMonth);
openingMonth.setMonthActivated(3, true);
openingMonth.setMonthActivated(4, true);
OpeningHours openingHours = new OpeningHours();
openingMonth.addOpeningHours(openingHours);
openingHours.setFromTime(new LocalTime(10, 15));
openingHours.setToTime(new LocalTime(1, 30));
Assert.assertEquals(openingTimeExpected, openingTime);
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParser method toValue.
@Override
public String toValue(List<OpeningHours> openingHours) {
StringBuilder openingHoursBuilder = new StringBuilder();
for (OpeningHours o : openingHours) {
openingHoursBuilder.append(openingHoursBuilder.length() == 0 ? "" : HOURS_SEP);
openingHoursBuilder.append(toSingleValue(o));
}
return openingHoursBuilder.toString();
}
Aggregations