use of io.jawg.osmcontributor.model.utils.OpeningHours 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");
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop5.
@Test
public void isNonStop5() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(7, 36));
openingHours.setToTime(new LocalTime(7, 33));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method fromOpeningHoursValue2.
@Test
public void fromOpeningHoursValue2() {
String value = "05:30-17:30";
List<OpeningHours> openingHoursList = parser.fromValue(value);
Assert.assertTrue(openingHoursList.size() == 1);
// OPENING 1
OpeningHours openingHours1 = openingHoursList.get(0);
OpeningHours openingHours1Expected = new OpeningHours();
openingHours1Expected.setAllDaysActivated(false);
openingHours1Expected.setFromTime(new LocalTime(5, 30));
openingHours1Expected.setToTime(new LocalTime(17, 30));
Assert.assertEquals(openingHours1Expected, openingHours1);
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method isNonStop4.
@Test
public void isNonStop4() {
OpeningHours openingHours = new OpeningHours();
openingHours.setFromTime(new LocalTime(21, 59));
openingHours.setToTime(new LocalTime(21, 58));
openingHours.setDays(OpeningHours.Days.values());
Assert.assertTrue(parser.isNonStop(openingHours));
}
use of io.jawg.osmcontributor.model.utils.OpeningHours in project osm-contributor by jawg.
the class OpeningHoursValueParserTest method fromOpeningHoursValue1.
@Test
public void fromOpeningHoursValue1() {
String value = "We,Fr-Sa 10:45-19:15, Tu,Sa-Su 05:30-17:30, We 08:00-18:00";
List<OpeningHours> openingHoursList = parser.fromValue(value);
Assert.assertTrue(openingHoursList.size() == 3);
// OPENING 1
OpeningHours openingHours1 = openingHoursList.get(0);
OpeningHours openingHours1Expected = new OpeningHours();
openingHours1Expected.setAllDaysActivated(false);
openingHours1Expected.setDayActivated(2, true);
openingHours1Expected.setDayActivated(4, true);
openingHours1Expected.setDayActivated(5, true);
openingHours1Expected.setFromTime(new LocalTime(10, 45));
openingHours1Expected.setToTime(new LocalTime(19, 15));
Assert.assertEquals(openingHours1Expected, openingHours1);
// OPENING 2
OpeningHours openingHours2 = openingHoursList.get(1);
OpeningHours openingHours2Expected = new OpeningHours();
openingHours2Expected.setAllDaysActivated(false);
openingHours2Expected.setDayActivated(1, true);
openingHours2Expected.setDayActivated(5, true);
openingHours2Expected.setDayActivated(6, true);
openingHours2Expected.setFromTime(new LocalTime(5, 30));
openingHours2Expected.setToTime(new LocalTime(17, 30));
Assert.assertEquals(openingHours2Expected, openingHours2);
// OPENING 3
OpeningHours openingHours3 = openingHoursList.get(2);
OpeningHours openingHours3Expected = new OpeningHours();
openingHours3Expected.setAllDaysActivated(false);
openingHours3Expected.setDayActivated(2, true);
openingHours3Expected.setFromTime(new LocalTime(8, 0));
openingHours3Expected.setToTime(new LocalTime(18, 0));
Assert.assertEquals(openingHours3Expected, openingHours3);
}
Aggregations