Changeset 13145 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2017-11-22T21:37:46+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r11890 r13145 77 77 @Test 78 78 public void testI18n() { 79 assertTrue(openingHourTest.checkOpeningHourSyntax("opening_hours", ".", OpeningHourTest.CheckMode.POINTS_IN_TIME,false, "de")79 assertTrue(openingHourTest.checkOpeningHourSyntax("opening_hours", ".", false, "de") 80 80 .get(0).toString().contains("Unerwartetes Zeichen")); 81 assertFalse(openingHourTest.checkOpeningHourSyntax("opening_hours", ".", OpeningHourTest.CheckMode.POINTS_IN_TIME,false, "en")81 assertFalse(openingHourTest.checkOpeningHourSyntax("opening_hours", ".", false, "en") 82 82 .get(0).toString().contains("Unerwartetes Zeichen")); 83 83 } … … 121 121 assertThat(openingHourTest.checkOpeningHourSyntax(null, null), isEmpty()); 122 122 assertThat(openingHourTest.checkOpeningHourSyntax(null, ""), isEmpty()); 123 assertEquals("null - The value contains nothing meaningful which can be parsed.", 123 assertEquals("opening_hours - The value contains nothing meaningful which can be parsed.", 124 openingHourTest.checkOpeningHourSyntax("opening_hours", " ").get(0).getMessage()); 125 assertEquals("null - The optional_conf_parm[\"tag_key\"] parameter is of unknown type. Given object, expected string.", 124 126 openingHourTest.checkOpeningHourSyntax(null, " ").get(0).getMessage()); 125 127 } … … 180 182 final String key = "service_times"; 181 183 // frequently used tags according to https://taginfo.openstreetmap.org/keys/service_times#values 182 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Su 10:00", OpeningHourTest.CheckMode.BOTH), isEmpty()); 183 assertThat(openingHourTest.checkOpeningHourSyntax(key, "automatic", OpeningHourTest.CheckMode.BOTH), not(isEmpty())); 184 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Sa 09:00-18:00", OpeningHourTest.CheckMode.BOTH), isEmpty()); 185 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Su 09:30; We 19:30", OpeningHourTest.CheckMode.BOTH), isEmpty()); 186 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00", 187 OpeningHourTest.CheckMode.BOTH), isEmpty()); 188 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00", 189 OpeningHourTest.CheckMode.BOTH), hasSize(1)); 184 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Su 10:00"), isEmpty()); 185 assertThat(openingHourTest.checkOpeningHourSyntax(key, "automatic"), not(isEmpty())); 186 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Sa 09:00-18:00"), isEmpty()); 187 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Su 09:30; We 19:30"), isEmpty()); 188 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00"), isEmpty()); 189 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00"), hasSize(1)); 190 190 assertEquals("Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00", 191 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00", 192 OpeningHourTest.CheckMode.BOTH).get(0).getPrettifiedValue()); 191 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00").get(0).getPrettifiedValue()); 193 192 assertEquals("Mo-Fr 00:00-00:30,04:00-00:30; Sa,Su,PH 00:00-24:00", 194 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00", 195 OpeningHourTest.CheckMode.BOTH).get(0).getPrettifiedValue()); 193 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 0:00-0:30,4:00-00:30; Sa,Su,PH 0:00-24:00").get(0).getPrettifiedValue()); 196 194 } 197 195 … … 203 201 final String key = "collection_times"; 204 202 // frequently used tags according to https://taginfo.openstreetmap.org/keys/collection_times#values 205 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Sa 09:00", OpeningHourTest.CheckMode.BOTH), isEmpty()); 206 assertThat(openingHourTest.checkOpeningHourSyntax(key, "fixme", OpeningHourTest.CheckMode.BOTH), not(isEmpty())); 207 assertThat(openingHourTest.checkOpeningHourSyntax(key, "daily", OpeningHourTest.CheckMode.BOTH), not(isEmpty())); 208 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30,17:45,19:00; Sa 15:00; Su 11:00", 209 OpeningHourTest.CheckMode.BOTH), isEmpty()); 210 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", 211 OpeningHourTest.CheckMode.BOTH), hasSize(1)); 203 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Sa 09:00"), isEmpty()); 204 assertThat(openingHourTest.checkOpeningHourSyntax(key, "fixme"), not(isEmpty())); 205 assertThat(openingHourTest.checkOpeningHourSyntax(key, "daily"), not(isEmpty())); 206 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30,17:45,19:00; Sa 15:00; Su 11:00"), isEmpty()); 207 assertThat(openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00"), hasSize(1)); 212 208 assertEquals(Severity.OTHER, 213 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", 214 OpeningHourTest.CheckMode.BOTH).get(0).getSeverity()); 209 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00").get(0).getSeverity()); 215 210 assertEquals("Mo-Fr 13:30,17:45,19:00; Sa 15:00; Su 11:00", 216 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00", 217 OpeningHourTest.CheckMode.BOTH).get(0).getPrettifiedValue()); 211 openingHourTest.checkOpeningHourSyntax(key, "Mo-Fr 13:30, 17:45, 19:00; Sa 15:00; Su 11:00").get(0).getPrettifiedValue()); 218 212 } 219 213
Note:
See TracChangeset
for help on using the changeset viewer.