use of org.joda.time.LocalTime 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 org.joda.time.LocalTime 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 org.joda.time.LocalTime 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 org.joda.time.LocalTime 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);
}
use of org.joda.time.LocalTime 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));
}
Aggregations