Changeset 17275 in josm for trunk/test/unit/org/openstreetmap/josm/io
- Timestamp:
- 2020-10-28T20:41:00+01:00 (3 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/io
- Files:
-
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java
r17212 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.InputStream; … … 11 11 import java.util.Collections; 12 12 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.xml.sax.InputSource; … … 18 18 * Unit tests of {@link Capabilities} class. 19 19 */ 20 publicclass CapabilitiesTest {20 class CapabilitiesTest { 21 21 22 22 /** … … 26 26 */ 27 27 @Test 28 publicvoid testCapabilities() throws Exception {28 void testCapabilities() throws Exception { 29 29 final Path path = Paths.get(TestUtils.getTestDataRoot(), "__files/api/0.6/capabilities"); 30 30 final Capabilities capabilities; -
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import org.junit. Rule;5 import org.junit. Test;4 import org.junit.jupiter.api.extension.RegisterExtension; 5 import org.junit.jupiter.api.Test; 6 6 import org.openstreetmap.josm.testutils.JOSMTestRules; 7 7 … … 12 12 * Unit tests of {@link CertificateAmendment} class. 13 13 */ 14 publicclass CertificateAmendmentTest {14 class CertificateAmendmentTest { 15 15 16 16 /** 17 17 * Setup rule 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testUtilityClass() throws ReflectiveOperationException {28 void testUtilityClass() throws ReflectiveOperationException { 29 29 UtilityClassTestUtil.assertUtilityClassWellDefined(CertificateAmendment.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java
r15509 r17275 13 13 14 14 import org.junit.Assert; 15 import org.junit.BeforeClass;16 15 import org.junit.ClassRule; 17 import org.junit.Test; 16 import org.junit.jupiter.api.BeforeAll; 17 import org.junit.jupiter.api.Test; 18 18 import org.openstreetmap.josm.TestUtils; 19 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 24 24 * Integration tests of {@link CertificateAmendment} class. 25 25 */ 26 publicclass CertificateAmendmentTestIT {26 class CertificateAmendmentTestIT { 27 27 28 28 /** … … 39 39 * @throws IOException in case of I/O error 40 40 */ 41 @Before Class41 @BeforeAll 42 42 public static void beforeClass() throws IOException { 43 43 errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(CertificateAmendmentTestIT.class)); … … 49 49 */ 50 50 @Test 51 publicvoid testDefault() throws IOException {51 void testDefault() throws IOException { 52 52 // something that is not embedded 53 53 connect("https://www.bing.com", true); … … 59 59 */ 60 60 @Test 61 publicvoid testLetsEncrypt() throws IOException {61 void testLetsEncrypt() throws IOException { 62 62 // signed by letsencrypt's own ISRG root 63 63 connect("https://valid-isrgrootx1.letsencrypt.org", true); … … 73 73 */ 74 74 @Test 75 publicvoid testOverpass() throws IOException {75 void testOverpass() throws IOException { 76 76 connect("https://overpass-api.de", true); 77 77 } … … 82 82 */ 83 83 @Test 84 publicvoid testDutchGovernment() throws IOException {84 void testDutchGovernment() throws IOException { 85 85 connect("https://geodata.nationaalgeoregister.nl", true); 86 86 } … … 91 91 */ 92 92 @Test 93 publicvoid testTaiwanGovernment() throws IOException {93 void testTaiwanGovernment() throws IOException { 94 94 connect("https://grca.nat.gov.tw", true); 95 95 } -
trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.java
r14068 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNotNull;7 import static org.junit. Assert.assertTrue;8 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 import static org.junit.jupiter.api.Assertions.fail; 9 9 10 10 import java.time.OffsetDateTime; … … 12 12 import java.util.Arrays; 13 13 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException; 16 16 import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlParser; … … 20 20 * Unit tests of {@link ChangesetQueryUrlParser} class 21 21 */ 22 publicclass ChangesetQueryUrlParserTest {22 class ChangesetQueryUrlParserTest { 23 23 24 24 /** … … 27 27 */ 28 28 @Test 29 publicvoid testParseBasic() throws ChangesetQueryUrlException {29 void testParseBasic() throws ChangesetQueryUrlException { 30 30 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 31 31 … … 56 56 */ 57 57 @Test 58 publicvoid testUid() throws ChangesetQueryUrlException {58 void testUid() throws ChangesetQueryUrlException { 59 59 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 60 60 ChangesetQuery q; … … 74 74 */ 75 75 @Test 76 publicvoid testDisplayName() throws ChangesetQueryUrlException {76 void testDisplayName() throws ChangesetQueryUrlException { 77 77 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 78 78 ChangesetQuery q; … … 89 89 */ 90 90 @Test 91 publicvoid testOpen() throws ChangesetQueryUrlException {91 void testOpen() throws ChangesetQueryUrlException { 92 92 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 93 93 ChangesetQuery q; … … 112 112 */ 113 113 @Test 114 publicvoid testClosed() throws ChangesetQueryUrlException {114 void testClosed() throws ChangesetQueryUrlException { 115 115 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 116 116 ChangesetQuery q; … … 134 134 */ 135 135 @Test 136 publicvoid testUidAndDisplayName() {136 void testUidAndDisplayName() { 137 137 shouldFail("uid=1&display_name=abcd"); 138 138 } … … 143 143 */ 144 144 @Test 145 publicvoid testTime() throws ChangesetQueryUrlException {145 void testTime() throws ChangesetQueryUrlException { 146 146 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 147 147 ChangesetQuery q; … … 169 169 */ 170 170 @Test 171 publicvoid testBbox() throws ChangesetQueryUrlException {171 void testBbox() throws ChangesetQueryUrlException { 172 172 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 173 173 ChangesetQuery q; … … 191 191 */ 192 192 @Test 193 publicvoid testChangesetIds() throws ChangesetQueryUrlException {193 void testChangesetIds() throws ChangesetQueryUrlException { 194 194 ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser(); 195 195 ChangesetQuery q; -
trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.java
r14046 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.fail;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.fail; 7 7 8 8 import java.util.Arrays; … … 10 10 import java.util.Set; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.osm.Changeset; … … 31 31 * Unit tests of {@link DiffResultProcessor} 32 32 */ 33 publicclass DiffResultProcessorTest {33 class DiffResultProcessorTest { 34 34 35 35 /** 36 36 * Setup rule 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules(); … … 53 53 */ 54 54 @Test 55 publicvoid testConstructor() {55 void testConstructor() { 56 56 Node n = new Node(1); 57 57 // these calls should not fail … … 66 66 */ 67 67 @Test 68 publicvoid testParse_NOK_Cases() {68 void testParse_NOK_Cases() { 69 69 shouldFail(null); 70 70 shouldFail(""); … … 77 77 */ 78 78 @Test 79 publicvoid testParse_OK_Cases() throws XmlParsingException {79 void testParse_OK_Cases() throws XmlParsingException { 80 80 DiffResultProcessor processor = new DiffResultProcessor(null); 81 81 String doc = … … 112 112 */ 113 113 @Test 114 publicvoid testPostProcess_Invocation_Variants() throws XmlParsingException {114 void testPostProcess_Invocation_Variants() throws XmlParsingException { 115 115 DiffResultProcessor processor = new DiffResultProcessor(null); 116 116 String doc = … … 136 136 */ 137 137 @Test 138 publicvoid testPostProcess_OK() throws XmlParsingException {138 void testPostProcess_OK() throws XmlParsingException { 139 139 140 140 Node n = new Node(); … … 171 171 */ 172 172 @Test 173 publicvoid testPostProcess_ForCreatedElement() throws XmlParsingException {173 void testPostProcess_ForCreatedElement() throws XmlParsingException { 174 174 175 175 Node n = new Node(); … … 193 193 */ 194 194 @Test 195 publicvoid testPostProcess_ForModifiedElement() throws XmlParsingException {195 void testPostProcess_ForModifiedElement() throws XmlParsingException { 196 196 197 197 Node n = new Node(1); … … 218 218 */ 219 219 @Test 220 publicvoid testPostProcess_ForDeletedElement() throws XmlParsingException {220 void testPostProcess_ForDeletedElement() throws XmlParsingException { 221 221 222 222 Node n = new Node(1); -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java
r17185 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertNull;7 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 9 … … 19 19 import java.util.stream.IntStream; 20 20 21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.extension.RegisterExtension; 22 import org.junit.jupiter.api.Test; 23 23 import org.openstreetmap.josm.TestUtils; 24 24 import org.openstreetmap.josm.data.coor.LatLon; … … 32 32 * Unit tests of {@link GeoJSONReader}. 33 33 */ 34 publicclass GeoJSONReaderTest {34 class GeoJSONReaderTest { 35 35 36 36 /** 37 37 * Setup test. 38 38 */ 39 @R ule39 @RegisterExtension 40 40 public JOSMTestRules rules = new JOSMTestRules(); 41 41 … … 45 45 */ 46 46 @Test 47 publicvoid testReadGeoJson() throws Exception {47 void testReadGeoJson() throws Exception { 48 48 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geo.json"))) { 49 49 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 60 60 */ 61 61 @Test 62 publicvoid testReadLineByLineGeoJSON() throws Exception {62 void testReadLineByLineGeoJSON() throws Exception { 63 63 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geoLineByLine.json"))) { 64 64 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 150 150 */ 151 151 @Test 152 publicvoid testReadGeoJsonNamedCrs() throws Exception {152 void testReadGeoJsonNamedCrs() throws Exception { 153 153 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geocrs.json"))) { 154 154 final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader() … … 165 165 */ 166 166 @Test 167 publicvoid testReadGeoJsonWithoutType() {167 void testReadGeoJsonWithoutType() { 168 168 assertThrows(IllegalDataException.class, () -> 169 169 new GeoJSONReader().doParseDataSet(new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)), null)); … … 193 193 */ 194 194 @Test 195 publicvoid testTicket19822() throws Exception {195 void testTicket19822() throws Exception { 196 196 try (InputStream in = TestUtils.getRegressionDataStream(19822, "data.geojson")) { 197 197 final List<OsmPrimitive> primitives = new ArrayList<>( … … 207 207 */ 208 208 @Test 209 publicvoid testTicket19822Nested() throws Exception {209 void testTicket19822Nested() throws Exception { 210 210 try (InputStream in = TestUtils.getRegressionDataStream(19822, "problem3.geojson")) { 211 211 final List<OsmPrimitive> primitives = new ArrayList<>( -
trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java
r16936 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.InputStream; … … 10 10 import java.util.Arrays; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.TestUtils; … … 22 22 * Unit tests of {@link GeoJSONWriter} class. 23 23 */ 24 publicclass GeoJSONWriterTest {24 class GeoJSONWriterTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @Before Class29 @BeforeAll 30 30 public static void setUp() { 31 31 JOSMFixture.createUnitTestFixture().init(); … … 36 36 */ 37 37 @Test 38 publicvoid testPoint() {38 void testPoint() { 39 39 final Node node = new Node(new LatLon(12.3, 4.56)); 40 40 node.put("name", "foo"); … … 75 75 */ 76 76 @Test 77 publicvoid testLineString() {77 void testLineString() { 78 78 final DataSet ds = new DataSet(); 79 79 final Node n1 = new Node(new LatLon(12.3, 4.56)); … … 119 119 */ 120 120 @Test 121 publicvoid testMultipolygon() throws Exception {121 void testMultipolygon() throws Exception { 122 122 try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) { 123 123 DataSet ds = OsmReader.parseDataSet(in, null); … … 132 132 */ 133 133 @Test 134 publicvoid testMultipolygonRobustness() throws Exception {134 void testMultipolygonRobustness() throws Exception { 135 135 try (InputStream in = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm"))) { 136 136 DataSet ds = OsmReader.parseDataSet(in, null); -
trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.assertThrows; 6 7 7 8 import java.io.ByteArrayInputStream; … … 14 15 import java.util.Map; 15 16 16 import org.junit. Rule;17 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 18 19 import org.openstreetmap.josm.TestUtils; 19 20 import org.openstreetmap.josm.data.Bounds; … … 34 35 * Setup rule 35 36 */ 36 @R ule37 @RegisterExtension 37 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 39 public JOSMTestRules test = new JOSMTestRules(); … … 60 61 */ 61 62 @Test 62 publicvoid testMunich() throws Exception {63 void testMunich() throws Exception { 63 64 final GpxData result = parseGpxData("nodist/data/munich.gpx"); 64 65 assertEquals(2762, result.getTracks().size()); … … 76 77 */ 77 78 @Test 78 publicvoid testLayerPrefs() throws Exception {79 void testLayerPrefs() throws Exception { 79 80 final GpxData data = parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks-layerprefs.gpx"); 80 81 Map<String, String> e = new HashMap<>(); … … 93 94 * @throws Exception always SAXException 94 95 */ 95 @Test(expected = SAXException.class) 96 public void testException() throws Exception { 97 new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true); 96 @Test 97 void testException() throws Exception { 98 assertThrows(SAXException.class, 99 () -> new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true)); 98 100 } 99 101 … … 104 106 */ 105 107 @Test 106 publicvoid testTicket15634() throws IOException, SAXException {108 void testTicket15634() throws IOException, SAXException { 107 109 assertEquals(new Bounds(53.7229357, -7.9135019, 53.9301103, -7.59656), 108 110 GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(15634, "drumlish.gpx")).getMetaBounds()); -
trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java
r17149 r17275 15 15 import java.util.function.Consumer; 16 16 17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 20 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 37 37 * Setup rule 38 38 */ 39 @R ule39 @RegisterExtension 40 40 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 41 41 public JOSMTestRules test = new JOSMTestRules(); … … 68 68 */ 69 69 @Test 70 publicvoid testTicket16550() throws IOException {70 void testTicket16550() throws IOException { 71 71 // Checks that time stored as date is correctly written into XML timestamp 72 72 testSingleWaypoint( … … 80 80 */ 81 81 @Test 82 publicvoid testTicket16725() throws IOException {82 void testTicket16725() throws IOException { 83 83 // Checks that sat, hdop, pdop, vdop are correctly exported 84 84 testSingleWaypoint( … … 100 100 */ 101 101 @Test 102 publicvoid testExtensions() throws IOException {102 void testExtensions() throws IOException { 103 103 GpxData data = new GpxData(); 104 104 // only namespace, no location printed -
trunk/test/unit/org/openstreetmap/josm/io/MultiFetchOverpassObjectReaderTest.java
r16612 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Arrays; 7 7 import java.util.List; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.osm.Node; 12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 20 20 * Unit tests of {@link MultiFetchOverpassObjectReader}. 21 21 */ 22 publicclass MultiFetchOverpassObjectReaderTest {22 class MultiFetchOverpassObjectReaderTest { 23 23 24 24 /** 25 25 * Setup test. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testBuildRequestNodesString() {35 void testBuildRequestNodesString() { 36 36 List<OsmPrimitive> objects = Arrays.asList(new Node(123), new Node(126), new Node(130)); 37 37 String requestString; … … 61 61 */ 62 62 @Test 63 publicvoid testBuildRequestWaysString() {63 void testBuildRequestWaysString() { 64 64 List<OsmPrimitive> objects = Arrays.asList(new Way(123), new Way(126), new Way(130)); 65 65 String requestString; … … 86 86 */ 87 87 @Test 88 publicvoid testBuildRequestRelationsString() {88 void testBuildRequestRelationsString() { 89 89 List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130)); 90 90 String requestString; … … 112 112 */ 113 113 @Test 114 publicvoid testBuildComplexString() {114 void testBuildComplexString() { 115 115 List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130), new Way(88), new Way(99), 116 116 new Node(1)); -
trunk/test/unit/org/openstreetmap/josm/io/NameFinderTest.java
r14015 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.StringReader; … … 8 8 import java.util.stream.Collectors; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 12 12 /** 13 13 * Unit tests of {@link NameFinder} class. 14 14 */ 15 publicclass NameFinderTest {15 class NameFinderTest { 16 16 17 17 // CHECKSTYLE.OFF: LineLength … … 41 41 */ 42 42 @Test 43 publicvoid testParseSearchResults() throws Exception {43 void testParseSearchResults() throws Exception { 44 44 try (StringReader reader = new StringReader(SAMPLE)) { 45 45 assertEquals(Arrays.asList( -
trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java
r16426 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.net.MalformedURLException; … … 10 10 import java.util.Map; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 15 … … 19 19 * Unit tests of {@link NetworkManager} class. 20 20 */ 21 publicclass NetworkManagerTest {21 class NetworkManagerTest { 22 22 23 23 /** 24 24 * Setup test. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection(); … … 35 35 */ 36 36 @Test 37 publicvoid testNetworkErrors() throws MalformedURLException {37 void testNetworkErrors() throws MalformedURLException { 38 38 NetworkManager.clearNetworkErrors(); 39 39 assertTrue(NetworkManager.getNetworkErrors().isEmpty()); … … 52 52 */ 53 53 @Test 54 publicvoid testOfflineResources() {54 void testOfflineResources() { 55 55 NetworkManager.setOnline(OnlineResource.ALL); 56 56 assertFalse(NetworkManager.isOffline("http://www.example.com/")); -
trunk/test/unit/org/openstreetmap/josm/io/NoteReaderTest.java
r10134 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; 7 7 import java.util.List; 8 8 9 import org.junit. Test;9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.coor.LatLon; 11 11 import org.openstreetmap.josm.data.notes.Note; … … 20 20 * Unit tests of {@link NoteReader} class. 21 21 */ 22 publicclass NoteReaderTest {22 class NoteReaderTest { 23 23 24 24 /** … … 28 28 */ 29 29 @Test 30 publicvoid testNoteReader() throws SAXException, IOException {30 void testNoteReader() throws SAXException, IOException { 31 31 List<Note> list = new NoteReader( 32 32 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+ … … 89 89 */ 90 90 @Test 91 publicvoid testTicket12393() throws Exception {91 void testTicket12393() throws Exception { 92 92 // CHECKSTYLE.OFF: LineLength 93 93 new NoteReader( -
trunk/test/unit/org/openstreetmap/josm/io/OsmApiExceptionTest.java
r14810 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 import org.junit. Rule;8 import org.junit. Test;7 import org.junit.jupiter.api.extension.RegisterExtension; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 10 … … 14 14 * Unit tests of {@link OsmApiException} class. 15 15 */ 16 publicclass OsmApiExceptionTest {16 class OsmApiExceptionTest { 17 17 18 18 /** 19 19 * Setup tests 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testTicket17328() {29 void testTicket17328() { 30 30 assertFalse(new OsmApiException(503, "foo", "bar").isHtml()); 31 31 assertTrue(new OsmApiException(503, null, "<h2>This website is under heavy load (queue full)</h2><p>Sorry...</p>").isHtml()); -
trunk/test/unit/org/openstreetmap/josm/io/OsmApiTest.java
r10051 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.ByteArrayInputStream; 7 7 import java.nio.charset.StandardCharsets; 8 8 9 import org.junit. BeforeClass;10 import org.junit. Test;9 import org.junit.jupiter.api.BeforeAll; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.JOSMFixture; 12 12 import org.openstreetmap.josm.data.osm.Changeset; … … 17 17 * Unit tests of {@link OsmApi} class. 18 18 */ 19 publicclass OsmApiTest {19 class OsmApiTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @Before Class24 @BeforeAll 25 25 public static void setUp() { 26 26 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testTicket12675() throws IllegalDataException {34 void testTicket12675() throws IllegalDataException { 35 35 OsmApi api = OsmApi.getOsmApi(); 36 36 Changeset cs = new Changeset(); -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.java
r14048 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.fail; 6 6 7 7 import java.util.Arrays; 8 8 9 import org.junit. Rule;10 import org.junit. Test;9 import org.junit.jupiter.api.extension.RegisterExtension; 10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 12 import org.openstreetmap.josm.data.osm.Changeset; … … 20 20 * Unit tests of {@link OsmChangeBuilder} 21 21 */ 22 publicclass OsmChangeBuilderTest {22 class OsmChangeBuilderTest { 23 23 24 24 /** 25 25 * Setup rule 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 42 42 */ 43 43 @Test 44 publicvoid testConstructor() {44 void testConstructor() { 45 45 Changeset cs = new Changeset(1); 46 46 // should not fail … … 57 57 */ 58 58 @Test 59 publicvoid testSequenceOfMethodCalls() {59 void testSequenceOfMethodCalls() { 60 60 Changeset cs = new Changeset(1); 61 61 OsmChangeBuilder csBuilder = new OsmChangeBuilder(cs); … … 93 93 */ 94 94 @Test 95 publicvoid testDocumentWithNewNode() {95 void testDocumentWithNewNode() { 96 96 Changeset cs = new Changeset(1); 97 97 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 114 114 */ 115 115 @Test 116 publicvoid testDocumentWithModifiedNode() {116 void testDocumentWithModifiedNode() { 117 117 Changeset cs = new Changeset(1); 118 118 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 137 137 */ 138 138 @Test 139 publicvoid testDocumentWithDeletedNode() {139 void testDocumentWithDeletedNode() { 140 140 Changeset cs = new Changeset(1); 141 141 OsmChangeBuilder builder = new OsmChangeBuilder(cs); … … 160 160 */ 161 161 @Test 162 publicvoid testMixed() {162 void testMixed() { 163 163 Changeset cs = new Changeset(1); 164 164 OsmChangeBuilder builder = new OsmChangeBuilder(cs); -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangeReaderTest.java
r14314 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.ByteArrayInputStream; … … 10 10 import java.util.Iterator; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.extension.RegisterExtension; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.coor.LatLon; 15 15 import org.openstreetmap.josm.data.notes.Note; … … 25 25 * Unit tests of {@link OsmChangeReader}. 26 26 */ 27 publicclass OsmChangeReaderTest {27 class OsmChangeReaderTest { 28 28 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 */ 55 55 @Test 56 publicvoid testNotes() throws Exception {56 void testNotes() throws Exception { 57 57 NoteData nd = parse( 58 58 "<create>\r\n" + -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;7 import static org.junit. Assert.fail;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.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.io.ByteArrayInputStream; … … 12 12 import java.util.Arrays; 13 13 14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.extension.RegisterExtension; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.data.osm.ChangesetDataSet; 17 17 import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType; … … 31 31 * Unit tests of {@link OsmChangesetContentParser}. 32 32 */ 33 publicclass OsmChangesetContentParserTest {33 class OsmChangesetContentParserTest { 34 34 35 35 /** 36 36 * Setup rule 37 37 */ 38 @R ule38 @RegisterExtension 39 39 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 40 40 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 @Test 55 55 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL") 56 publicvoid test_Constructor() {56 void test_Constructor() { 57 57 58 58 // should be OK … … 73 73 */ 74 74 @Test 75 publicvoid test_parse_arguments() throws XmlParsingException {75 void test_parse_arguments() throws XmlParsingException { 76 76 OsmChangesetContentParser parser; 77 77 … … 96 96 */ 97 97 @Test 98 publicvoid test_OK_OneCreatedNode() throws XmlParsingException {98 void test_OK_OneCreatedNode() throws XmlParsingException { 99 99 OsmChangesetContentParser parser; 100 100 … … 126 126 */ 127 127 @Test 128 publicvoid test_OK_OneUpdatedNode() throws XmlParsingException {128 void test_OK_OneUpdatedNode() throws XmlParsingException { 129 129 OsmChangesetContentParser parser; 130 130 … … 156 156 */ 157 157 @Test 158 publicvoid test_OK_OneDeletedNode() throws XmlParsingException {158 void test_OK_OneDeletedNode() throws XmlParsingException { 159 159 OsmChangesetContentParser parser; 160 160 … … 186 186 */ 187 187 @Test 188 publicvoid test_OK_ComplexTestCase() throws XmlParsingException {188 void test_OK_ComplexTestCase() throws XmlParsingException { 189 189 OsmChangesetContentParser parser; 190 190 -
trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetParserTest.java
r14231 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.ByteArrayInputStream; … … 9 9 import java.util.List; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.extension.RegisterExtension; 12 import org.junit.jupiter.api.Test; 13 13 import org.openstreetmap.josm.data.osm.Changeset; 14 14 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; … … 20 20 * Unit tests of {@link OsmChangesetParser} class. 21 21 */ 22 publicclass OsmChangesetParserTest {22 class OsmChangesetParserTest { 23 23 24 24 private static final String BEGIN = … … 58 58 * Setup test. 59 59 */ 60 @R ule60 @RegisterExtension 61 61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 62 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 71 71 */ 72 72 @Test 73 publicvoid testParseWithoutDiscussion() throws IllegalDataException {73 void testParseWithoutDiscussion() throws IllegalDataException { 74 74 // http://api.openstreetmap.org/api/0.6/changeset/36749147 75 75 Changeset cs = parse(BEGIN + END).iterator().next(); … … 84 84 */ 85 85 @Test 86 publicvoid testParseWithDiscussion() throws IllegalDataException {86 void testParseWithDiscussion() throws IllegalDataException { 87 87 // http://api.openstreetmap.org/api/0.6/changeset/36749147?include_discussion=true 88 88 Changeset cs = parse(BEGIN + DISCUSSION + END).iterator().next(); -
trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java
r17232 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.ByteArrayInputStream; … … 11 11 import java.util.Iterator; 12 12 13 import org.junit. BeforeClass;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.data.coor.LatLon; 17 17 import org.openstreetmap.josm.data.osm.DataSet; … … 29 29 * Unit tests of {@link OsmReader} class. 30 30 */ 31 publicclass OsmJsonReaderTest {31 class OsmJsonReaderTest { 32 32 33 33 /** 34 34 * Setup rule 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules(); … … 41 41 * Setup test 42 42 */ 43 @Before Class43 @BeforeAll 44 44 public static void setUp() { 45 45 DateUtils.newIsoDateTimeFormat().setTimeZone(DateUtils.UTC); … … 89 89 */ 90 90 @Test 91 publicvoid testHeader() throws Exception {91 void testHeader() throws Exception { 92 92 DataSet ds = parse(""); 93 93 assertEquals("0.6", ds.getVersion()); … … 99 99 */ 100 100 @Test 101 publicvoid testNodeSpatialData() throws Exception {101 void testNodeSpatialData() throws Exception { 102 102 DataSet ds = parse("{\n" + 103 103 " \"type\": \"node\",\n" + … … 116 116 */ 117 117 @Test 118 publicvoid testNodeMetaData() throws Exception {118 void testNodeMetaData() throws Exception { 119 119 DataSet ds = parse("{\n" + 120 120 " \"type\": \"node\",\n" + … … 143 143 */ 144 144 @Test 145 publicvoid testNodeTags() throws Exception {145 void testNodeTags() throws Exception { 146 146 DataSet ds = parse("{\n" + 147 147 " \"type\": \"node\",\n" + … … 167 167 */ 168 168 @Test 169 publicvoid testWay() throws Exception {169 void testWay() throws Exception { 170 170 DataSet ds = parse("{\n" + 171 171 " \"type\": \"way\",\n" + … … 199 199 */ 200 200 @Test 201 publicvoid testRelation() throws Exception {201 void testRelation() throws Exception { 202 202 DataSet ds = parse("{\n" + 203 203 " \"type\": \"relation\",\n" + … … 244 244 */ 245 245 @Test 246 publicvoid testEmptyRelation() throws Exception {246 void testEmptyRelation() throws Exception { 247 247 DataSet ds = parse("{\n" + 248 248 " \"type\": \"relation\",\n" + … … 260 260 */ 261 261 @Test 262 publicvoid testRemark() throws Exception {262 void testRemark() throws Exception { 263 263 DataSet ds = parse("", "," + 264 264 " \"remark\": \"runtime error: Query ran out of memory in \\\"query\\\" at line 5.\"\n"); -
trunk/test/unit/org/openstreetmap/josm/io/OsmReaderTest.java
r17169 r17275 5 5 import static org.hamcrest.CoreMatchers.is; 6 6 import static org.hamcrest.MatcherAssert.assertThat; 7 import static org.junit. Assert.assertEquals;8 import static org.junit. Assert.assertFalse;9 import static org.junit. Assert.assertNull;10 import static org.junit. Assert.assertTrue;11 import static org.junit. Assert.fail;7 import static org.junit.jupiter.api.Assertions.assertEquals; 8 import static org.junit.jupiter.api.Assertions.assertFalse; 9 import static org.junit.jupiter.api.Assertions.assertNull; 10 import static org.junit.jupiter.api.Assertions.assertTrue; 11 import static org.junit.jupiter.api.Assertions.fail; 12 12 13 13 import java.io.ByteArrayInputStream; … … 18 18 import java.util.Arrays; 19 19 20 import org.junit. Rule;21 import org.junit. Test;20 import org.junit.jupiter.api.extension.RegisterExtension; 21 import org.junit.jupiter.api.Test; 22 22 import org.openstreetmap.josm.TestUtils; 23 23 import org.openstreetmap.josm.data.osm.DataSet; … … 34 34 * Unit tests of {@link OsmReader} class. 35 35 */ 36 publicclass OsmReaderTest {36 class OsmReaderTest { 37 37 38 38 /** 39 39 * Setup rule 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules(); … … 66 66 */ 67 67 @Test 68 publicvoid testPostProcessors() throws Exception {68 void testPostProcessors() throws Exception { 69 69 PostProcessorStub registered = new PostProcessorStub(); 70 70 PostProcessorStub unregistered = new PostProcessorStub(); … … 96 96 */ 97 97 @Test 98 publicvoid testUnknownRoot() throws Exception {98 void testUnknownRoot() throws Exception { 99 99 for (Options[] options : options()) { 100 100 testUnknown("<nonosm/>", options); … … 107 107 */ 108 108 @Test 109 publicvoid testUnknownMeta() throws Exception {109 void testUnknownMeta() throws Exception { 110 110 for (Options[] options : options()) { 111 111 testUnknown("<osm version='0.6'><meta osm_base='2017-03-29T19:04:03Z'/></osm>", options); … … 118 118 */ 119 119 @Test 120 publicvoid testUnknownNote() throws Exception {120 void testUnknownNote() throws Exception { 121 121 for (Options[] options : options()) { 122 122 testUnknown("<osm version='0.6'><note>The data included in this document is from www.openstreetmap.org.</note></osm>", options); … … 129 129 */ 130 130 @Test 131 publicvoid testUnknownTag() throws Exception {131 void testUnknownTag() throws Exception { 132 132 for (Options[] options : options()) { 133 133 testUnknown("<osm version='0.6'><foo>bar</foo></osm>", options); … … 170 170 */ 171 171 @Test 172 publicvoid testInvalidUid() throws Exception {172 void testInvalidUid() throws Exception { 173 173 testInvalidData("<osm version='0.6'><node id='1' uid='nan'/></osm>", 174 174 "Illegal value for attribute 'uid'. Got 'nan'. (at line 1, column 82). 82 bytes have been read"); … … 180 180 */ 181 181 @Test 182 publicvoid testMissingId() throws Exception {182 void testMissingId() throws Exception { 183 183 testInvalidData("<osm version='0.6'><node/></osm>", 184 184 "Missing required attribute 'id'. (at line 1, column 65). 64 bytes have been read"); … … 190 190 */ 191 191 @Test 192 publicvoid testMissingRef() throws Exception {192 void testMissingRef() throws Exception { 193 193 testInvalidData("<osm version='0.6'><way id='1' version='1'><nd/></way></osm>", 194 194 "Missing mandatory attribute 'ref' on <nd> of way 1. (at line 1, column 87). 88 bytes have been read"); … … 202 202 */ 203 203 @Test 204 publicvoid testIllegalRef() throws Exception {204 void testIllegalRef() throws Exception { 205 205 testInvalidData("<osm version='0.6'><way id='1' version='1'><nd ref='0'/></way></osm>", 206 206 "Illegal value of attribute 'ref' of element <nd>. Got 0. (at line 1, column 95). 96 bytes have been read"); … … 219 219 */ 220 220 @Test 221 publicvoid testMissingType() throws Exception {221 void testMissingType() throws Exception { 222 222 testInvalidData("<osm version='0.6'><relation id='1' version='1'><member ref='1'/></relation></osm>", 223 223 "Missing attribute 'type' on member 1 in relation 1. (at line 1, column 104). 109 bytes have been read"); … … 229 229 */ 230 230 @Test 231 publicvoid testIllegalType() throws Exception {231 void testIllegalType() throws Exception { 232 232 testInvalidData("<osm version='0.6'><relation id='1' version='1'><member type='foo' ref='1'/></relation></osm>", 233 233 "Illegal value for attribute 'type' on member 1 in relation 1. Got foo. (at line 1, column 115). 120 bytes have been read"); … … 239 239 */ 240 240 @Test 241 publicvoid testMissingKeyValue() throws Exception {241 void testMissingKeyValue() throws Exception { 242 242 testInvalidData("<osm version='0.6'><node id='1' version='1'><tag/></node></osm>", 243 243 "Missing key or value attribute in tag. (at line 1, column 89). 89 bytes have been read"); … … 253 253 */ 254 254 @Test 255 publicvoid testMissingVersion() throws Exception {255 void testMissingVersion() throws Exception { 256 256 testInvalidData("<osm/>", 257 257 "Missing mandatory attribute 'version'. (at line 1, column 45). 44 bytes have been read"); … … 265 265 */ 266 266 @Test 267 publicvoid testUnsupportedVersion() throws Exception {267 void testUnsupportedVersion() throws Exception { 268 268 testInvalidData("<osm version='0.1'/>", 269 269 "Unsupported version: 0.1 (at line 1, column 59). 58 bytes have been read"); … … 275 275 */ 276 276 @Test 277 publicvoid testIllegalVersion() throws Exception {277 void testIllegalVersion() throws Exception { 278 278 testInvalidData("<osm version='0.6'><node id='1' version='nan'/></osm>", 279 279 "Illegal value for attribute 'version' on OSM primitive with ID 1. Got nan. (at line 1, column 86). 86 bytes have been read"); … … 285 285 */ 286 286 @Test 287 publicvoid testIllegalChangeset() throws Exception {287 void testIllegalChangeset() throws Exception { 288 288 testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='nan'/></osm>", 289 289 "Illegal value for attribute 'changeset'. Got nan. (at line 1, column 100). 100 bytes have been read"); … … 297 297 */ 298 298 @Test 299 publicvoid testGdprChangeset() throws Exception {299 void testGdprChangeset() throws Exception { 300 300 String gdprChangeset = "<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>"; 301 301 for (Options[] options : options()) { … … 309 309 */ 310 310 @Test 311 publicvoid testInvalidBounds() throws Exception {311 void testInvalidBounds() throws Exception { 312 312 testInvalidData("<osm version='0.6'><bounds/></osm>", 313 313 "Missing mandatory attributes on element 'bounds'. " + … … 329 329 */ 330 330 @Test 331 publicvoid testTicket14199() throws Exception {331 void testTicket14199() throws Exception { 332 332 try (InputStream in = TestUtils.getRegressionDataStream(14199, "emptytag.osm")) { 333 333 Way w = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE).getWays().iterator().next(); … … 343 343 */ 344 344 @Test 345 publicvoid testTicket14754() throws Exception {345 void testTicket14754() throws Exception { 346 346 try (InputStream in = TestUtils.getRegressionDataStream(14754, "malformed_for_14754.osm")) { 347 347 OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); … … 361 361 */ 362 362 @Test 363 publicvoid testTicket14788() throws Exception {363 void testTicket14788() throws Exception { 364 364 try (InputStream in = TestUtils.getRegressionDataStream(14788, "remove_sign_test_4.osm")) { 365 365 OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE); … … 379 379 */ 380 380 @Test 381 publicvoid testRemark() throws Exception {381 void testRemark() throws Exception { 382 382 String query = "<osm version=\"0.6\" generator=\"Overpass API 0.7.55.4 3079d8ea\">\r\n" + 383 383 "<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>\r\n" + … … 396 396 */ 397 397 @Test 398 publicvoid testUnknownAttributeTags() throws Exception {398 void testUnknownAttributeTags() throws Exception { 399 399 String testData = "<osm version=\"0.6\" generator=\"fake generator\">" 400 400 + "<node id='1' version='1' visible='true' changeset='82' randomkey='randomvalue'></node>" + "</osm>"; -
trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java
r16663 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertArrayEquals;5 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 6 7 7 import java.io.ByteArrayOutputStream; … … 16 16 import java.util.List; 17 17 18 import org.junit. Test;18 import org.junit.jupiter.api.Test; 19 19 import org.openstreetmap.josm.data.coor.LatLon; 20 20 import org.openstreetmap.josm.data.osm.Changeset; … … 28 28 * Unit tests of {@link OsmWriter} class. 29 29 */ 30 publicclass OsmWriterTest {30 class OsmWriterTest { 31 31 32 32 /** … … 34 34 */ 35 35 @Test 36 publicvoid testByIdComparator() {36 void testByIdComparator() { 37 37 38 38 final List<NodeData> ids = new ArrayList<>(); … … 56 56 */ 57 57 @Test 58 publicvoid testHeader() throws IOException {58 void testHeader() throws IOException { 59 59 doTestHeader(null, null, 60 60 "<osm version='0.6' generator='JOSM'>"); … … 82 82 */ 83 83 @Test 84 publicvoid testWriteLock() throws IOException {84 void testWriteLock() throws IOException { 85 85 ByteArrayOutputStream baos = new ByteArrayOutputStream(); 86 86 try (PrintWriter out = new PrintWriter(new OutputStreamWriter(baos, StandardCharsets.UTF_8)); … … 101 101 */ 102 102 @Test 103 publicvoid testChangeset() throws IOException {103 void testChangeset() throws IOException { 104 104 Changeset cs = new Changeset(); 105 105 cs.setUser(User.getAnonymous()); -
trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.java
r14040 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.fail;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.fail; 7 7 8 8 import java.io.ByteArrayInputStream; … … 11 11 import java.nio.charset.StandardCharsets; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.osm.DataSet; 16 16 import org.openstreetmap.josm.data.osm.Node; … … 25 25 * Additional unit tests for {@link OsmReader}. 26 26 */ 27 publicclass ParseWithChangesetReaderTest {27 class ParseWithChangesetReaderTest { 28 28 29 29 /** 30 30 * Setup rule 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 54 54 */ 55 55 @Test 56 publicvoid test_1() throws Exception {56 void test_1() throws Exception { 57 57 String doc = 58 58 "<osm version=\"0.6\">\n" + … … 73 73 */ 74 74 @Test 75 publicvoid test_11() throws Exception {75 void test_11() throws Exception { 76 76 String doc = 77 77 "<osm version=\"0.6\">\n" + … … 92 92 */ 93 93 @Test 94 publicvoid test_12() throws Exception {94 void test_12() throws Exception { 95 95 String doc = 96 96 "<osm version=\"0.6\">\n" + … … 111 111 */ 112 112 @Test 113 publicvoid test_13() throws Exception {113 void test_13() throws Exception { 114 114 String doc = 115 115 "<osm version=\"0.6\">\n" + … … 131 131 */ 132 132 @Test 133 publicvoid test_14() throws Exception {133 void test_14() throws Exception { 134 134 String doc = 135 135 "<osm version=\"0.6\">\n" + … … 152 152 */ 153 153 @Test 154 publicvoid test_2() throws Exception {154 void test_2() throws Exception { 155 155 String doc = 156 156 "<osm version=\"0.6\">\n" + … … 171 171 */ 172 172 @Test 173 publicvoid test_3() throws Exception {173 void test_3() throws Exception { 174 174 String doc = 175 175 "<osm version=\"0.6\">\n" + … … 190 190 */ 191 191 @Test 192 publicvoid test_4() throws IOException {192 void test_4() throws IOException { 193 193 String doc = 194 194 "<osm version=\"0.6\">\n" + … … 205 205 */ 206 206 @Test 207 publicvoid test_5() throws IOException {207 void test_5() throws IOException { 208 208 String doc = 209 209 "<osm version=\"0.6\">\n" + … … 220 220 */ 221 221 @Test 222 publicvoid test_6() throws IOException {222 void test_6() throws IOException { 223 223 String doc = 224 224 "<osm version=\"0.6\">\n" + -
trunk/test/unit/org/openstreetmap/josm/io/UrlPatternsTest.java
r15784 r17275 2 2 package org.openstreetmap.josm.io; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.util.Arrays; … … 8 8 import java.util.regex.Pattern; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.TestUtils; 12 12 … … 14 14 * Unit tests of {@link UrlPatterns}. 15 15 */ 16 publicclass UrlPatternsTest {16 class UrlPatternsTest { 17 17 18 18 private static final List<Class<? extends Enum<?>>> patterns = Arrays.asList( … … 27 27 */ 28 28 @Test 29 publicvoid testUrlPatternEnums() {29 void testUrlPatternEnums() { 30 30 patterns.forEach(TestUtils::superficialEnumCodeCoverage); 31 31 } … … 35 35 */ 36 36 @Test 37 publicvoid testUrlPatterns() {37 void testUrlPatterns() { 38 38 assertTrue(patterns.stream().flatMap(c -> Arrays.stream(c.getEnumConstants())).map(t -> ((UrlPattern) t).pattern()) 39 39 .map(Pattern::compile).count() > 0); -
trunk/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java
r15755 r17275 2 2 package org.openstreetmap.josm.io.audio; 3 3 4 import static org.junit.Assert.assertFalse; 5 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 import static org.junit.jupiter.api.Assertions.assertTimeout; 6 7 7 8 import java.io.File; 8 9 import java.net.MalformedURLException; 9 10 import java.net.URL; 11 import java.time.Duration; 10 12 11 import org.junit. BeforeClass;12 import org.junit. Ignore;13 import org.junit. Test;13 import org.junit.jupiter.api.BeforeAll; 14 import org.junit.jupiter.api.Disabled; 15 import org.junit.jupiter.api.Test; 14 16 import org.openstreetmap.josm.JOSMFixture; 15 17 import org.openstreetmap.josm.TestUtils; … … 19 21 * Unit tests of {@link AudioPlayer} class. 20 22 */ 21 @ Ignore("unresolved sporadic deadlock - see #13809")22 publicclass AudioPlayerTest {23 @Disabled("unresolved sporadic deadlock - see #13809") 24 class AudioPlayerTest { 23 25 24 26 // We play wav files of about 4 seconds + pause, so define timeout at 16 seconds … … 28 30 * Setup test. 29 31 */ 30 @Before Class32 @BeforeAll 31 33 public static void setUp() { 32 34 JOSMFixture.createUnitTestFixture().init(); … … 38 40 * @throws MalformedURLException wrong URL 39 41 */ 40 @Test(timeout = 4*MAX_DURATION) 41 public void testPlay() throws MalformedURLException, Exception { 42 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); 43 File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav")); 42 @Test 43 void testPlay() throws MalformedURLException, Exception { 44 assertTimeout(Duration.ofMillis(4*MAX_DURATION), () -> { 45 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); 46 File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav")); 44 47 45 for (File w : new File[] {wav1, wav2}) { 46 System.out.println("Playing " + w.toPath()); 47 URL url = w.toURI().toURL(); 48 final Stopwatch stopwatch = Stopwatch.createStarted(); 49 AudioPlayer.play(url); 50 assertTrue(AudioPlayer.playing()); 51 assertFalse(AudioPlayer.paused()); 52 AudioPlayer.pause(); 53 assertFalse(AudioPlayer.playing()); 54 assertTrue(AudioPlayer.paused()); 55 AudioPlayer.play(url, AudioPlayer.position()); 56 while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) { 57 Thread.sleep(500); 48 for (File w : new File[] {wav1, wav2}) { 49 System.out.println("Playing " + w.toPath()); 50 URL url = w.toURI().toURL(); 51 final Stopwatch stopwatch = Stopwatch.createStarted(); 52 AudioPlayer.play(url); 53 assertTrue(AudioPlayer.playing()); 54 assertFalse(AudioPlayer.paused()); 55 AudioPlayer.pause(); 56 assertFalse(AudioPlayer.playing()); 57 assertTrue(AudioPlayer.paused()); 58 AudioPlayer.play(url, AudioPlayer.position()); 59 while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) { 60 Thread.sleep(500); 61 } 62 System.out.println("Play finished after " + stopwatch); 63 assertTrue(stopwatch.elapsed() < MAX_DURATION); 64 AudioPlayer.reset(); 65 Thread.sleep(1000); // precaution, see #13809 58 66 } 59 System.out.println("Play finished after " + stopwatch); 60 assertTrue(stopwatch.elapsed() < MAX_DURATION); 61 AudioPlayer.reset(); 62 Thread.sleep(1000); // precaution, see #13809 63 } 67 }); 64 68 } 65 69 } -
trunk/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java
r12327 r17275 2 2 package org.openstreetmap.josm.io.audio; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.File; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.JOSMFixture; 11 11 import org.openstreetmap.josm.TestUtils; … … 14 14 * Unit tests of {@link AudioUtil} class. 15 15 */ 16 publicclass AudioUtilTest {16 class AudioUtilTest { 17 17 18 18 private static final double EPSILON = 1e-11; … … 21 21 * Setup test. 22 22 */ 23 @Before Class23 @BeforeAll 24 24 public static void setUp() { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 30 30 */ 31 31 @Test 32 publicvoid testGetCalibratedDuration() {32 void testGetCalibratedDuration() { 33 33 assertEquals(0.0, AudioUtil.getCalibratedDuration(new File("invalid_file")), EPSILON); 34 34 File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")); -
trunk/test/unit/org/openstreetmap/josm/io/auth/CredentialsAgentExceptionTest.java
r11102 r17275 2 2 package org.openstreetmap.josm.io.auth; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Rule;7 import org.junit. Test;6 import org.junit.jupiter.api.extension.RegisterExtension; 7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.testutils.JOSMTestRules; 9 9 … … 13 13 * Unit tests of {@link CredentialsAgentException} class. 14 14 */ 15 publicclass CredentialsAgentExceptionTest {15 class CredentialsAgentExceptionTest { 16 16 17 17 /** 18 18 * Setup test 19 19 */ 20 @R ule20 @RegisterExtension 21 21 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 22 22 public JOSMTestRules test = new JOSMTestRules(); … … 26 26 */ 27 27 @Test 28 publicvoid testCredentialsAgentException() {28 void testCredentialsAgentException() { 29 29 String msg = "test1"; 30 30 Exception cause = new Exception("test2"); -
trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io.nmea; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.ByteArrayInputStream; … … 17 17 import java.util.TimeZone; 18 18 19 import org.junit. Before;20 import org.junit. Rule;21 import org.junit. Test;19 import org.junit.jupiter.api.BeforeEach; 20 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.api.extension.RegisterExtension; 22 22 import org.openstreetmap.josm.TestUtils; 23 23 import org.openstreetmap.josm.data.coor.LatLon; … … 37 37 * Unit tests of {@link NmeaReader} class. 38 38 */ 39 publicclass NmeaReaderTest {39 class NmeaReaderTest { 40 40 /** 41 41 * Set the timezone and timeout. 42 42 */ 43 @R ule43 @RegisterExtension 44 44 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 45 45 public JOSMTestRules test = new JOSMTestRules(); … … 50 50 * Forces the timezone. 51 51 */ 52 @Before 52 @BeforeEach 53 53 public void setUp() { 54 54 iso8601.setTimeZone(DateUtils.UTC); … … 60 60 */ 61 61 @Test 62 publicvoid testReader() throws Exception {62 void testReader() throws Exception { 63 63 TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin")); 64 64 final NmeaReader in = new NmeaReader(Files.newInputStream(Paths.get("nodist/data/btnmeatrack_2016-01-25.nmea"))); … … 116 116 */ 117 117 @Test 118 publicvoid testIsSentence() {118 void testIsSentence() { 119 119 assertTrue(NmeaReader.isSentence("$GPVTG", Sentence.VTG)); 120 120 assertTrue(NmeaReader.isSentence("$GAVTG", Sentence.VTG)); … … 130 130 */ 131 131 @Test 132 publicvoid testTicket1433() throws Exception {132 void testTicket1433() throws Exception { 133 133 compareWithReference(1433, "2008-08-14-16-04-58", 1241); 134 134 } … … 139 139 */ 140 140 @Test 141 publicvoid testTicket1853() throws Exception {141 void testTicket1853() throws Exception { 142 142 compareWithReference(1853, "PosData-20081216-115434", 1285); 143 143 } … … 148 148 */ 149 149 @Test 150 publicvoid testTicket2147() throws Exception {150 void testTicket2147() throws Exception { 151 151 compareWithReference(2147, "WG20080203171807.log", 487); 152 152 } … … 157 157 */ 158 158 @Test 159 publicvoid testTicket14924() throws Exception {159 void testTicket14924() throws Exception { 160 160 compareWithReference(14924, "input", 0); 161 161 } … … 184 184 */ 185 185 @Test 186 publicvoid testTicket16496() throws Exception {186 void testTicket16496() throws Exception { 187 187 assertEquals("2018-05-30T16:28:59.400Z", iso8601.format( 188 188 readDate("$GNRMC,162859.400,A,4543.03388,N,00058.19870,W,45.252,209.07,300518,,,D,V*13"))); … … 198 198 */ 199 199 @Test 200 publicvoid testTicket16554() throws Exception {200 void testTicket16554() throws Exception { 201 201 assertEquals(63.2420959, readSpeed( 202 202 "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26"), 1e-7); -
trunk/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java
r10931 r17275 2 2 package org.openstreetmap.josm.io.protocols.data; 3 3 4 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertNotNull; 5 5 6 6 import java.io.IOException; … … 8 8 import java.net.URLConnection; 9 9 10 import org.junit. Before;11 import org.junit. Rule;12 import org.junit. Test;10 import org.junit.jupiter.api.BeforeEach; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.testutils.JOSMTestRules; 14 14 … … 16 16 * Unit tests of {@link Handler} class. 17 17 */ 18 publicclass HandlerTest {18 class HandlerTest { 19 19 20 20 /** 21 21 * Use the test rules to remove any layers and reset state. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 public final JOSMTestRules rules = new JOSMTestRules(); 25 25 … … 27 27 * Setup test. 28 28 */ 29 @Before 29 @BeforeEach 30 30 public void setUp() { 31 31 Handler.install(); … … 37 37 */ 38 38 @Test 39 publicvoid testBase64Image() throws IOException {39 void testBase64Image() throws IOException { 40 40 // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML 41 41 URLConnection connection = new Handler().openConnection(new URL("data:image/png;base64," + -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/AddTagsDialogTest.java
r16328 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.util.Map; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit tests for class {@link AddTagsDialog}. 16 16 */ 17 publicclass AddTagsDialogTest {17 class AddTagsDialogTest { 18 18 /** 19 19 * Setup test. 20 20 */ 21 @R ule21 @RegisterExtension 22 22 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 23 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 27 27 */ 28 28 @Test 29 publicvoid testParseUrlTagsToKeyValues() {29 void testParseUrlTagsToKeyValues() { 30 30 Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("wikipedia:de=Residenzschloss Dresden|name:en=Dresden Castle"); 31 31 assertEquals(2, strings.size()); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.BufferedReader; … … 15 15 import java.util.stream.Collectors; 16 16 17 import org.junit. After;18 import org.junit. Before;19 import org.junit. Rule;20 import org.junit. Test;17 import org.junit.jupiter.api.AfterEach; 18 import org.junit.jupiter.api.BeforeEach; 19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 21 import org.openstreetmap.josm.TestUtils; 22 22 import org.openstreetmap.josm.spi.preferences.Config; … … 32 32 * Unit tests for Remote Control 33 33 */ 34 publicclass RemoteControlTest {34 class RemoteControlTest { 35 35 36 36 private String httpBase; … … 46 46 * Setup test. 47 47 */ 48 @R ule48 @RegisterExtension 49 49 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 50 public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT(); … … 54 54 * @throws GeneralSecurityException if a security error occurs 55 55 */ 56 @Before 56 @BeforeEach 57 57 public void setUp() throws GeneralSecurityException { 58 58 if (PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR"))) { … … 69 69 * Stops Remote control after testing requests. 70 70 */ 71 @After 71 @AfterEach 72 72 public void tearDown() { 73 73 RemoteControl.stop(); … … 79 79 */ 80 80 @Test 81 publicvoid testHttpListOfCommands() throws Exception {81 void testHttpListOfCommands() throws Exception { 82 82 testListOfCommands(httpBase); 83 83 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RequestProcessorTest.java
r16825 r17275 13 13 * @author Taylor Smock 14 14 */ 15 publicclass RequestProcessorTest {15 class RequestProcessorTest { 16 16 /** 17 17 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19436">#19436</a> 18 18 */ 19 19 @Test 20 publicvoid testFeaturesDoesNotThrowNPE() {20 void testFeaturesDoesNotThrowNPE() { 21 21 assertTrue(RequestProcessor.getHandlersInfo(Arrays.asList("add_node", "/add_node", "", null)) 22 22 .noneMatch(Objects::isNull)); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.MainApplication; … … 19 19 * Unit tests of {@link AddNodeHandler} class. 20 20 */ 21 publicclass AddNodeHandlerTest {21 class AddNodeHandlerTest { 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection(); … … 38 38 */ 39 39 @Test 40 publicvoid testBadRequestNoLayer() {40 void testBadRequestNoLayer() { 41 41 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle()); 42 42 assertEquals("There is no layer opened to add node", e.getMessage()); … … 47 47 */ 48 48 @Test 49 publicvoid testBadRequestNoParam() {49 void testBadRequestNoParam() { 50 50 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 51 51 MainApplication.getLayerManager().addLayer(layer); … … 58 58 */ 59 59 @Test 60 publicvoid testBadRequestInvalidUrl() {60 void testBadRequestInvalidUrl() { 61 61 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 62 62 assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); … … 67 67 */ 68 68 @Test 69 publicvoid testBadRequestIncompleteUrl() {69 void testBadRequestIncompleteUrl() { 70 70 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 71 71 assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage()); … … 76 76 */ 77 77 @Test 78 publicvoid testNominalRequest() {78 void testNominalRequest() { 79 79 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 80 80 MainApplication.getLayerManager().addLayer(layer); -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 11 import org.openstreetmap.josm.gui.MainApplication; … … 19 19 * Unit tests of {@link AddWayHandler} class. 20 20 */ 21 publicclass AddWayHandlerTest {21 class AddWayHandlerTest { 22 22 /** 23 23 * Setup test. 24 24 */ 25 @R ule25 @RegisterExtension 26 26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 27 public JOSMTestRules test = new JOSMTestRules(); … … 38 38 */ 39 39 @Test 40 publicvoid testBadRequestNoLayer() {40 void testBadRequestNoLayer() { 41 41 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?way=0,0;1,1").handle()); 42 42 assertEquals("There is no layer opened to add way", e.getMessage()); … … 47 47 */ 48 48 @Test 49 publicvoid testBadRequestNoParam() {49 void testBadRequestNoParam() { 50 50 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 51 51 try { … … 62 62 */ 63 63 @Test 64 publicvoid testBadRequestInvalidUrl() {64 void testBadRequestInvalidUrl() { 65 65 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 66 66 assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage()); … … 71 71 */ 72 72 @Test 73 publicvoid testBadRequestIncompleteUrl() {73 void testBadRequestIncompleteUrl() { 74 74 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 75 75 assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage()); … … 80 80 */ 81 81 @Test 82 publicvoid testNominalRequest() {82 void testNominalRequest() { 83 83 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); 84 84 try { -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java
r16739 r17275 4 4 import static org.hamcrest.CoreMatchers.hasItem; 5 5 import static org.hamcrest.MatcherAssert.assertThat; 6 import static org.junit. Assert.assertEquals;6 import static org.junit.jupiter.api.Assertions.assertEquals; 7 7 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 8 8 import static org.junit.jupiter.api.Assertions.assertThrows; … … 11 11 import java.util.List; 12 12 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.extension.RegisterExtension; 14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.imagery.ImageryInfo; 16 16 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; … … 22 22 * Unit tests of {@link ImageryHandler} class. 23 23 */ 24 publicclass ImageryHandlerTest {24 class ImageryHandlerTest { 25 25 /** 26 26 * Setup test. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules(); … … 41 41 */ 42 42 @Test 43 publicvoid testBadRequestNoParam() {43 void testBadRequestNoParam() { 44 44 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 45 45 assertEquals("Parameter must not be null", e.getMessage()); … … 51 51 */ 52 52 @Test 53 publicvoid testBadRequestInvalidUrl() {53 void testBadRequestInvalidUrl() { 54 54 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 55 55 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 60 60 */ 61 61 @Test 62 publicvoid testBadRequestIncompleteUrl() {62 void testBadRequestIncompleteUrl() { 63 63 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 64 64 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 69 69 */ 70 70 @Test 71 publicvoid testNominalRequest() {71 void testNominalRequest() { 72 72 assertDoesNotThrow(() -> newHandler("https://localhost?url=foo").handle()); 73 73 } … … 78 78 */ 79 79 @Test 80 publicvoid testOptionalParams() throws Exception {80 void testOptionalParams() throws Exception { 81 81 List<String> optionalParams = Arrays.asList(newHandler("").getOptionalParams()); 82 82 assertThat(optionalParams, hasItem("type")); … … 91 91 */ 92 92 @Test 93 publicvoid testBuildImageryInfo() throws Exception {93 void testBuildImageryInfo() throws Exception { 94 94 String url = "https://localhost/imagery?title=osm" 95 95 + "&type=tms&min_zoom=3&max_zoom=23&category=osmbasedmap&country_code=XA" … … 110 110 */ 111 111 @Test 112 publicvoid testTicket19483() throws Exception {112 void testTicket19483() throws Exception { 113 113 String url = "https://localhost/imagery?url=" + 114 114 "tms[3-7]%3Ahttps%3A%2F%2Fservices.digitalglobe.com%2Fearthservice%2Ftmsaccess%2F" + -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java
r16618 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; … … 8 8 import java.io.File; 9 9 10 import org.junit. Rule;11 import org.junit. Test;10 import org.junit.jupiter.api.extension.RegisterExtension; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.TestUtils; 13 13 import org.openstreetmap.josm.gui.MainApplication; … … 22 22 * Unit tests of {@link ImportHandler} class. 23 23 */ 24 publicclass ImportHandlerTest {24 class ImportHandlerTest { 25 25 /** 26 26 * Setup test. 27 27 */ 28 @R ule28 @RegisterExtension 29 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 30 public JOSMTestRules test = new JOSMTestRules().main(); … … 42 42 */ 43 43 @Test 44 publicvoid testTicket7434() throws Exception {44 void testTicket7434() throws Exception { 45 45 ImportHandler req = newHandler("http://localhost:8111/import?url=http://localhost:8888/relations?relations=19711&mode=recursive"); 46 46 assertEquals("http://localhost:8888/relations?relations=19711&mode=recursive", req.args.get("url")); … … 52 52 */ 53 53 @Test 54 publicvoid testBadRequestNoParam() throws Exception {54 void testBadRequestNoParam() throws Exception { 55 55 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 56 56 assertEquals("MalformedURLException: null", e.getMessage()); … … 62 62 */ 63 63 @Test 64 publicvoid testBadRequestInvalidUrl() throws Exception {64 void testBadRequestInvalidUrl() throws Exception { 65 65 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle()); 66 66 assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage()); … … 72 72 */ 73 73 @Test 74 publicvoid testBadRequestIncompleteUrl() throws Exception {74 void testBadRequestIncompleteUrl() throws Exception { 75 75 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 76 76 assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage()); … … 82 82 */ 83 83 @Test 84 publicvoid testNominalRequest() throws Exception {84 void testNominalRequest() throws Exception { 85 85 String url = new File(TestUtils.getRegressionDataFile(11957, "data.osm")).toURI().toURL().toExternalForm(); 86 86 try { -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link LoadAndZoomHandler} class. 17 17 */ 18 publicclass LoadAndZoomHandlerTest {18 class LoadAndZoomHandlerTest { 19 19 /** 20 20 * Setup test. 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testBadRequestNoParam() throws Exception {38 void testBadRequestNoParam() throws Exception { 39 39 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle()); 40 40 assertEquals("NumberFormatException (empty String)", e.getMessage()); … … 46 46 */ 47 47 @Test 48 publicvoid testBadRequestInvalidUrl() throws Exception {48 void testBadRequestInvalidUrl() throws Exception { 49 49 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 50 50 assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage()); … … 56 56 */ 57 57 @Test 58 publicvoid testBadRequestIncompleteUrl() throws Exception {58 void testBadRequestIncompleteUrl() throws Exception { 59 59 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 60 60 assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage()); … … 66 66 */ 67 67 @Test 68 publicvoid testNominalRequest() throws Exception {68 void testNominalRequest() throws Exception { 69 69 assertDoesNotThrow(() -> newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle()); 70 70 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java
r16618 r17275 6 6 import static org.junit.jupiter.api.Assertions.assertThrows; 7 7 8 import org.junit. Rule;9 import org.junit. Test;8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.junit.jupiter.api.Test; 10 10 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link LoadObjectHandler} class. 17 17 */ 18 publicclass LoadObjectHandlerTest {18 class LoadObjectHandlerTest { 19 19 /** 20 20 * Setup test. 21 21 */ 22 @R ule22 @RegisterExtension 23 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 24 24 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testBadRequestNoParam() {37 void testBadRequestNoParam() { 38 38 assertDoesNotThrow(() -> newHandler(null).handle()); 39 39 } … … 43 43 */ 44 44 @Test 45 publicvoid testBadRequestInvalidUrl() {45 void testBadRequestInvalidUrl() { 46 46 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle()); 47 47 assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage()); … … 52 52 */ 53 53 @Test 54 publicvoid testBadRequestIncompleteUrl() {54 void testBadRequestIncompleteUrl() { 55 55 Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle()); 56 56 assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage()); … … 61 61 */ 62 62 @Test 63 publicvoid testNominalRequest() {63 void testNominalRequest() { 64 64 assertDoesNotThrow(() -> newHandler("https://localhost?objects=foo,bar").handle()); 65 65 } -
trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java
r12558 r17275 2 2 package org.openstreetmap.josm.io.remotecontrol.handler; 3 3 4 import static org.junit.Assert.assertEquals; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertThrows; 5 6 6 7 import java.util.Collections; … … 8 9 import java.util.Map; 9 10 10 import org.junit. Rule;11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 12 13 import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault; 13 14 import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException; … … 19 20 * Unit tests of {@link RequestHandler} class. 20 21 */ 21 publicclass RequestHandlerTest {22 class RequestHandlerTest { 22 23 23 24 /** 24 25 * Setup test. 25 26 */ 26 @R ule27 @RegisterExtension 27 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 29 public JOSMTestRules test = new JOSMTestRules(); … … 62 63 */ 63 64 @Test 64 publicvoid testRequestParameter1() throws RequestHandlerBadRequestException {65 void testRequestParameter1() throws RequestHandlerBadRequestException { 65 66 final Map<String, String> expected = new HashMap<>(); 66 67 expected.put("query", "a"); … … 74 75 */ 75 76 @Test 76 publicvoid testRequestParameter2() throws RequestHandlerBadRequestException {77 void testRequestParameter2() throws RequestHandlerBadRequestException { 77 78 assertEquals(Collections.singletonMap("query", "a&b==c"), 78 79 getRequestParameter("http://example.com/?query=a%26b==c")); … … 84 85 */ 85 86 @Test 86 publicvoid testRequestParameter3() throws RequestHandlerBadRequestException {87 void testRequestParameter3() throws RequestHandlerBadRequestException { 87 88 assertEquals(Collections.singleton("blue+light blue"), 88 89 getRequestParameter("http://example.com/blue+light%20blue?blue%2Blight+blue").keySet()); … … 96 97 */ 97 98 @Test 98 publicvoid testRequestParameter4() throws RequestHandlerBadRequestException {99 void testRequestParameter4() throws RequestHandlerBadRequestException { 99 100 assertEquals(Collections.singletonMap("/?:@-._~!$'()* ,;", "/?:@-._~!$'()* ,;=="), getRequestParameter( 100 101 "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$'()*+,;=/?:@-._~!$'()*+,;==#/?:@-._~!$&'()*+,;=" … … 107 108 */ 108 109 @Test 109 publicvoid testRequestParameter5() throws RequestHandlerBadRequestException {110 void testRequestParameter5() throws RequestHandlerBadRequestException { 110 111 final Map<String, String> expected = new HashMap<>(); 111 112 expected.put("space", " "); … … 119 120 */ 120 121 @Test 121 publicvoid testRequestParameter6() throws RequestHandlerBadRequestException {122 void testRequestParameter6() throws RequestHandlerBadRequestException { 122 123 final Map<String, String> expected = new HashMap<>(); 123 124 expected.put("addtags", "wikipedia:de=Weiße_Gasse|maxspeed=5"); … … 135 136 /** 136 137 * Test request parameter - invalid case 137 * @throws RequestHandlerBadRequestException always138 138 */ 139 @Test(expected = RequestHandlerBadRequestException.class) 140 public void testRequestParameterInvalid() throws RequestHandlerBadRequestException { 141 getRequestParameter("http://localhost:8111/load_and_zoom"+ 139 @Test 140 void testRequestParameterInvalid() { 141 assertThrows(RequestHandlerBadRequestException.class, 142 () -> getRequestParameter("http://localhost:8111/load_and_zoom"+ 142 143 "?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5"+ 143 144 "&select=way23071688,way23076176,way23076177,"+ 144 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325") ;145 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325")); 145 146 } 146 147 } -
trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.io.rtklib; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.io.IOException; … … 12 12 import java.util.TimeZone; 13 13 14 import org.junit. Before;15 import org.junit. Rule;16 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 18 import org.openstreetmap.josm.data.gpx.GpxConstants; … … 27 27 * Unit tests of {@link RtkLibPosReader} class. 28 28 */ 29 publicclass RtkLibPosReaderTest {29 class RtkLibPosReaderTest { 30 30 /** 31 31 * Set the timezone and timeout. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 * Forces the timezone. 41 41 */ 42 @Before 42 @BeforeEach 43 43 public void setUp() { 44 44 iso8601.setTimeZone(DateUtils.UTC); … … 57 57 */ 58 58 @Test 59 publicvoid testReader() throws Exception {59 void testReader() throws Exception { 60 60 RtkLibPosReader in = read("nodist/data/rtklib_example.pos"); 61 61 assertEquals(137, in.getNumberOfCoordinates()); … … 83 83 */ 84 84 @Test 85 publicvoid testReader2() throws Exception {85 void testReader2() throws Exception { 86 86 RtkLibPosReader in = read("nodist/data/rtklib_example2.pos"); 87 87 assertEquals(6, in.getNumberOfCoordinates()); -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java
r15070 r17275 2 2 package org.openstreetmap.josm.io.session; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;6 import static org.junit. Assert.assertTrue;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.assertTrue; 7 7 8 8 import java.io.ByteArrayInputStream; … … 13 13 import java.util.List; 14 14 15 import org.junit. Rule;16 import org.junit. Test;15 import org.junit.jupiter.api.extension.RegisterExtension; 16 import org.junit.jupiter.api.Test; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.data.coor.EastNorth; … … 33 33 * Unit tests for Session reading. 34 34 */ 35 publicclass SessionReaderTest {35 class SessionReaderTest { 36 36 37 37 /** 38 38 * Setup tests. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules().projection(); … … 60 60 */ 61 61 @Test 62 publicvoid testReadEmpty() throws IOException, IllegalDataException {62 void testReadEmpty() throws IOException, IllegalDataException { 63 63 assertTrue(testRead("empty.jos").isEmpty()); 64 64 assertTrue(testRead("empty.joz").isEmpty()); … … 71 71 */ 72 72 @Test 73 publicvoid testReadOsm() throws IOException, IllegalDataException {73 void testReadOsm() throws IOException, IllegalDataException { 74 74 for (String file : new String[]{"osm.jos", "osm.joz"}) { 75 75 List<Layer> layers = testRead(file); … … 87 87 */ 88 88 @Test 89 publicvoid testReadGpx() throws IOException, IllegalDataException {89 void testReadGpx() throws IOException, IllegalDataException { 90 90 for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) { 91 91 List<Layer> layers = testRead(file); … … 103 103 */ 104 104 @Test 105 publicvoid testReadGpxAndMarker() throws IOException, IllegalDataException {105 void testReadGpxAndMarker() throws IOException, IllegalDataException { 106 106 List<Layer> layers = testRead("gpx_markers.joz"); 107 107 assertEquals(layers.size(), 2); … … 127 127 */ 128 128 @Test 129 publicvoid testReadImage() throws IOException, IllegalDataException {129 void testReadImage() throws IOException, IllegalDataException { 130 130 final List<Layer> layers = testRead("bing.jos"); 131 131 assertEquals(layers.size(), 1); … … 144 144 */ 145 145 @Test 146 publicvoid testReadNotes() throws IOException, IllegalDataException {146 void testReadNotes() throws IOException, IllegalDataException { 147 147 if (MainApplication.isDisplayingMapView()) { 148 148 for (NoteLayer nl : MainApplication.getLayerManager().getLayersOfType(NoteLayer.class)) { … … 163 163 */ 164 164 @Test 165 publicvoid testTicket17701() throws Exception {165 void testTicket17701() throws Exception { 166 166 try (InputStream in = new ByteArrayInputStream(("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" + 167 167 "<josm-session version=\"0.1\">\n" + -
trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java
r14138 r17275 10 10 import java.util.Map; 11 11 12 import org.junit. Before;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 import org.openstreetmap.josm.data.gpx.GpxData; … … 38 38 * Unit tests for Session writing. 39 39 */ 40 publicclass SessionWriterTest {40 class SessionWriterTest { 41 41 42 42 protected static final class OsmHeadlessJosExporter extends OsmDataSessionExporter { … … 87 87 * Setup tests. 88 88 */ 89 @R ule89 @RegisterExtension 90 90 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 91 91 public JOSMTestRules test = new JOSMTestRules().projection().main(); … … 94 94 * Setup tests. 95 95 */ 96 @Before 96 @BeforeEach 97 97 public void setUp() { 98 98 MainApplication.getLayerManager().addLayer(createOsmLayer()); … … 157 157 */ 158 158 @Test 159 publicvoid testWriteEmptyJos() throws IOException {159 void testWriteEmptyJos() throws IOException { 160 160 testWrite(Collections.<Layer>emptyList(), false); 161 161 } … … 166 166 */ 167 167 @Test 168 publicvoid testWriteEmptyJoz() throws IOException {168 void testWriteEmptyJoz() throws IOException { 169 169 testWrite(Collections.<Layer>emptyList(), true); 170 170 } … … 175 175 */ 176 176 @Test 177 publicvoid testWriteOsmJos() throws IOException {177 void testWriteOsmJos() throws IOException { 178 178 testWrite(Collections.<Layer>singletonList(createOsmLayer()), false); 179 179 } … … 184 184 */ 185 185 @Test 186 publicvoid testWriteOsmJoz() throws IOException {186 void testWriteOsmJoz() throws IOException { 187 187 testWrite(Collections.<Layer>singletonList(createOsmLayer()), true); 188 188 } … … 193 193 */ 194 194 @Test 195 publicvoid testWriteGpxJos() throws IOException {195 void testWriteGpxJos() throws IOException { 196 196 testWrite(Collections.<Layer>singletonList(createGpxLayer()), false); 197 197 } … … 202 202 */ 203 203 @Test 204 publicvoid testWriteGpxJoz() throws IOException {204 void testWriteGpxJoz() throws IOException { 205 205 testWrite(Collections.<Layer>singletonList(createGpxLayer()), true); 206 206 } … … 211 211 */ 212 212 @Test 213 publicvoid testWriteGpxAndMarkerJoz() throws IOException {213 void testWriteGpxAndMarkerJoz() throws IOException { 214 214 GpxLayer gpx = createGpxLayer(); 215 215 testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true); … … 221 221 */ 222 222 @Test 223 publicvoid testWriteImageryLayer() throws IOException {223 void testWriteImageryLayer() throws IOException { 224 224 final Layer layer = createImageryLayer(); 225 225 testWrite(Collections.singletonList(layer), true); … … 231 231 */ 232 232 @Test 233 publicvoid testWriteNoteLayer() throws IOException {233 void testWriteNoteLayer() throws IOException { 234 234 final Layer layer = createNoteLayer(); 235 235 testWrite(Collections.singletonList(layer), true);
Note:
See TracChangeset
for help on using the changeset viewer.