Search in sources :

Example 16 with LocalTime

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));
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 17 with LocalTime

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);
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 18 with LocalTime

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));
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 19 with LocalTime

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);
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Example 20 with LocalTime

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));
}
Also used : LocalTime(org.joda.time.LocalTime) OpeningHours(io.jawg.osmcontributor.model.utils.OpeningHours) Test(org.junit.Test)

Aggregations

LocalTime (org.joda.time.LocalTime)81 Test (org.junit.Test)39 OpeningHours (io.jawg.osmcontributor.model.utils.OpeningHours)17 LocalDate (org.joda.time.LocalDate)14 DateTime (org.joda.time.DateTime)13 LocalDateTime (org.joda.time.LocalDateTime)13 Date (java.util.Date)11 DateTimeZone (org.joda.time.DateTimeZone)10 OpeningMonth (io.jawg.osmcontributor.model.utils.OpeningMonth)6 Test (org.testng.annotations.Test)6 ArrayList (java.util.ArrayList)5 OpeningTime (io.jawg.osmcontributor.model.utils.OpeningTime)4 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)3 ContentValues (android.content.ContentValues)2 Time (java.sql.Time)2 EntityManager (javax.persistence.EntityManager)2 EntityTransaction (javax.persistence.EntityTransaction)2 JodaSample3 (org.datanucleus.samples.types.jodatime.JodaSample3)2 DatePickerDialog (android.app.DatePickerDialog)1 TimePickerDialog (android.app.TimePickerDialog)1