Changeset 14038 in josm for trunk/test/unit/org
- Timestamp:
- 2018-07-20T20:27:34+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/OsmReaderTest.java
r12138 r14038 13 13 import java.nio.charset.StandardCharsets; 14 14 15 import org.junit.Rule; 15 16 import org.junit.Test; 16 17 import org.openstreetmap.josm.TestUtils; … … 19 20 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 20 21 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 22 import org.openstreetmap.josm.testutils.JOSMTestRules; 23 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 21 25 22 26 /** … … 25 29 public class OsmReaderTest { 26 30 31 /** 32 * Setup rule 33 */ 34 @Rule 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 public JOSMTestRules test = new JOSMTestRules(); 37 27 38 private static final class PostProcessorStub implements OsmServerReadPostprocessor { 28 39 boolean called; … … 99 110 testUnknown("<osm version='0.6'><foo>bar</foo></osm>"); 100 111 testUnknown("<osm version='0.6'><foo><bar/></foo></osm>"); 112 } 113 114 /** 115 * Test valid data. 116 * @param osm OSM data without XML prefix 117 * @throws Exception if any error occurs 118 */ 119 private static void testValidData(String osm) throws Exception { 120 try (InputStream in = new ByteArrayInputStream( 121 ("<?xml version='1.0' encoding='UTF-8'?>" + osm).getBytes(StandardCharsets.UTF_8))) { 122 OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); 123 } 101 124 } 102 125 … … 240 263 testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='nan'/></osm>", 241 264 "Illegal value for attribute 'changeset'. Got nan. (at line 1, column 100). 100 bytes have been read"); 242 testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>", 243 "Illegal value for attribute 'changeset'. Got 0. (at line 1, column 98). 98 bytes have been read"); 265 testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='-1'/></osm>", 266 "Illegal value for attribute 'changeset'. Got -1. (at line 1, column 99). 99 bytes have been read"); 267 } 268 269 /** 270 * Test GPDR-compliant changeset. 271 * @throws Exception if any error occurs 272 */ 273 @Test 274 public void testGdprChangeset() throws Exception { 275 testValidData("<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>"); 244 276 } 245 277
Note:
See TracChangeset
for help on using the changeset viewer.