Changeset 8959 in josm for trunk/test/unit/org
- Timestamp:
- 2015-10-27T20:02:56+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java
r8954 r8959 4 4 import static org.junit.Assert.assertFalse; 5 5 import static org.junit.Assert.assertTrue; 6 import static org.junit.Assert.fail;7 6 8 7 import java.io.IOException; … … 47 46 System.out.println(source.url); 48 47 try { 49 Collection<TaggingPreset> presets = TaggingPresetReader.readAll(source.url, true); 50 assertFalse(presets.isEmpty()); 51 System.out.println(" => OK"); 52 allMessages.addAll(Main.getLastErrorAndWarnings()); 53 } catch (SAXException | IOException e) { 48 testPresets(allMessages, source); 49 } catch (IOException e) { 50 try { 51 Main.warn(e); 52 // try again in case of temporary network error 53 testPresets(allMessages, source); 54 } catch (SAXException | IOException e1) { 55 e.printStackTrace(); 56 allErrors.add(e1); 57 System.out.println(" => KO"); 58 } 59 } catch (SAXException e) { 54 60 e.printStackTrace(); 55 61 allErrors.add(e); … … 58 64 } 59 65 assertTrue(allErrors.isEmpty()); 60 for (String message : allMessages) { 66 assertTrue(allMessages.isEmpty()); 67 } 68 69 private static void testPresets(Set<String> allMessages, ExtendedSourceEntry source) throws SAXException, IOException { 70 Collection<TaggingPreset> presets = TaggingPresetReader.readAll(source.url, true); 71 assertFalse(presets.isEmpty()); 72 Collection<String> errorsAndWarnings = Main.getLastErrorAndWarnings(); 73 boolean error = false; 74 for (String message : errorsAndWarnings) { 61 75 if (message.contains(TaggingPreset.PRESET_ICON_ERROR_MSG_PREFIX)) { 62 fail(message); 76 error = true; 77 allMessages.add(message); 63 78 } 79 } 80 System.out.println(error ? " => KO" : " => OK"); 81 if (error) { 82 Main.clearLastErrorAndWarnings(); 64 83 } 65 84 }
Note:
See TracChangeset
for help on using the changeset viewer.