Format code
This commit is contained in:
parent
37919b2f77
commit
a983fcc82c
2 changed files with 303 additions and 302 deletions
|
@ -1,8 +1,6 @@
|
||||||
package net.osmand.util;
|
package net.osmand.util;
|
||||||
/* Can be commented out in order to run the main function separately */
|
/* Can be commented out in order to run the main function separately */
|
||||||
|
|
||||||
import gnu.trove.list.array.TIntArrayList;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.DateFormatSymbols;
|
import java.text.DateFormatSymbols;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -15,6 +13,8 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import gnu.trove.list.array.TIntArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class used to parse opening hours
|
* Class used to parse opening hours
|
||||||
* <p/>
|
* <p/>
|
||||||
|
|
|
@ -170,7 +170,6 @@ public class OpeningHoursParserTest {
|
||||||
testOpened("24.08.2018 15:00", hours, false);
|
testOpened("24.08.2018 15:00", hours, false);
|
||||||
testOpened("12.04.2019 15:00", hours, true);
|
testOpened("12.04.2019 15:00", hours, true);
|
||||||
|
|
||||||
|
|
||||||
// test basic case
|
// test basic case
|
||||||
hours = parseOpenedHours("Mo-Fr 08:30-14:40"); //$NON-NLS-1$
|
hours = parseOpenedHours("Mo-Fr 08:30-14:40"); //$NON-NLS-1$
|
||||||
System.out.println(hours);
|
System.out.println(hours);
|
||||||
|
@ -186,7 +185,6 @@ public class OpeningHoursParserTest {
|
||||||
testOpened("7.09.2015 15:05", hours, false);
|
testOpened("7.09.2015 15:05", hours, false);
|
||||||
testOpened("6.09.2015 16:05", hours, true);
|
testOpened("6.09.2015 16:05", hours, true);
|
||||||
|
|
||||||
|
|
||||||
// two time and date ranges
|
// two time and date ranges
|
||||||
hours = parseOpenedHours("Mo-We, Fr 08:30-14:40,15:00-19:00"); //$NON-NLS-1$
|
hours = parseOpenedHours("Mo-We, Fr 08:30-14:40,15:00-19:00"); //$NON-NLS-1$
|
||||||
System.out.println(hours);
|
System.out.println(hours);
|
||||||
|
@ -409,7 +407,8 @@ public class OpeningHoursParserTest {
|
||||||
testOpened("19.01.2018 20:45", hours, false);
|
testOpened("19.01.2018 20:45", hours, false);
|
||||||
|
|
||||||
// test fallback case
|
// test fallback case
|
||||||
hours = parseOpenedHours("07:00-01:00 open \"Restaurant\" || Mo 00:00-04:00,07:00-04:00; Tu-Th 07:00-04:00; Fr 07:00-24:00; Sa,Su 00:00-24:00 open \"McDrive\"");
|
hours = parseOpenedHours(
|
||||||
|
"07:00-01:00 open \"Restaurant\" || Mo 00:00-04:00,07:00-04:00; Tu-Th 07:00-04:00; Fr 07:00-24:00; Sa,Su 00:00-24:00 open \"McDrive\"");
|
||||||
System.out.println(hours);
|
System.out.println(hours);
|
||||||
testOpened("22.01.2018 00:30", hours, true);
|
testOpened("22.01.2018 00:30", hours, true);
|
||||||
testOpened("22.01.2018 08:00", hours, true);
|
testOpened("22.01.2018 08:00", hours, true);
|
||||||
|
@ -444,8 +443,10 @@ public class OpeningHoursParserTest {
|
||||||
testInfo("16.02.2018 16:00", hours, "Will open at 17:00");
|
testInfo("16.02.2018 16:00", hours, "Will open at 17:00");
|
||||||
testInfo("16.02.2018 18:00", hours, "Open till 23:00");
|
testInfo("16.02.2018 18:00", hours, "Open till 23:00");
|
||||||
|
|
||||||
hours = parseOpenedHours("Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH \"Wird auf der Homepage bekannt gegeben.\"");
|
hours = parseOpenedHours(
|
||||||
testParsedAndAssembledCorrectly("Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH - Wird auf der Homepage bekannt gegeben.", hours);
|
"Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH \"Wird auf der Homepage bekannt gegeben.\"");
|
||||||
|
testParsedAndAssembledCorrectly(
|
||||||
|
"Mo-Fr 10:00-21:00; Sa 12:00-23:00; PH - Wird auf der Homepage bekannt gegeben.", hours);
|
||||||
System.out.println(hours);
|
System.out.println(hours);
|
||||||
} finally {
|
} finally {
|
||||||
Locale.setDefault(locale);
|
Locale.setDefault(locale);
|
||||||
|
|
Loading…
Reference in a new issue