Changeset 36064 in osm for applications/editors/josm/plugins/pbf
- Timestamp:
- 2023-03-21T14:49:10+01:00 (22 months ago)
- Location:
- applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfExporterTest.java
r32927 r36064 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.plugins.pbf.io; 3 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 3 5 4 6 import java.io.FileInputStream; … … 6 8 import java.nio.file.Files; 7 9 import java.nio.file.Path; 10 import java.nio.file.Paths; 8 11 9 import org.junit. Rule;10 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.Timeout; 11 14 import org.openstreetmap.josm.TestUtils; 12 15 import org.openstreetmap.josm.data.osm.DataSet; … … 14 17 import org.openstreetmap.josm.io.Compression; 15 18 import org.openstreetmap.josm.io.OsmReader; 16 import org.openstreetmap.josm.testutils. JOSMTestRules;19 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 17 20 18 21 /** 19 22 * Unit tests for {@link PbfExporter}. 20 23 */ 21 public class PbfExporterTest { 22 23 /** 24 * Setup test. 25 */ 26 @Rule 27 public JOSMTestRules rules = new JOSMTestRules().preferences().timeout(20000); 28 24 @BasicPreferences 25 @Timeout(20) 26 class PbfExporterTest { 29 27 /** 30 28 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/11169">Ticket #11169</a>. … … 32 30 */ 33 31 @Test 34 publicvoid testTicket11169() throws Exception {32 void testTicket11169() throws Exception { 35 33 try (InputStream is = Compression.ZIP.getUncompressedInputStream( 36 new FileInputStream(TestUtils.getRegressionDataFile(11169, "Portsmouth_Area.osm.zip")))) {34 Files.newInputStream(Paths.get(TestUtils.getRegressionDataFile(11169, "Portsmouth_Area.osm.zip"))))) { 37 35 DataSet ds = OsmReader.parseDataSet(is, null); 38 36 Path out = Files.createTempFile("pbf-bug-11169", "pbf"); 39 new PbfExporter().doSave(out.toFile(), new OsmDataLayer(ds, null, null)); 37 PbfExporter exporter = new PbfExporter(); 38 assertDoesNotThrow(() -> exporter.doSave(out.toFile(), new OsmDataLayer(ds, null, null))); 40 39 Files.delete(out); 41 40 } -
applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfImporterTest.java
r34848 r36064 2 2 package org.openstreetmap.josm.plugins.pbf.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 7 8 8 import java.io.IOException; 9 9 10 import org.junit.Rule; 11 import org.junit.Test; 10 import org.junit.jupiter.api.Test; 12 11 import org.openstreetmap.josm.TestUtils; 13 12 import org.openstreetmap.josm.data.osm.DataSet; … … 16 15 import org.openstreetmap.josm.data.osm.User; 17 16 import org.openstreetmap.josm.io.IllegalDataException; 18 import org.openstreetmap.josm.testutils. JOSMTestRules;17 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 19 18 20 19 /** 21 20 * Unit tests for {@link PbfImporter}. 22 21 */ 23 public class PbfImporterTest { 24 25 /** 26 * Setup test. 27 */ 28 @Rule 29 public JOSMTestRules rules = new JOSMTestRules().preferences(); 30 22 @BasicPreferences 23 class PbfImporterTest { 31 24 private static void checkUserNull(OsmPrimitive osm, boolean hasToBeNull) { 32 25 User usr = osm.getUser(); 33 26 if (hasToBeNull) { 34 assertNull(osm + " -> " + usr,usr);27 assertNull(usr, osm + " -> " + usr); 35 28 } else { 36 assertNotNull(osm + " -> " + usr,usr);29 assertNotNull(usr, osm + " -> " + usr); 37 30 } 38 31 } … … 55 48 */ 56 49 @Test 57 publicvoid testParseDataSet() throws Exception {50 void testParseDataSet() throws Exception { 58 51 doTestMonaco(TestUtils.getTestDataRoot() + "/monaco-latest.osm.pbf", false); 59 52 } … … 64 57 */ 65 58 @Test 66 publicvoid testTicket10132() throws Exception {59 void testTicket10132() throws Exception { 67 60 doTestMonaco(TestUtils.getRegressionDataFile(10132, "Monaco-SP.osm.pbf"), true); 68 61 } … … 73 66 */ 74 67 @Test 75 publicvoid testTicket12567() throws Exception {68 void testTicket12567() throws Exception { 76 69 DataSet ds = new PbfImporter().parseDataSet(TestUtils.getRegressionDataFile(12567, "12390008.osm.pbf")); 77 70 assertNotNull(ds); … … 86 79 */ 87 80 @Test 88 publicvoid testTicket14545() throws Exception {81 void testTicket14545() throws Exception { 89 82 DataSet ds = new PbfImporter().parseDataSet(TestUtils.getRegressionDataFile(14545, "reg14545.osm.pbf")); 90 83 assertNotNull(ds);
Note:
See TracChangeset
for help on using the changeset viewer.