Changeset 6415 in josm for trunk/test/unit/org/openstreetmap/josm/data/validation/tests
- Timestamp:
- 2013-11-26T02:15:33+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r6378 r6415 28 28 @Test 29 29 public void testCheckOpeningHourSyntax1() throws Exception { 30 final String key = "opening_hours"; 30 31 // frequently used tags according to http://taginfo.openstreetmap.org/keys/opening_hours#values 31 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "24/7").isEmpty(), is(true));32 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Mo-Fr 08:30-20:00").isEmpty(), is(true));33 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "09:00-21:00").isEmpty(), is(true));34 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Su-Th sunset-24:00, 04:00-sunrise; Fr-Sa sunset-sunrise").isEmpty(), is(true));32 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "24/7").isEmpty(), is(true)); 33 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 08:30-20:00").isEmpty(), is(true)); 34 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "09:00-21:00").isEmpty(), is(true)); 35 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Su-Th sunset-24:00, 04:00-sunrise; Fr-Sa sunset-sunrise").isEmpty(), is(true)); 35 36 } 36 37 37 38 @Test 38 39 public void testCheckOpeningHourSyntax2() throws Exception { 39 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax("Mo-Tue"); 40 final String key = "opening_hours"; 41 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Tue"); 40 42 assertThat(errors.size(), is(1)); 41 43 assertThat(errors.get(0).getMessage(), is("Mo-Tue <--- (Please use the abbreviation \"Tu\" for \"tue\".)")); … … 45 47 @Test 46 48 public void testCheckOpeningHourSyntax3() throws Exception { 47 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax("Sa-Su 10.00-20.00"); 49 final String key = "opening_hours"; 50 final List<OpeningHourTest.OpeningHoursTestError> errors = OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Sa-Su 10.00-20.00"); 48 51 assertThat(errors.size(), is(2)); 49 52 assertThat(errors.get(0).getMessage(), is("Sa-Su 10. <--- (Please use \":\" as hour/minute-separator)")); … … 56 59 @Test 57 60 public void testCheckOpeningHourSyntax4() throws Exception { 58 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(null ).isEmpty(), is(true));59 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "").isEmpty(), is(true));60 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( " ").isEmpty(), is(true));61 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(null, null).isEmpty(), is(true)); 62 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(null, "").isEmpty(), is(true)); 63 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(null, " ").isEmpty(), is(true)); 61 64 } 62 65 63 66 @Test 64 67 public void testCheckOpeningHourSyntax5() throws Exception { 65 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax("badtext").size(), is(1)); 66 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax("badtext").get(0).getMessage(), 68 final String key = "opening_hours"; 69 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "badtext").size(), is(1)); 70 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "badtext").get(0).getMessage(), 67 71 is("opening_hours - ba <--- (Unexpected token: \"b\" This means that the syntax is not valid at that point or it is currently not supported.)")); 68 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "5.00 p.m-11.00 p.m").size(), is(1));69 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "5.00 p.m-11.00 p.m").get(0).getMessage(),72 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "5.00 p.m-11.00 p.m").size(), is(1)); 73 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "5.00 p.m-11.00 p.m").get(0).getMessage(), 70 74 is("opening_hours - 5.00 p <--- (hyphen (-) or open end (+) in time range expected. For working with points in time, the mode for opening_hours.js has to be altered. Maybe wrong tag?)")); 71 75 } … … 73 77 @Test 74 78 public void testCheckOpeningHourSyntax6() throws Exception { 75 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax("PH open \"always open on public holidays\"").isEmpty(), is(true)); 79 final String key = "opening_hours"; 80 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "PH open \"always open on public holidays\"").isEmpty(), is(true)); 76 81 } 77 82 78 83 @Test 79 84 public void testCheckServiceTimeSyntax1() throws Exception { 85 final String key = "service_times"; 80 86 // frequently used tags according to http://taginfo.openstreetmap.org/keys/service_times#values 81 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Su 10:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));82 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "automatic", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false));83 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Mo-Sa 09:00-18:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));84 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Su 09:30; We 19:30", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));85 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));87 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Su 10:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 88 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "automatic", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false)); 89 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Sa 09:00-18:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 90 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Su 09:30; We 19:30", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 91 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 86 92 } 87 93 88 94 @Test 89 95 public void testCheckCollectionTimeSyntax1() throws Exception { 96 final String key = "collection_times"; 90 97 // frequently used tags according to http://taginfo.openstreetmap.org/keys/collection_times#values 91 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Mo-Sa 09:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));92 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "fixme", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false));93 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "daily", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false));94 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax( "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true));98 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Sa 09:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 99 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "fixme", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false)); 100 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "daily", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(false)); 101 assertThat(OPENING_HOUR_TEST.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", OpeningHourTest.CheckMode.BOTH).isEmpty(), is(true)); 95 102 } 96 103 }
Note:
See TracChangeset
for help on using the changeset viewer.