Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
r16832 r17591 11 11 import java.util.Locale; 12 12 import java.util.Objects; 13 import java.util.stream.Collectors; 13 14 14 15 import javax.swing.JCheckBox; 15 16 import javax.swing.JPanel; 16 17 18 import ch.poole.openinghoursparser.OpeningHoursParseException; 17 19 import ch.poole.openinghoursparser.OpeningHoursParser; 18 import ch.poole.openinghoursparser.ParseException;19 20 import ch.poole.openinghoursparser.Rule; 20 21 import ch.poole.openinghoursparser.Util; … … 106 107 new OpeningHoursParser(new StringReader(value)).rules(true); 107 108 } 108 } catch (ParseException e) { 109 return Collections.singletonList(createTestError(Severity.WARNING, e.getMessage(), key, value, prettifiedValue, p)); 109 } catch (OpeningHoursParseException e) { 110 String message = e.getExceptions().stream() 111 .map(OpeningHoursParseException::getMessage) 112 .distinct() 113 .collect(Collectors.joining("; ")); 114 return Collections.singletonList(createTestError(Severity.WARNING, message, key, value, prettifiedValue, p)); 110 115 } 111 116 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r17590 r17591 90 90 checkOpeningHourSyntax(key, value, Locale.ENGLISH).get(0).getDescription()); 91 91 value = "Mon-Thu 12-18"; 92 assertEquals("Wochentag mit 3 Buchstaben in Zeile 1, Spalte 4 ",92 assertEquals("Wochentag mit 3 Buchstaben in Zeile 1, Spalte 4; Wochentag mit 3 Buchstaben in Zeile 1, Spalte 9; Stunden ohne Minuten", 93 93 checkOpeningHourSyntax(key, value, Locale.GERMAN).get(0).getDescription()); 94 assertEquals("Three character weekday at line 1, column 4 ",94 assertEquals("Three character weekday at line 1, column 4; Three character weekday at line 1, column 9; Hours without minutes", 95 95 checkOpeningHourSyntax(key, value, Locale.ENGLISH).get(0).getDescription()); 96 96 } … … 118 118 assertThat(errors, hasSize(1)); 119 119 assertFixEquals("Sa-Su 10:00-20:00", errors.get(0)); 120 assertEquals("Invalid minutes at line 1, column 12 ", errors.get(0).getDescription());120 assertEquals("Invalid minutes at line 1, column 12; Invalid minutes at line 1, column 17", errors.get(0).getDescription()); 121 121 assertEquals(Severity.WARNING, errors.get(0).getSeverity()); 122 122 } … … 145 145 checkOpeningHourSyntax(key, "badtext").get(0).getDescription().trim()); 146 146 assertThat(checkOpeningHourSyntax(key, "5.00 p.m-11.00 p.m"), hasSize(1)); 147 assertEquals(String.format("Encountered: <UNEXPECTED_CHAR> \"p \" at line 1, column 3%nWas expecting: <EOF>"), 147 assertEquals(String.format("Encountered: <UNEXPECTED_CHAR> \"p \" at line 1, column 3%nWas expecting: <EOF>; " + 148 "Encountered: <UNEXPECTED_CHAR> \"p \" at line 1, column 13%n" + 149 "Was expecting: <EOF>"), 148 150 checkOpeningHourSyntax(key, "5.00 p.m-11.00 p.m").get(0).getDescription()); 149 151 }
Note:
See TracChangeset
for help on using the changeset viewer.