Changeset 17275 in josm for trunk/test/unit/org/openstreetmap/josm/data
- Timestamp:
- 2020-10-28T20:41:00+01:00 (3 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/data
- Files:
-
- 138 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/APIDataSetTest.java
r13020 r17275 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;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.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 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.conflict.ConflictCollection; 14 14 import org.openstreetmap.josm.data.osm.CyclicUploadDependencyException; … … 26 26 * Unit tests for class {@link APIDataSet}. 27 27 */ 28 publicclass APIDataSetTest {28 class APIDataSetTest { 29 29 30 30 /** 31 31 * Setup test. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); 36 36 37 37 @Test 38 publicvoid testOneNewRelationOnly() throws CyclicUploadDependencyException {38 void testOneNewRelationOnly() throws CyclicUploadDependencyException { 39 39 Relation r = new Relation(); 40 40 r.put("name", "r1"); … … 52 52 53 53 @Test 54 publicvoid testNewParentChildPair() throws CyclicUploadDependencyException {54 void testNewParentChildPair() throws CyclicUploadDependencyException { 55 55 DataSet ds = new DataSet(); 56 56 Relation r1 = new Relation(); … … 75 75 76 76 @Test 77 publicvoid testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException {77 void testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException { 78 78 DataSet ds = new DataSet(); 79 79 … … 121 121 122 122 @Test 123 publicvoid testOneParentTwoNewChildren() throws CyclicUploadDependencyException {123 void testOneParentTwoNewChildren() throws CyclicUploadDependencyException { 124 124 DataSet ds = new DataSet(); 125 125 Relation r1 = new Relation(); … … 150 150 151 151 @Test // for ticket #9624 152 publicvoid testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException {152 void testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException { 153 153 DataSet ds = new DataSet(); 154 154 Relation r1 = new Relation(1); … … 193 193 194 194 @Test // for ticket #9656 195 publicvoid testDeleteWay() throws CyclicUploadDependencyException {195 void testDeleteWay() throws CyclicUploadDependencyException { 196 196 DataSet ds = new DataSet(); 197 197 final Way way = new Way(1, 2); … … 230 230 231 231 @Test 232 publicvoid testOneCycle() {232 void testOneCycle() { 233 233 DataSet ds = new DataSet(); 234 234 Relation r1 = new Relation(); -
trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java
r10910 r17275 2 2 package org.openstreetmap.josm.data; 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.awt.geom.Rectangle2D; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.coor.LatLon; 12 12 … … 14 14 * Unit tests for class {@link Bounds}. 15 15 */ 16 publicclass BoundsTest {16 class BoundsTest { 17 17 18 18 @Test 19 publicvoid testCrossing() {19 void testCrossing() { 20 20 Bounds b1 = new Bounds(0, 170, 50, -170); 21 21 assertTrue(b1.crosses180thMeridian()); … … 70 70 */ 71 71 @Test 72 publicvoid testConstructorNominalCases() {72 void testConstructorNominalCases() { 73 73 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d))); 74 74 doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d), true)); … … 85 85 */ 86 86 @Test 87 publicvoid testConstructorSinglePointCases() {87 void testConstructorSinglePointCases() { 88 88 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d))); 89 89 doTestConstructorPoint(new Bounds(new LatLon(1d, 2d), true)); -
trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java
r17120 r17275 2 2 package org.openstreetmap.josm.data; 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 9 9 import java.io.File; … … 12 12 import java.util.List; 13 13 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.ImageData.ImageDataUpdateListener; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 26 26 * Unit tests for class {@link ImageData}. 27 27 */ 28 publicclass ImageDataTest {28 class ImageDataTest { 29 29 30 30 private static List<ImageEntry> getOneImage() { … … 35 35 36 36 @Test 37 publicvoid testWithNullData() {37 void testWithNullData() { 38 38 ImageData data = new ImageData(); 39 39 assertEquals(0, data.getImages().size()); … … 53 53 54 54 @Test 55 publicvoid testImageEntryWithImages() {55 void testImageEntryWithImages() { 56 56 assertEquals(1, new ImageData(getOneImage()).getImages().size()); 57 57 } 58 58 59 59 @Test 60 publicvoid testSortData(@Mocked Collections ignore) {60 void testSortData(@Mocked Collections ignore) { 61 61 List<ImageEntry> list = getOneImage(); 62 62 … … 69 69 70 70 @Test 71 publicvoid testIsModifiedFalse() {71 void testIsModifiedFalse() { 72 72 assertFalse(new ImageData(getOneImage()).isModified()); 73 73 } 74 74 75 75 @Test 76 publicvoid testIsModifiedTrue() {76 void testIsModifiedTrue() { 77 77 List<ImageEntry> list = getOneImage(); 78 78 … … 85 85 86 86 @Test 87 publicvoid testSelectFirstImage() {88 List<ImageEntry> list = getOneImage(); 89 90 ImageData data = new ImageData(list); 91 data.selectFirstImage(); 92 assertEquals(1, data.getSelectedImages().size()); 93 assertEquals(list.get(0), data.getSelectedImages().get(0)); 94 } 95 96 @Test 97 publicvoid testSelectLastImage() {87 void testSelectFirstImage() { 88 List<ImageEntry> list = getOneImage(); 89 90 ImageData data = new ImageData(list); 91 data.selectFirstImage(); 92 assertEquals(1, data.getSelectedImages().size()); 93 assertEquals(list.get(0), data.getSelectedImages().get(0)); 94 } 95 96 @Test 97 void testSelectLastImage() { 98 98 List<ImageEntry> list = getOneImage(); 99 99 list.add(new ImageEntry()); … … 106 106 107 107 @Test 108 publicvoid testSelectNextImage() {108 void testSelectNextImage() { 109 109 List<ImageEntry> list = getOneImage(); 110 110 … … 120 120 121 121 @Test 122 publicvoid testSelectPreviousImage() {122 void testSelectPreviousImage() { 123 123 List<ImageEntry> list = getOneImage(); 124 124 list.add(new ImageEntry()); … … 136 136 137 137 @Test 138 publicvoid testSetSelectedImage() {138 void testSetSelectedImage() { 139 139 List<ImageEntry> list = getOneImage(); 140 140 … … 146 146 147 147 @Test 148 publicvoid testClearSelectedImages() {148 void testClearSelectedImages() { 149 149 List<ImageEntry> list = getOneImage(); 150 150 … … 156 156 157 157 @Test 158 publicvoid testSelectionListener() {158 void testSelectionListener() { 159 159 List<ImageEntry> list = getOneImage(); 160 160 ImageData data = new ImageData(list); … … 175 175 176 176 @Test 177 publicvoid testRemoveSelectedImage() {177 void testRemoveSelectedImage() { 178 178 List<ImageEntry> list = getOneImage(); 179 179 ImageData data = new ImageData(list); … … 185 185 186 186 @Test 187 publicvoid testRemoveSelectedImages() {187 void testRemoveSelectedImages() { 188 188 List<ImageEntry> list = getOneImage(); 189 189 list.add(new ImageEntry()); … … 198 198 199 199 @Test 200 publicvoid testRemoveSelectedImagesWithRemainingImages() {200 void testRemoveSelectedImagesWithRemainingImages() { 201 201 List<ImageEntry> list = getOneImage(); 202 202 list.add(new ImageEntry()); … … 212 212 213 213 @Test 214 publicvoid testSelectImageAfterRemove() {214 void testSelectImageAfterRemove() { 215 215 List<ImageEntry> list = getOneImage(); 216 216 list.add(new ImageEntry()); … … 225 225 226 226 @Test 227 publicvoid testSelectImageAfterRemoveWhenTheLastIsSelected() {227 void testSelectImageAfterRemoveWhenTheLastIsSelected() { 228 228 List<ImageEntry> list = getOneImage(); 229 229 list.add(new ImageEntry()); … … 238 238 239 239 @Test 240 publicvoid testRemoveSelectedImageTriggerListener() {240 void testRemoveSelectedImageTriggerListener() { 241 241 List<ImageEntry> list = getOneImage(); 242 242 list.add(new ImageEntry()); … … 258 258 259 259 @Test 260 publicvoid testRemoveSelectedImagesTriggerListener() {260 void testRemoveSelectedImagesTriggerListener() { 261 261 List<ImageEntry> list = getOneImage(); 262 262 list.add(new ImageEntry()); … … 278 278 279 279 @Test 280 publicvoid testRemoveImageAndTriggerListener() {280 void testRemoveImageAndTriggerListener() { 281 281 List<ImageEntry> list = getOneImage(); 282 282 ImageData data = new ImageData(list); … … 297 297 298 298 @Test 299 publicvoid testMergeFrom() {299 void testMergeFrom() { 300 300 ImageEntry image = new ImageEntry(new File("test2")); 301 301 List<ImageEntry> list1 = getOneImage(); … … 323 323 324 324 @Test 325 publicvoid testMergeFromSelectedImage() {325 void testMergeFromSelectedImage() { 326 326 ImageEntry image = new ImageEntry(new File("test2")); 327 327 List<ImageEntry> list1 = getOneImage(); … … 340 340 341 341 @Test 342 publicvoid testAddImageToSelection() {342 void testAddImageToSelection() { 343 343 List<ImageEntry> list = getOneImage(); 344 344 list.add(new ImageEntry(new File("test2"))); … … 353 353 354 354 @Test 355 publicvoid testRemoveImageToSelection() {355 void testRemoveImageToSelection() { 356 356 List<ImageEntry> list = getOneImage(); 357 357 list.add(new ImageEntry()); … … 366 366 367 367 @Test 368 publicvoid testIsSelected() {368 void testIsSelected() { 369 369 List<ImageEntry> list = getOneImage(); 370 370 list.add(new ImageEntry(new File("test2"))); … … 381 381 382 382 @Test 383 publicvoid testActionsWithMultipleImagesSelected() {383 void testActionsWithMultipleImagesSelected() { 384 384 List<ImageEntry> list = getOneImage(); 385 385 list.add(new ImageEntry(new File("test2"))); … … 402 402 403 403 @Test 404 publicvoid testTriggerListenerWhenNewImageIsSelectedAndRemoved() {404 void testTriggerListenerWhenNewImageIsSelectedAndRemoved() { 405 405 List<ImageEntry> list = getOneImage(); 406 406 list.add(new ImageEntry()); … … 423 423 424 424 @Test 425 publicvoid testUpdatePosition() {425 void testUpdatePosition() { 426 426 List<ImageEntry> list = getOneImage(); 427 427 ImageData data = new ImageData(list); … … 435 435 436 436 @Test 437 publicvoid testUpdateDirection() {437 void testUpdateDirection() { 438 438 List<ImageEntry> list = getOneImage(); 439 439 ImageData data = new ImageData(list); … … 447 447 448 448 @Test 449 publicvoid testTriggerListenerOnUpdate() {449 void testTriggerListenerOnUpdate() { 450 450 List<ImageEntry> list = getOneImage(); 451 451 ImageData data = new ImageData(list); … … 467 467 468 468 @Test 469 publicvoid testManuallyTriggerUpdateListener() {469 void testManuallyTriggerUpdateListener() { 470 470 List<ImageEntry> list = getOneImage(); 471 471 ImageData data = new ImageData(list); -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java
r14149 r17275 2 2 package org.openstreetmap.josm.data; 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 Preferences}. 14 14 */ 15 publicclass PreferencesTest {15 class PreferencesTest { 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().preferences().fakeAPI(); … … 26 26 */ 27 27 @Test 28 publicvoid testToXml() {28 void testToXml() { 29 29 assertEquals(String.format( 30 30 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n" + -
trunk/test/unit/org/openstreetmap/josm/data/PreferencesUtilsTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Before;7 import org.junit. Rule;8 import org.junit. Test;6 import org.junit.jupiter.api.BeforeEach; 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; 10 10 … … 15 15 * Unit tests for class {@link PreferencesUtils}. 16 16 */ 17 publicclass PreferencesUtilsTest {17 class PreferencesUtilsTest { 18 18 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().preferences(); … … 27 27 * Setup test. 28 28 */ 29 @Before 29 @BeforeEach 30 30 public void setUp() { 31 31 PreferencesUtils.resetLog(); … … 36 36 */ 37 37 @Test 38 publicvoid testLog() {38 void testLog() { 39 39 assertEquals("", PreferencesUtils.getLog()); 40 40 PreferencesUtils.log("test"); … … 51 51 */ 52 52 @Test 53 publicvoid testUtilityClass() throws ReflectiveOperationException {53 void testUtilityClass() throws ReflectiveOperationException { 54 54 UtilityClassTestUtil.assertUtilityClassWellDefined(PreferencesUtils.class); 55 55 } -
trunk/test/unit/org/openstreetmap/josm/data/ProjectionBoundsTest.java
r10300 r17275 2 2 package org.openstreetmap.josm.data; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 8 8 /** 9 9 * Unit tests for class {@link ProjectionBounds}. 10 10 */ 11 publicclass ProjectionBoundsTest {11 class ProjectionBoundsTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testToString() {17 void testToString() { 18 18 assertEquals("ProjectionBounds[1.0,2.0,3.0,4.0]", new ProjectionBounds(1, 2, 3, 4).toString()); 19 19 } -
trunk/test/unit/org/openstreetmap/josm/data/UserIdentityManagerTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.data; 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.assertNull; 8 import static org.junit.Assert.assertSame; 9 import static org.junit.Assert.assertTrue; 10 11 import org.junit.Rule; 12 import org.junit.Test; 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.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 import static org.junit.jupiter.api.Assertions.assertThrows; 11 12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 13 14 import org.openstreetmap.josm.data.osm.User; 14 15 import org.openstreetmap.josm.data.osm.UserInfo; … … 21 22 * Unit tests of {@link UserIdentityManager} class. 22 23 */ 23 publicclass UserIdentityManagerTest {24 class UserIdentityManagerTest { 24 25 25 26 /** 26 27 * Setup test. 27 28 */ 28 @R ule29 @RegisterExtension 29 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 31 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 45 46 */ 46 47 @Test 47 publicvoid testSingletonAccess() {48 void testSingletonAccess() { 48 49 49 50 UserIdentityManager im = UserIdentityManager.getInstance(); … … 62 63 */ 63 64 @Test 64 publicvoid testSetAnonymous() {65 void testSetAnonymous() { 65 66 UserIdentityManager im = UserIdentityManager.getInstance(); 66 67 … … 82 83 */ 83 84 @Test 84 publicvoid testSetPartiallyIdentified() {85 void testSetPartiallyIdentified() { 85 86 UserIdentityManager im = UserIdentityManager.getInstance(); 86 87 im.setPartiallyIdentified("test"); … … 101 102 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - null case. 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 @Test 104 105 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 105 publicvoid testSetPartiallyIdentifiedNull() {106 UserIdentityManager.getInstance().setPartiallyIdentified(null);106 void testSetPartiallyIdentifiedNull() { 107 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(null)); 107 108 } 108 109 … … 110 111 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - empty case. 111 112 */ 112 @Test (expected = IllegalArgumentException.class)113 publicvoid testSetPartiallyIdentifiedEmpty() {114 UserIdentityManager.getInstance().setPartiallyIdentified("");113 @Test 114 void testSetPartiallyIdentifiedEmpty() { 115 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified("")); 115 116 } 116 117 … … 118 119 * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - blank case. 119 120 */ 120 @Test (expected = IllegalArgumentException.class)121 publicvoid testSetPartiallyIdentifiedBlank() {122 UserIdentityManager.getInstance().setPartiallyIdentified(" \t ");121 @Test 122 void testSetPartiallyIdentifiedBlank() { 123 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(" \t ")); 123 124 } 124 125 … … 127 128 */ 128 129 @Test 129 publicvoid testSetFullyIdentified() {130 void testSetFullyIdentified() { 130 131 UserIdentityManager im = UserIdentityManager.getInstance(); 131 132 … … 149 150 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null name case. 150 151 */ 151 @Test (expected = IllegalArgumentException.class)152 @Test 152 153 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 153 publicvoid testSetFullyIdentifiedNullName() {154 UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo());154 void testSetFullyIdentifiedNullName() { 155 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo())); 155 156 } 156 157 … … 158 159 * Unit test of {@link UserIdentityManager#setFullyIdentified} - empty name case. 159 160 */ 160 @Test (expected = IllegalArgumentException.class)161 publicvoid testSetFullyIdentifiedEmptyName() {162 UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo());161 @Test 162 void testSetFullyIdentifiedEmptyName() { 163 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo())); 163 164 } 164 165 … … 166 167 * Unit test of {@link UserIdentityManager#setFullyIdentified} - blank name case. 167 168 */ 168 @Test (expected = IllegalArgumentException.class)169 publicvoid testSetFullyIdentifiedBlankName() {170 UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo());169 @Test 170 void testSetFullyIdentifiedBlankName() { 171 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo())); 171 172 } 172 173 … … 174 175 * Unit test of {@link UserIdentityManager#setFullyIdentified} - null info case. 175 176 */ 176 @Test (expected = IllegalArgumentException.class)177 publicvoid testSetFullyIdentifiedNullInfo() {178 UserIdentityManager.getInstance().setFullyIdentified("test", null);177 @Test 178 void testSetFullyIdentifiedNullInfo() { 179 assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("test", null)); 179 180 } 180 181 … … 183 184 */ 184 185 @Test 185 publicvoid testInitFromPreferences1() {186 void testInitFromPreferences1() { 186 187 UserIdentityManager im = UserIdentityManager.getInstance(); 187 188 … … 208 209 */ 209 210 @Test 210 publicvoid testInitFromPreferences2() {211 void testInitFromPreferences2() { 211 212 UserIdentityManager im = UserIdentityManager.getInstance(); 212 213 … … 233 234 */ 234 235 @Test 235 publicvoid testInitFromPreferences3() {236 void testInitFromPreferences3() { 236 237 UserIdentityManager im = UserIdentityManager.getInstance(); 237 238 … … 260 261 */ 261 262 @Test 262 publicvoid testInitFromPreferences4() {263 void testInitFromPreferences4() { 263 264 UserIdentityManager im = UserIdentityManager.getInstance(); 264 265 … … 286 287 */ 287 288 @Test 288 publicvoid testInitFromPreferences5() {289 void testInitFromPreferences5() { 289 290 UserIdentityManager im = UserIdentityManager.getInstance(); 290 291 … … 307 308 308 309 @Test 309 publicvoid testApiUrlChanged() {310 void testApiUrlChanged() { 310 311 UserIdentityManager im = UserIdentityManager.getInstance(); 311 312 … … 344 345 345 346 @Test 346 publicvoid testUserNameChanged() {347 void testUserNameChanged() { 347 348 UserIdentityManager im = UserIdentityManager.getInstance(); 348 349 -
trunk/test/unit/org/openstreetmap/josm/data/VersionTest.java
r16019 r17275 2 2 package org.openstreetmap.josm.data; 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; 8 8 import java.nio.charset.StandardCharsets; 9 9 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 … … 15 15 * Unit tests for class {@link Version}. 16 16 */ 17 publicclass VersionTest {17 class VersionTest { 18 18 19 19 /** 20 20 * Setup test. 21 21 */ 22 @Before Class22 @BeforeAll 23 23 public static void setUpBeforeClass() { 24 24 JOSMFixture.createUnitTestFixture().init(); … … 29 29 */ 30 30 @Test 31 publicvoid testGetAgentString() {31 void testGetAgentString() { 32 32 Version version = new Version(); 33 33 version.initFromRevisionInfo(null); 34 34 String v = version.getAgentString(false); 35 assertTrue(v , v.matches("JOSM/1\\.5 \\(UNKNOWN en\\)"));35 assertTrue(v.matches("JOSM/1\\.5 \\(UNKNOWN en\\)"), v); 36 36 v = version.getAgentString(true); 37 assertTrue(v , v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"));37 assertTrue(v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"), v); 38 38 } 39 39 … … 42 42 */ 43 43 @Test 44 publicvoid testInitFromRevisionInfoNull() {44 void testInitFromRevisionInfoNull() { 45 45 Version v = new Version(); 46 46 v.initFromRevisionInfo(null); … … 52 52 */ 53 53 @Test 54 publicvoid testInitFromRevisionInfoLocal() {54 void testInitFromRevisionInfoLocal() { 55 55 Version v = new Version(); 56 56 v.initFromRevisionInfo(new ByteArrayInputStream(("\n" + -
trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.cache; 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.IOException; … … 12 12 13 13 import org.apache.commons.jcs3.access.behavior.ICacheAccess; 14 import org.junit. Rule;15 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader; 17 17 import org.openstreetmap.josm.data.imagery.TileJobOptions; … … 25 25 * @author Wiktor Niesiobedzki 26 26 */ 27 publicclass HostLimitQueueTest {27 class HostLimitQueueTest { 28 28 /** 29 29 * Setup test. 30 30 */ 31 @R ule31 @RegisterExtension 32 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 33 public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20 * 1000); … … 79 79 */ 80 80 @Test 81 publicvoid testSingleThreadPerHost() throws Exception {81 void testSingleThreadPerHost() throws Exception { 82 82 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1); 83 83 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 96 96 // so it should take ~8 seconds to finish 97 97 // if it's shorter, it means that host limit does not work 98 assertTrue( "Expected duration between 8 and 11 seconds not met. Actual duration: " + (duration /1000),99 duration < 11*1000 & duration > 8*1000);98 assertTrue(duration < 11*1000 & duration > 8*1000, 99 "Expected duration between 8 and 11 seconds not met. Actual duration: " + (duration /1000)); 100 100 } 101 101 … … 105 105 */ 106 106 @Test 107 publicvoid testMultipleThreadPerHost() throws Exception {107 void testMultipleThreadPerHost() throws Exception { 108 108 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 2); 109 109 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 121 121 // so it should take ~5 seconds to finish 122 122 // if it's shorter, it means that host limit does not work 123 assertTrue( "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000),124 duration < 6*1000 & duration > 4*1000);123 assertTrue(duration < 6*1000 & duration > 4*1000, 124 "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000)); 125 125 } 126 126 … … 130 130 */ 131 131 @Test 132 publicvoid testTwoHosts() throws Exception {132 void testTwoHosts() throws Exception { 133 133 ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1); 134 134 ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, ""); … … 147 147 // so it should take ~5 seconds to finish 148 148 // if it's shorter, it means that host limit does not work 149 assertTrue( "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000),150 duration < 6*1000 & duration > 4*1000);149 assertTrue(duration < 6*1000 & duration > 4*1000, 150 "Expected duration between 4 and 6 seconds not met. Actual duration: " + (duration /1000)); 151 151 } 152 152 } -
trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCacheManagerTest.java
r16398 r17275 2 2 package org.openstreetmap.josm.data.cache; 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; … … 11 11 import org.apache.commons.jcs3.access.CacheAccess; 12 12 import org.apache.commons.jcs3.auxiliary.disk.block.BlockDiskCacheAttributes; 13 import org.junit. Rule;14 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; 16 16 … … 21 21 * Unit tests for class {@link JCSCacheManager}. 22 22 */ 23 publicclass JCSCacheManagerTest {23 class JCSCacheManagerTest { 24 24 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().preferences().timeout(20000); … … 35 35 */ 36 36 @Test 37 publicvoid testUtilityClass() throws ReflectiveOperationException {37 void testUtilityClass() throws ReflectiveOperationException { 38 38 UtilityClassTestUtil.assertUtilityClassWellDefined(JCSCacheManager.class); 39 39 } … … 44 44 */ 45 45 @Test 46 publicvoid testLoggingAdaptor12054() throws IOException {46 void testLoggingAdaptor12054() throws IOException { 47 47 JCSCacheManager.getCache("foobar", 1, 0, "foobar"); // cause logging adaptor to be initialized 48 48 Logger.getLogger("org.apache.commons.jcs3").warning("{switch:0}"); … … 50 50 51 51 @Test 52 publicvoid testUseBigDiskFile() throws IOException {52 void testUseBigDiskFile() throws IOException { 53 53 if (JCSCacheManager.USE_BLOCK_CACHE.get()) { 54 54 // test only when using block cache … … 65 65 66 66 CacheAccess<Object, Object> cache = JCSCacheManager.getCache("testUseBigDiskFile", 1, 100, "foobar"); 67 assertEquals("BlockDiskCache use file size to calculate its size", 10*1024, 68 ((BlockDiskCacheAttributes) cache.getCacheControl().getAuxCaches()[0].getAuxiliaryCacheAttributes()).getMaxKeySize()); 67 assertEquals(10*1024, 68 ((BlockDiskCacheAttributes) cache.getCacheControl().getAuxCaches()[0].getAuxiliaryCacheAttributes()).getMaxKeySize(), 69 "BlockDiskCache use file size to calculate its size"); 69 70 } 70 71 } -
trunk/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java
r13079 r17275 4 4 import java.text.DecimalFormat; 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; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests for class {@link CachedLatLon}. 17 17 */ 18 publicclass CachedLatLonTest {18 class CachedLatLonTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 29 29 */ 30 30 @Test 31 publicvoid testEqualsContract() {31 void testEqualsContract() { 32 32 TestUtils.assumeWorkingEqualsVerifier(); 33 33 EqualsVerifier.forClass(CachedLatLon.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/coor/EastNorthTest.java
r10915 r17275 2 2 package org.openstreetmap.josm.data.coor; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 8 8 /** … … 11 11 * @since 10915 12 12 */ 13 publicclass EastNorthTest {13 class EastNorthTest { 14 14 15 15 /** … … 17 17 */ 18 18 @Test 19 publicvoid testInterpolate() {19 void testInterpolate() { 20 20 EastNorth en1 = new EastNorth(0, 0); 21 21 EastNorth en2 = new EastNorth(30, 60); … … 37 37 */ 38 38 @Test 39 publicvoid testGetCenter() {39 void testGetCenter() { 40 40 EastNorth en1 = new EastNorth(0, 0); 41 41 EastNorth en2 = new EastNorth(30, 60); -
trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java
r15451 r17275 2 2 package org.openstreetmap.josm.data.coor; 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.text.DecimalFormat; … … 10 10 import java.util.List; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.TestUtils; 15 15 import org.openstreetmap.josm.data.Bounds; … … 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules().projection(); … … 52 52 */ 53 53 @Test 54 publicvoid testRoundToOsmPrecision() {54 void testRoundToOsmPrecision() { 55 55 56 56 for (double value : SAMPLE_VALUES) { … … 110 110 */ 111 111 @Test 112 publicvoid testToIntervalLat() {112 void testToIntervalLat() { 113 113 assertEquals(-90.0, LatLon.toIntervalLat(-90.0), 0); 114 114 assertEquals(0.0, LatLon.toIntervalLat(0.0), 0); … … 123 123 */ 124 124 @Test 125 publicvoid testToIntervalLon() {125 void testToIntervalLon() { 126 126 assertEquals(-180.0, LatLon.toIntervalLon(-180.0), 0); 127 127 assertEquals(0.0, LatLon.toIntervalLon(0.0), 0); … … 148 148 */ 149 149 @Test 150 publicvoid testEqualsContract() {150 void testEqualsContract() { 151 151 TestUtils.assumeWorkingEqualsVerifier(); 152 152 EqualsVerifier.forClass(LatLon.class).usingGetClass() … … 159 159 */ 160 160 @Test 161 publicvoid testCopyConstructor() {161 void testCopyConstructor() { 162 162 assertEquals(LatLon.NORTH_POLE, new LatLon(LatLon.NORTH_POLE)); 163 163 assertEquals(LatLon.SOUTH_POLE, new LatLon(LatLon.SOUTH_POLE)); … … 169 169 */ 170 170 @Test 171 publicvoid testBearing() {171 void testBearing() { 172 172 LatLon c = new LatLon(47.000000, 19.000000); 173 173 LatLon e = new LatLon(47.000000, 19.000001); … … 183 183 */ 184 184 @Test 185 publicvoid testDistance() {185 void testDistance() { 186 186 assertEquals(0.0, LatLon.ZERO.distance(LatLon.ZERO), 0); 187 187 assertEquals(90.0, LatLon.ZERO.distance(LatLon.NORTH_POLE), 0); … … 193 193 */ 194 194 @Test 195 publicvoid testDistanceSq() {195 void testDistanceSq() { 196 196 assertEquals(0.0, LatLon.ZERO.distanceSq(LatLon.ZERO), 0); 197 197 assertEquals(90d*90d, LatLon.ZERO.distanceSq(LatLon.NORTH_POLE), 0); … … 203 203 */ 204 204 @Test 205 publicvoid testInterpolate() {205 void testInterpolate() { 206 206 LatLon ll1 = new LatLon(0, 0); 207 207 LatLon ll2 = new LatLon(30, 60); … … 225 225 @Test 226 226 @Deprecated 227 publicvoid testIsOutSideWorld() {227 void testIsOutSideWorld() { 228 228 assertFalse(LatLon.ZERO.isOutSideWorld()); 229 229 assertTrue(LatLon.NORTH_POLE.isOutSideWorld()); … … 237 237 */ 238 238 @Test 239 publicvoid testIsValid() {239 void testIsValid() { 240 240 assertTrue(LatLon.ZERO.isValid()); 241 241 assertTrue(LatLon.NORTH_POLE.isValid()); … … 252 252 */ 253 253 @Test 254 publicvoid testIsWithin() {254 void testIsWithin() { 255 255 assertTrue(LatLon.ZERO.isWithin(new Bounds(LatLon.ZERO))); 256 256 assertFalse(LatLon.ZERO.isWithin(new Bounds(LatLon.NORTH_POLE))); … … 261 261 */ 262 262 @Test 263 publicvoid testGetCenter() {263 void testGetCenter() { 264 264 LatLon ll1 = new LatLon(0, 0); 265 265 LatLon ll2 = new LatLon(30, 60); -
trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java
r13107 r17275 2 2 package org.openstreetmap.josm.data.coor; 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.text.DecimalFormat; 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.TestUtils; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * Test the {@link PolarCoor} class. 19 19 */ 20 publicclass PolarCoorTest {20 class PolarCoorTest { 21 21 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().projection(); … … 31 31 */ 32 32 @Test 33 publicvoid testPolarCoor() {33 void testPolarCoor() { 34 34 EastNorth en = new EastNorth(1000, 500); 35 35 PolarCoor pc = new PolarCoor(en); … … 50 50 */ 51 51 @Test 52 publicvoid testEqualsContract() {52 void testEqualsContract() { 53 53 TestUtils.assumeWorkingEqualsVerifier(); 54 54 EqualsVerifier.forClass(PolarCoor.class).usingGetClass() … … 61 61 */ 62 62 @Test 63 publicvoid testToString() {63 void testToString() { 64 64 assertEquals("PolarCoor [radius=1118.033988749, angle=0.463647609, pole=EastNorth[e=0.0, n=0.0]]", 65 65 new PolarCoor(1118.033988749, 0.463647609).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java
r16438 r17275 2 2 package org.openstreetmap.josm.data.coor.conversion; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 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.coor.ILatLon; 11 11 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Test for {@link ICoordinateFormat} implementations. 16 16 */ 17 publicclass ICoordinateFormatTest {17 class ICoordinateFormatTest { 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().projection(); … … 30 30 */ 31 31 @Test 32 publicvoid testFormatting() {32 void testFormatting() { 33 33 LatLon c = new LatLon(47.000000, 19.000000); 34 34 assertEquals("47.0", DecimalDegreesCoordinateFormat.INSTANCE.latToString(c)); -
trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java
r12795 r17275 2 2 package org.openstreetmap.josm.data.coor.conversion; 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; 6 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 import org.openstreetmap.josm.data.coor.LatLon; 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 5 11 6 12 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 7 8 import org.junit.Rule;9 import org.junit.Test;10 import org.openstreetmap.josm.data.coor.LatLon;11 import org.openstreetmap.josm.testutils.JOSMTestRules;12 13 13 14 /** 14 15 * Unit tests for class {@link LatLonParser}. 15 16 */ 16 publicclass LatLonParserTest {17 class LatLonParserTest { 17 18 18 19 /** 19 20 * Setup test. 20 21 */ 21 @R ule22 @RegisterExtension 22 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 24 public JOSMTestRules test = new JOSMTestRules().projection(); … … 27 28 */ 28 29 @Test 29 publicvoid testParse() {30 void testParse() { 30 31 assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("49.29918° 19.24788°")); 31 32 assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("N 49.29918 E 19.24788°")); … … 54 55 * Unit test of {@link LatLonParser#parse} method - invalid case 1. 55 56 */ 56 @Test (expected = IllegalArgumentException.class)57 publicvoid testParseInvalid1() {58 LatLonParser.parse("48°45'S 23°30'S");57 @Test 58 void testParseInvalid1() { 59 assertThrows(IllegalArgumentException.class, () -> LatLonParser.parse("48°45'S 23°30'S")); 59 60 } 60 61 … … 62 63 * Unit test of {@link LatLonParser#parse} method - invalid case 2. 63 64 */ 64 @Test (expected = IllegalArgumentException.class)65 publicvoid testParseInvalid2() {66 LatLonParser.parse("47°45'N 24°00'S");65 @Test 66 void testParseInvalid2() { 67 assertThrows(IllegalArgumentException.class, () -> LatLonParser.parse("47°45'N 24°00'S")); 67 68 } 68 69 -
trunk/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.correction; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 13 13 * Unit tests for class {@link TagCorrection}. 14 14 */ 15 publicclass TagCorrectionTest {15 class TagCorrectionTest { 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 testEqualsContract() {28 void testEqualsContract() { 29 29 TestUtils.assumeWorkingEqualsVerifier(); 30 30 EqualsVerifier.forClass(TagCorrection.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java
r15502 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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.assertNull; 8 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.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 9 10 10 11 import java.io.IOException; … … 18 19 import java.util.stream.Stream; 19 20 20 import org.junit. Before;21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.BeforeEach; 22 import org.junit.jupiter.api.Test; 23 import org.junit.jupiter.api.extension.RegisterExtension; 23 24 import org.openstreetmap.josm.TestUtils; 24 25 import org.openstreetmap.josm.data.Bounds; … … 41 42 * Unit tests for class {@link GpxData}. 42 43 */ 43 publicclass GpxDataTest {44 class GpxDataTest { 44 45 45 46 /** 46 47 * Setup test. 47 48 */ 48 @R ule49 @RegisterExtension 49 50 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 50 51 public JOSMTestRules test = new JOSMTestRules().projection(); … … 55 56 * Set up empty test data 56 57 */ 57 @Before 58 @BeforeEach 58 59 public void setUp() { 59 60 data = new GpxData(); … … 64 65 */ 65 66 @Test 66 publicvoid testMergeFrom() {67 void testMergeFrom() { 67 68 GpxTrack track = singleWaypointGpxTrack(); 68 69 GpxRoute route = singleWaypointRoute(); … … 93 94 */ 94 95 @Test 95 publicvoid testMergeFromFiles() throws Exception {96 void testMergeFromFiles() throws Exception { 96 97 testMerge(false, false, "Merged-all"); // regular merging 97 98 testMerge(true, false, "Merged-cut"); // cut overlapping tracks, but do not connect them … … 106 107 own.put(GpxConstants.META_BOUNDS, null); 107 108 expected.put(GpxConstants.META_BOUNDS, null); //they are only updated by GpxWriter 108 assertEquals(exp + " didn't match!", expected, own);109 assertEquals(expected, own, exp + " didn't match!"); 109 110 } 110 111 … … 117 118 */ 118 119 @Test 119 publicvoid testTracks() {120 void testTracks() { 120 121 assertEquals(0, data.getTracks().size()); 121 122 … … 138 139 * Test method for {@link GpxData#addTrack(IGpxTrack)}. 139 140 */ 140 @Test (expected = IllegalArgumentException.class)141 publicvoid testAddTrackFails() {141 @Test 142 void testAddTrackFails() { 142 143 GpxTrack track1 = emptyGpxTrack(); 143 144 data.addTrack(track1); 144 data.addTrack(track1);145 assertThrows(IllegalArgumentException.class, () -> data.addTrack(track1)); 145 146 } 146 147 … … 148 149 * Test method for {@link GpxData#removeTrack(IGpxTrack)}. 149 150 */ 150 @Test (expected = IllegalArgumentException.class)151 publicvoid testRemoveTrackFails() {151 @Test 152 void testRemoveTrackFails() { 152 153 GpxTrack track1 = emptyGpxTrack(); 153 154 data.addTrack(track1); 154 155 data.removeTrack(track1); 155 data.removeTrack(track1);156 assertThrows(IllegalArgumentException.class, () -> data.removeTrack(track1)); 156 157 } 157 158 … … 160 161 */ 161 162 @Test 162 publicvoid testRoutes() {163 void testRoutes() { 163 164 assertEquals(0, data.getTracks().size()); 164 165 … … 182 183 * Test method for {@link GpxData#addRoute(GpxRoute)}. 183 184 */ 184 @Test (expected = IllegalArgumentException.class)185 publicvoid testAddRouteFails() {185 @Test 186 void testAddRouteFails() { 186 187 GpxRoute route1 = new GpxRoute(); 187 188 data.addRoute(route1); 188 data.addRoute(route1);189 assertThrows(IllegalArgumentException.class, () -> data.addRoute(route1)); 189 190 } 190 191 … … 192 193 * Test method for {@link GpxData#removeRoute(GpxRoute)}. 193 194 */ 194 @Test (expected = IllegalArgumentException.class)195 publicvoid testRemoveRouteFails() {195 @Test 196 void testRemoveRouteFails() { 196 197 GpxRoute route1 = new GpxRoute(); 197 198 data.addRoute(route1); 198 199 data.removeRoute(route1); 199 data.removeRoute(route1);200 assertThrows(IllegalArgumentException.class, () -> data.removeRoute(route1)); 200 201 } 201 202 … … 204 205 */ 205 206 @Test 206 publicvoid testWaypoints() {207 void testWaypoints() { 207 208 assertEquals(0, data.getTracks().size()); 208 209 … … 225 226 * Test method for {@link GpxData#addWaypoint(WayPoint)}. 226 227 */ 227 @Test (expected = IllegalArgumentException.class)228 publicvoid testAddWaypointFails() {228 @Test 229 void testAddWaypointFails() { 229 230 WayPoint waypoint1 = new WayPoint(LatLon.ZERO); 230 231 data.addWaypoint(waypoint1); 231 data.addWaypoint(waypoint1);232 assertThrows(IllegalArgumentException.class, () -> data.addWaypoint(waypoint1)); 232 233 } 233 234 … … 235 236 * Test method for {@link GpxData#removeWaypoint(WayPoint)}. 236 237 */ 237 @Test (expected = IllegalArgumentException.class)238 publicvoid testRemoveWaypointFails() {238 @Test 239 void testRemoveWaypointFails() { 239 240 WayPoint waypoint1 = new WayPoint(LatLon.ZERO); 240 241 data.addWaypoint(waypoint1); 241 242 data.removeWaypoint(waypoint1); 242 data.removeWaypoint(waypoint1);243 assertThrows(IllegalArgumentException.class, () -> data.removeWaypoint(waypoint1)); 243 244 } 244 245 … … 247 248 */ 248 249 @Test 249 publicvoid testHasTrackPoints() {250 void testHasTrackPoints() { 250 251 assertFalse(data.hasTrackPoints()); 251 252 GpxTrack track1 = emptyGpxTrack(); … … 261 262 */ 262 263 @Test 263 publicvoid testGetTrackPoints() {264 void testGetTrackPoints() { 264 265 assertEquals(0, data.getTrackPoints().count()); 265 266 GpxTrack track1 = singleWaypointGpxTrack(); … … 275 276 */ 276 277 @Test 277 publicvoid testHasRoutePoints() {278 void testHasRoutePoints() { 278 279 279 280 } … … 283 284 */ 284 285 @Test 285 publicvoid testIsEmpty() {286 void testIsEmpty() { 286 287 GpxTrack track1 = singleWaypointGpxTrack(); 287 288 WayPoint waypoint = new WayPoint(LatLon.ZERO); … … 310 311 */ 311 312 @Test 312 publicvoid testLength() {313 void testLength() { 313 314 GpxTrack track1 = waypointGpxTrack( 314 315 new WayPoint(new LatLon(0, 0)), … … 328 329 */ 329 330 @Test 330 publicvoid testGetMinMaxTimeForAllTracks() {331 void testGetMinMaxTimeForAllTracks() { 331 332 assertEquals(0, data.getMinMaxTimeForAllTracks().length); 332 333 … … 352 353 */ 353 354 @Test 354 publicvoid testNearestPointOnTrack() {355 void testNearestPointOnTrack() { 355 356 List<WayPoint> points = Stream 356 357 .of(new EastNorth(10, 10), new EastNorth(10, 0), new EastNorth(-1, 0)) … … 378 379 */ 379 380 @Test 380 publicvoid testGetDataSources() {381 void testGetDataSources() { 381 382 DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test"); 382 383 data.dataSources.add(ds); … … 388 389 */ 389 390 @Test 390 publicvoid testGetDataSourceArea() {391 void testGetDataSourceArea() { 391 392 DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test"); 392 393 data.dataSources.add(ds); … … 400 401 */ 401 402 @Test 402 publicvoid testGetDataSourceBounds() {403 void testGetDataSourceBounds() { 403 404 Bounds bounds = new Bounds(0, 0, 1, 1); 404 405 DataSource ds = new DataSource(bounds, "test"); … … 413 414 */ 414 415 @Test 415 publicvoid testChangeListener() {416 void testChangeListener() { 416 417 TestChangeListener cl1 = new TestChangeListener(); 417 418 TestChangeListener cl2 = new TestChangeListener(); … … 474 475 */ 475 476 @Test 476 publicvoid testEqualsContract() {477 void testEqualsContract() { 477 478 TestUtils.assumeWorkingEqualsVerifier(); 478 479 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java
r15629 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.gui.layer.gpx.ConvertToDataLayerActionTest; … … 17 17 * Unit tests for class {@link GpxExtension} 18 18 */ 19 publicclass GpxExtensionTest {19 class GpxExtensionTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 33 33 */ 34 34 @Test 35 publicvoid testEqualsContract() {35 void testEqualsContract() { 36 36 TestUtils.assumeWorkingEqualsVerifier(); 37 37 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java
r15431 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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 9 9 import java.util.Arrays; 10 10 import java.util.List; 11 11 12 import org.junit. BeforeClass;13 import org.junit. Rule;14 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 15 15 import org.openstreetmap.josm.TestUtils; 16 16 import org.openstreetmap.josm.data.coor.CachedLatLon; … … 28 28 * Unit tests of {@link GpxImageCorrelation} class. 29 29 */ 30 publicclass GpxImageCorrelationTest {30 class GpxImageCorrelationTest { 31 31 32 32 /** 33 33 * Setup test. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 * Setup test. 41 41 */ 42 @Before Class42 @BeforeAll 43 43 public static void setUp() { 44 44 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 50 50 */ 51 51 @Test 52 publicvoid testMatchGpxTrack() throws Exception {52 void testMatchGpxTrack() throws Exception { 53 53 IPreferences s = Config.getPref(); 54 54 final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx"); … … 274 274 */ 275 275 @Test 276 publicvoid testGetElevation() {276 void testGetElevation() { 277 277 assertNull(GpxImageCorrelation.getElevation(null)); 278 278 WayPoint wp = new WayPoint(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java
r14209 r17275 4 4 import java.io.File; 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; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 16 16 * Unit tests of {@link GpxImageEntry} class. 17 17 */ 18 publicclass GpxImageEntryTest {18 class GpxImageEntryTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 29 29 */ 30 30 @Test 31 publicvoid testEqualsContract() {31 void testEqualsContract() { 32 32 TestUtils.assumeWorkingEqualsVerifier(); 33 33 EqualsVerifier.forClass(GpxImageEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java
r14205 r17275 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.text.ParseException; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 12 import org.openstreetmap.josm.tools.date.DateUtils; … … 18 18 * Unit tests of {@link GpxTimeOffset} class. 19 19 */ 20 publicclass GpxOffsetTest {20 class GpxOffsetTest { 21 21 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(); … … 30 30 * Setup test. 31 31 */ 32 @Before Class32 @BeforeAll 33 33 public static void setUp() { 34 34 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 39 39 */ 40 40 @Test 41 publicvoid testFormatOffset() {41 void testFormatOffset() { 42 42 assertEquals("0", GpxTimeOffset.seconds(0).formatOffset()); 43 43 assertEquals("123", GpxTimeOffset.seconds(123).formatOffset()); … … 55 55 */ 56 56 @Test 57 publicvoid testParseOffest() throws ParseException {57 void testParseOffest() throws ParseException { 58 58 assertEquals(0, GpxTimeOffset.parseOffset("0").getSeconds()); 59 59 assertEquals(4242L, GpxTimeOffset.parseOffset("4242").getSeconds()); … … 69 69 */ 70 70 @Test 71 publicvoid testSplitOutTimezone() {71 void testSplitOutTimezone() { 72 72 assertEquals("+1:00", GpxTimeOffset.seconds(3602).splitOutTimezone().a.formatTimezone()); 73 73 assertEquals("2", GpxTimeOffset.seconds(3602).splitOutTimezone().b.formatOffset()); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Unit tests for class {@link GpxRoute}. 16 16 */ 17 publicclass GpxRouteTest {17 class GpxRouteTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testEqualsContract() {30 void testEqualsContract() { 31 31 TestUtils.assumeWorkingEqualsVerifier(); 32 32 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java
r14205 r17275 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 6 import java.text.ParseException; 7 7 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeAll; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; 12 12 import org.openstreetmap.josm.tools.date.DateUtils; … … 18 18 * Unit tests of {@link GpxTimezone} class. 19 19 */ 20 publicclass GpxTimezoneTest {20 class GpxTimezoneTest { 21 21 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(); … … 30 30 * Setup test. 31 31 */ 32 @Before Class32 @BeforeAll 33 33 public static void setUp() { 34 34 DateUtilsTest.setTimeZone(DateUtils.UTC); … … 39 39 */ 40 40 @Test 41 publicvoid testFormatTimezone() {41 void testFormatTimezone() { 42 42 assertEquals("+1:00", new GpxTimezone(1).formatTimezone()); 43 43 assertEquals("+6:30", new GpxTimezone(6.5).formatTimezone()); … … 52 52 */ 53 53 @Test 54 publicvoid testParseTimezone() throws ParseException {54 void testParseTimezone() throws ParseException { 55 55 assertEquals(1, GpxTimezone.parseTimezone("+01:00").getHours(), 1e-3); 56 56 assertEquals(1, GpxTimezone.parseTimezone("+1:00").getHours(), 1e-3); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.data.coor.LatLon; … … 15 15 * Unit tests for class {@link GpxTrackSegment}. 16 16 */ 17 publicclass GpxTrackSegmentTest {17 class GpxTrackSegmentTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testEqualsContract() {30 void testEqualsContract() { 31 31 TestUtils.assumeWorkingEqualsVerifier(); 32 32 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java
r15560 r17275 2 2 package org.openstreetmap.josm.data.gpx; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 6 7 7 import java.awt.Color; … … 9 9 import java.util.HashMap; 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.TestUtils; 14 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 22 22 * Unit tests for class {@link GpxTrack}. 23 23 */ 24 publicclass GpxTrackTest {24 class GpxTrackTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules(); … … 35 35 */ 36 36 @Test 37 publicvoid testColors() {37 void testColors() { 38 38 GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>()); 39 39 GpxExtensionCollection ext = trk.getExtensions(); … … 61 61 */ 62 62 @Test 63 publicvoid testEqualsContract() {63 void testEqualsContract() { 64 64 TestUtils.assumeWorkingEqualsVerifier(); 65 65 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link WayPoint}. 15 15 */ 16 publicclass WayPointTest {16 class WayPointTest { 17 17 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java
r15496 r17275 2 2 package org.openstreetmap.josm.data.gpx; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link WithAttributes}. 15 15 */ 16 publicclass WithAttributesTest {16 class WithAttributesTest { 17 17 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 GpxExtensionCollection col = new GpxExtensionCollection(); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.imagery; 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 … … 14 14 * Unit tests for class {@link GetCapabilitiesParseHelper}. 15 15 */ 16 publicclass GetCapabilitiesParseHelperTest {16 class GetCapabilitiesParseHelperTest { 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testUtilityClass() throws ReflectiveOperationException {30 void testUtilityClass() throws ReflectiveOperationException { 31 31 UtilityClassTestUtil.assertUtilityClassWellDefined(GetCapabilitiesParseHelper.class); 32 32 } … … 36 36 */ 37 37 @Test 38 publicvoid testCrsToCode() {38 void testCrsToCode() { 39 39 assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg:3127")); 40 40 assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg::3127")); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java
r12851 r17275 2 2 package org.openstreetmap.josm.data.imagery; 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; … … 10 10 import java.util.Set; 11 11 12 import org.junit. Rule;13 import org.junit. Test;12 import org.junit.jupiter.api.Test; 13 import org.junit.jupiter.api.extension.RegisterExtension; 14 14 import org.openstreetmap.josm.data.StructUtils; 15 15 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 23 23 * 24 24 */ 25 publicclass ImageryInfoTest {25 class ImageryInfoTest { 26 26 27 27 /** 28 28 * Setup tests 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetExtendedUrl() {38 void testGetExtendedUrl() { 39 39 ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 40 40 testImageryTMS.setDefaultMinZoom(16); … … 47 47 */ 48 48 @Test 49 publicvoid testConstruct13264() {49 void testConstruct13264() { 50 50 final ImageryInfo info = new ImageryInfo("test imagery", "tms[16-23]:http://localhost"); 51 51 assertEquals(ImageryInfo.ImageryType.TMS, info.getImageryType()); … … 56 56 57 57 /** 58 * Tests the {@linkplain StructUtils#serializeStruct (Object, Class)serialization} of {@link ImageryInfo.ImageryPreferenceEntry}58 * Tests the {@linkplain StructUtils#serializeStruct serialization} of {@link ImageryInfo.ImageryPreferenceEntry} 59 59 */ 60 60 @Test 61 publicvoid testSerializeStruct() {61 void testSerializeStruct() { 62 62 final ImageryInfo.ImageryPreferenceEntry info = new ImageryInfo.ImageryPreferenceEntry(); 63 63 info.noTileHeaders = new MultiMap<>(); … … 72 72 */ 73 73 @Test 74 publicvoid testDeserializeStruct() {74 void testDeserializeStruct() { 75 75 final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct( 76 76 Collections.singletonMap("noTileHeaders", "{\"ETag\":[\"foo\",\"bar\"]}"), ImageryInfo.ImageryPreferenceEntry.class); … … 87 87 */ 88 88 @Test 89 publicvoid testDeserializeStructTicket12474() {89 void testDeserializeStructTicket12474() { 90 90 final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct( 91 91 Collections.singletonMap("noTileHeaders", "{\"ETag\":\"foo-and-bar\"}"), ImageryInfo.ImageryPreferenceEntry.class); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.data.imagery; 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 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 10 10 /** 11 11 * Unit tests for class {@link Shape}. 12 12 */ 13 publicclass ShapeTest {13 class ShapeTest { 14 14 15 15 /** … … 17 17 */ 18 18 @Test 19 publicvoid test() {19 void test() { 20 20 Shape shape = new Shape(); 21 21 shape.addPoint("47.1", "11.1"); -
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r17094 r17275 2 2 package org.openstreetmap.josm.data.imagery; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 7 import org.junit. Rule;8 import org.junit. Test;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 7 import org.junit.jupiter.api.Test; 8 import org.junit.jupiter.api.extension.RegisterExtension; 9 9 import org.openstreetmap.gui.jmapviewer.TileXY; 10 10 import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate; … … 24 24 * Unit tests for class {@link TemplatedWMSTileSource}. 25 25 */ 26 publicclass TemplatedWMSTileSourceTest {26 class TemplatedWMSTileSourceTest { 27 27 28 28 private final ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null); … … 32 32 * Setup test. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 */ 41 41 @Test 42 publicvoid testEPSG3857() {42 void testEPSG3857() { 43 43 Projection projection = Projections.getProjectionByCode("EPSG:3857"); 44 44 ProjectionRegistry.setProjection(projection); … … 65 65 */ 66 66 @Test 67 publicvoid testEPSG4326() {67 void testEPSG4326() { 68 68 Projection projection = Projections.getProjectionByCode("EPSG:4326"); 69 69 ProjectionRegistry.setProjection(projection); … … 81 81 */ 82 82 @Test 83 publicvoid testEPSG4326widebounds() {83 void testEPSG4326widebounds() { 84 84 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54"); 85 85 ProjectionRegistry.setProjection(projection); … … 94 94 */ 95 95 @Test 96 publicvoid testEPSG4326narrowbounds() {96 void testEPSG4326narrowbounds() { 97 97 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90"); 98 98 ProjectionRegistry.setProjection(projection); … … 107 107 */ 108 108 @Test 109 publicvoid testEPSG2180() {109 void testEPSG2180() { 110 110 Projection projection = Projections.getProjectionByCode("EPSG:2180"); 111 111 ProjectionRegistry.setProjection(projection); … … 124 124 */ 125 125 @Test 126 publicvoid testEPSG3006withbounds() {126 void testEPSG3006withbounds() { 127 127 Projection projection = 128 128 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " … … 140 140 */ 141 141 @Test 142 publicvoid testEPSG3006withoutbounds() {142 void testEPSG3006withoutbounds() { 143 143 Projection projection = 144 144 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " … … 156 156 */ 157 157 @Test 158 publicvoid testGetTileUrl() {158 void testGetTileUrl() { 159 159 // "https://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery_Dates/MapServer/WMSServer? 160 160 // SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height} … … 206 206 ICoordinate expected = verifier.tileXYToLatLon(x, y, z - 1); 207 207 assertEquals(expected.getLat(), result.lat(), 1e-4); 208 assertEquals( LatLon.normalizeLon(expected.getLon() - result.lon()), 0.0, 1e-4);208 assertEquals(0.0, LatLon.normalizeLon(expected.getLon() - result.lon()), 1e-4); 209 209 LatLon tileCenter = new Bounds(result, getTileLatLon(source, x+1, y+1, z)).getCenter(); 210 210 TileXY backwardsResult = source.latLonToTileXY(CoordinateConversion.llToCoor(tileCenter), z); … … 224 224 private void verifyLocation(TemplatedWMSTileSource source, LatLon location, int z) { 225 225 Projection projection = ProjectionRegistry.getProjection(); 226 assertTrue( 227 "Point outside world bounds", 228 projection.getWorldBoundsLatLon().contains(location) 229 ); 226 assertTrue(projection.getWorldBoundsLatLon().contains(location), "Point outside world bounds"); 230 227 231 228 TileXY tileIndex = source.latLonToTileXY(CoordinateConversion.llToCoor(location), z); 232 229 233 assertTrue( "X index: " + tileIndex.getXIndex() + " greater than tileXmax: " + source.getTileXMax(z) + " at zoom: " + z,234 tileIndex.getXIndex() <= source.getTileXMax(z));235 236 assertTrue( "Y index: " + tileIndex.getYIndex() + " greater than tileYmax: " + source.getTileYMax(z) + " at zoom: " + z,237 tileIndex.getYIndex() <= source.getTileYMax(z));230 assertTrue(tileIndex.getXIndex() <= source.getTileXMax(z), 231 "X index: " + tileIndex.getXIndex() + " greater than tileXmax: " + source.getTileXMax(z) + " at zoom: " + z); 232 233 assertTrue(tileIndex.getYIndex() <= source.getTileYMax(z), 234 "Y index: " + tileIndex.getYIndex() + " greater than tileYmax: " + source.getTileYMax(z) + " at zoom: " + z); 238 235 239 236 ICoordinate x1 = source.tileXYToLatLon(tileIndex.getXIndex(), tileIndex.getYIndex(), z); … … 245 242 bounds.extend(x2.getLat(), x2.getLon()); 246 243 // test that location is within tile bounds 247 assertTrue( location + " not within " + bounds + " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex(),248 bounds.contains(location));244 assertTrue(bounds.contains(location), 245 location + " not within " + bounds + " for tile " + z + "/" + tileIndex.getXIndex() + "/" + tileIndex.getYIndex()); 249 246 verifyTileSquareness(source, tileIndex.getXIndex(), tileIndex.getYIndex(), z); 250 247 } -
trunk/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.data.notes; 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.util.Date; 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.JOSMTestRules; 13 13 … … 17 17 * Unit tests for class {@link NoteComment}. 18 18 */ 19 publicclass NoteCommentTest {19 class NoteCommentTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 */ 31 31 @Test 32 publicvoid testNoteComment() {32 void testNoteComment() { 33 33 NoteComment comment = new NoteComment(new Date(), null, "foo", null, true); 34 34 assertEquals("foo", comment.toString()); -
trunk/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.notes; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 6 7 7 import java.util.Date; 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.TestUtils; 12 12 import org.openstreetmap.josm.data.coor.LatLon; … … 20 20 * Unit tests for class {@link NoteComment}. 21 21 */ 22 publicclass NoteTest {22 class NoteTest { 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(); … … 33 33 */ 34 34 @Test 35 publicvoid testToString() {35 void testToString() { 36 36 Note note = new Note(LatLon.ZERO); 37 37 assertEquals("Note 0: null", note.toString()); … … 44 44 */ 45 45 @Test 46 publicvoid testUpdateWith() {46 void testUpdateWith() { 47 47 Note n1 = new Note(LatLon.ZERO); 48 48 n1.setId(1); … … 58 58 */ 59 59 @Test 60 publicvoid testEqualsContract() {60 void testEqualsContract() { 61 61 TestUtils.assumeWorkingEqualsVerifier(); 62 62 EqualsVerifier.forClass(Note.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java
r14119 r17275 2 2 package org.openstreetmap.josm.data.oauth; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotEquals;6 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertNotNull; 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; 11 11 import org.openstreetmap.josm.spi.preferences.Config; … … 19 19 * Unit tests for class {@link OAuthParameters}. 20 20 */ 21 publicclass OAuthParametersTest {21 class OAuthParametersTest { 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(); … … 33 33 @Test 34 34 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD") 35 publicvoid testCreateDefault() {35 void testCreateDefault() { 36 36 OAuthParameters def = OAuthParameters.createDefault(); 37 37 assertNotNull(def); … … 50 50 */ 51 51 @Test 52 publicvoid testEqualsContract() {52 void testEqualsContract() { 53 53 TestUtils.assumeWorkingEqualsVerifier(); 54 54 EqualsVerifier.forClass(OAuthParameters.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthTokenTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.oauth; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNotNull; 6 6 7 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 … … 14 14 * Unit tests for class {@link OAuthToken}. 15 15 */ 16 publicclass OAuthTokenTest {16 class OAuthTokenTest { 17 17 18 18 /** … … 20 20 */ 21 21 @Test 22 publicvoid testCreateToken() {22 void testCreateToken() { 23 23 OAuthConsumer defCon = OAuthParameters.createDefault().buildConsumer(); 24 24 assertNotNull(defCon); … … 34 34 */ 35 35 @Test 36 publicvoid testEqualsContract() {36 void testEqualsContract() { 37 37 TestUtils.assumeWorkingEqualsVerifier(); 38 38 EqualsVerifier.forClass(OAuthToken.class).usingGetClass().verify(); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OsmPrivilegesTest.java
r9666 r17275 2 2 package org.openstreetmap.josm.data.oauth; 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. Test;7 import org.junit.jupiter.api.Test; 8 8 9 9 /** 10 10 * Unit tests for class {@link OsmPrivileges}. 11 11 */ 12 publicclass OsmPrivilegesTest {12 class OsmPrivilegesTest { 13 13 14 14 /** … … 16 16 */ 17 17 @Test 18 publicvoid testGettersSetters() {18 void testGettersSetters() { 19 19 OsmPrivileges p = new OsmPrivileges(); 20 20 assertFalse(p.isAllowModifyNotes()); -
trunk/test/unit/org/openstreetmap/josm/data/oauth/SignpostAdaptersTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.oauth; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.io.IOException; … … 10 11 import java.net.URL; 11 12 12 import org.junit. Rule;13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 14 15 import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpRequest; 15 16 import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpResponse; … … 24 25 * Unit tests for class {@link SignpostAdapters}. 25 26 */ 26 publicclass SignpostAdaptersTest {27 class SignpostAdaptersTest { 27 28 28 29 /** 29 30 * Setup test. 30 31 */ 31 @R ule32 @RegisterExtension 32 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 34 public JOSMTestRules test = new JOSMTestRules().https(); … … 42 43 */ 43 44 @Test 44 publicvoid testUtilityClass() throws ReflectiveOperationException {45 void testUtilityClass() throws ReflectiveOperationException { 45 46 UtilityClassTestUtil.assertUtilityClassWellDefined(SignpostAdapters.class); 46 47 } … … 51 52 */ 52 53 @Test 53 publicvoid testOAuthConsumerWrap() throws MalformedURLException {54 void testOAuthConsumerWrap() throws MalformedURLException { 54 55 assertNotNull(new OAuthConsumer("", "").wrap(newClient())); 55 56 } … … 60 61 */ 61 62 @Test 62 publicvoid testHttpRequestGetMessagePayload() throws IOException {63 void testHttpRequestGetMessagePayload() throws IOException { 63 64 assertNull(new HttpRequest(newClient()).getMessagePayload()); 64 65 } … … 66 67 /** 67 68 * Unit test of method {@link SignpostAdapters.HttpRequest#setRequestUrl}. 68 * @throws IOException never69 69 */ 70 @Test (expected = IllegalStateException.class)71 public void testHttpRequestSetRequestUrl() throws IOException{72 new HttpRequest(newClient()).setRequestUrl(null);70 @Test 71 void testHttpRequestSetRequestUrl() { 72 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).setRequestUrl(null)); 73 73 } 74 74 75 75 /** 76 76 * Unit test of method {@link SignpostAdapters.HttpRequest#getAllHeaders}. 77 * @throws IOException never78 77 */ 79 @Test (expected = IllegalStateException.class)80 public void testHttpRequestGetAllHeaders() throws IOException{81 new HttpRequest(newClient()).getAllHeaders();78 @Test 79 void testHttpRequestGetAllHeaders() { 80 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).getAllHeaders()); 82 81 } 83 82 84 83 /** 85 84 * Unit test of method {@link SignpostAdapters.HttpRequest#unwrap}. 86 * @throws IOException never87 85 */ 88 @Test (expected = IllegalStateException.class)89 public void testHttpRequestUnwrap() throws IOException{90 new HttpRequest(newClient()).unwrap();86 @Test 87 void testHttpRequestUnwrap() { 88 assertThrows(IllegalStateException.class, () -> new HttpRequest(newClient()).unwrap()); 91 89 } 92 90 … … 96 94 */ 97 95 @Test 98 publicvoid testHttpResponseGetReasonPhrase() throws Exception {96 void testHttpResponseGetReasonPhrase() throws Exception { 99 97 assertEquals("OK", new HttpResponse(new HttpRequest(newClient()).request.connect()).getReasonPhrase()); 100 98 } … … 102 100 /** 103 101 * Unit test of method {@link SignpostAdapters.HttpResponse#unwrap}. 104 * @throws IOException never105 102 */ 106 @Test (expected = IllegalStateException.class)107 public void testHttpResponseUnwrap() throws IOException{108 new HttpResponse(new HttpRequest(newClient()).request.connect()).unwrap();103 @Test 104 void testHttpResponseUnwrap() { 105 assertThrows(IllegalStateException.class, () -> new HttpResponse(new HttpRequest(newClient()).request.connect()).unwrap()); 109 106 } 110 107 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java
r12027 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 7 import java.util.Collections; 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.testutils.JOSMTestRules; 12 12 … … 16 16 * Unit tests of the {@code AbstractPrimitive} class. 17 17 */ 18 publicclass AbstractPrimitiveTest {18 class AbstractPrimitiveTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 29 29 */ 30 30 @Test 31 publicvoid testIsUndeleted() {31 void testIsUndeleted() { 32 32 AbstractPrimitive p = new Node(1); 33 33 p.setVisible(false); … … 60 60 */ 61 61 @Test 62 publicvoid testHasTagDifferent() {62 void testHasTagDifferent() { 63 63 AbstractPrimitive p = new Node(); 64 64 -
trunk/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java
r16673 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 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; 11 11 import org.openstreetmap.josm.data.coor.LatLon; … … 19 19 * Unit tests for class {@link BBox}. 20 20 */ 21 publicclass BBoxTest {21 class BBoxTest { 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(); … … 32 32 */ 33 33 @Test 34 publicvoid testEqualsContract() {34 void testEqualsContract() { 35 35 TestUtils.assumeWorkingEqualsVerifier(); 36 36 EqualsVerifier.forClass(BBox.class).usingGetClass() … … 43 43 */ 44 44 @Test 45 publicvoid testBboxesAreFunctionallyEqual() {45 void testBboxesAreFunctionallyEqual() { 46 46 BBox bbox1 = new BBox(0, 1, 1, 0); 47 47 BBox bbox2 = new BBox(0.1, 0.9, 0.9, 0.1); … … 63 63 */ 64 64 @Test 65 publicvoid testLatLonConstructor() {65 void testLatLonConstructor() { 66 66 LatLon latLon1 = new LatLon(10, 20); 67 67 LatLon latLon2 = new LatLon(20, 10); … … 95 95 */ 96 96 @Test 97 publicvoid testDoubleConstructor() {97 void testDoubleConstructor() { 98 98 assertTrue(new BBox(1, 2, 3, 4).isValid()); 99 99 assertFalse(new BBox(Double.NaN, 2, 3, 4).isValid()); … … 107 107 */ 108 108 @Test 109 publicvoid testNodeConstructor() {109 void testNodeConstructor() { 110 110 assertTrue(new BBox(new Node(LatLon.NORTH_POLE)).isValid()); 111 111 assertFalse(new BBox(new Node()).isValid()); … … 116 116 */ 117 117 @Test 118 publicvoid testAddLatLon() {118 void testAddLatLon() { 119 119 BBox b = new BBox(); 120 120 b.add((LatLon) null); … … 130 130 */ 131 131 @Test 132 publicvoid testAddLatLonBuffer() {132 void testAddLatLonBuffer() { 133 133 BBox b = new BBox(); 134 134 b.addLatLon(LatLon.NORTH_POLE, 0.5); … … 142 142 */ 143 143 @Test 144 publicvoid testAddDouble() {144 void testAddDouble() { 145 145 BBox b = new BBox(); 146 146 b.add(1, Double.NaN); … … 157 157 */ 158 158 @Test 159 publicvoid testAddPrimitive() {159 void testAddPrimitive() { 160 160 BBox b = new BBox(); 161 161 b.addPrimitive(new Node(LatLon.NORTH_POLE), 0.5); … … 169 169 */ 170 170 @Test 171 publicvoid testHeightWidthArea() {171 void testHeightWidthArea() { 172 172 BBox b1 = new BBox(1, 2, 3, 5); 173 173 assertEquals(2, b1.width(), 1e-7); … … 184 184 */ 185 185 @Test 186 publicvoid testToString() {186 void testToString() { 187 187 assertEquals("[ x: Infinity -> -Infinity, y: Infinity -> -Infinity ]", new BBox().toString()); 188 188 assertEquals("[ x: 1.0 -> 3.0, y: 2.0 -> 4.0 ]", new BBox(1, 2, 3, 4).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetCacheTest.java
r14201 r17275 2 2 package org.openstreetmap.josm.data.osm; 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;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 8 9 9 import java.util.Arrays; … … 13 13 import java.util.concurrent.TimeUnit; 14 14 15 import org.junit. After;16 import org.junit. Before;17 import org.junit. Rule;18 import org.junit. Test;15 import org.junit.jupiter.api.AfterEach; 16 import org.junit.jupiter.api.BeforeEach; 17 import org.junit.jupiter.api.Test; 18 import org.junit.jupiter.api.extension.RegisterExtension; 19 19 import org.openstreetmap.josm.data.UserIdentityManager; 20 20 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 26 26 * Unit test of {@link ChangesetCache} 27 27 */ 28 publicclass ChangesetCacheTest {28 class ChangesetCacheTest { 29 29 30 30 /** 31 31 * Setup test. 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 * Clears cache before/after each unit test. 41 41 */ 42 @After 43 @Before 42 @AfterEach 43 @BeforeEach 44 44 public void clearCache() { 45 45 cache.listeners.clear(); … … 73 73 */ 74 74 @Test 75 publicvoid testConstructor() {75 void testConstructor() { 76 76 assertNotNull(ChangesetCache.getInstance()); 77 77 } 78 78 79 79 @Test 80 publicvoid testAddAndRemoveListeners() {80 void testAddAndRemoveListeners() { 81 81 // should work 82 82 cache.addChangesetCacheListener(null); … … 97 97 98 98 @Test 99 publicvoid testUpdateGetRemoveCycle() {99 void testUpdateGetRemoveCycle() { 100 100 cache.update(new Changeset(1)); 101 101 assertEquals(1, cache.size()); … … 107 107 108 108 @Test 109 publicvoid testUpdateTwice() {109 void testUpdateTwice() { 110 110 Changeset cs = new Changeset(1); 111 111 cs.setIncomplete(false); … … 130 130 131 131 @Test 132 publicvoid testContains() {132 void testContains() { 133 133 Changeset cs = new Changeset(1); 134 134 cache.update(cs); … … 144 144 145 145 @Test 146 publicvoid testFireingEventsAddAChangeset() {146 void testFireingEventsAddAChangeset() { 147 147 TestListener listener = new TestListener() { 148 148 @Override 149 publicvoid test() {149 void test() { 150 150 await(); 151 151 assertNotNull(event); … … 163 163 164 164 @Test 165 publicvoid testFireingEventsUpdateChangeset() {165 void testFireingEventsUpdateChangeset() { 166 166 // Waiter listener to ensure the second listener does not receive the first event 167 167 TestListener waiter = new TestListener() { … … 195 195 196 196 @Test 197 publicvoid testFireingEventsRemoveChangeset() {197 void testFireingEventsRemoveChangeset() { 198 198 // Waiter listener to ensure the second listener does not receive the first event 199 199 TestListener waiter = new TestListener() { … … 229 229 */ 230 230 @Test 231 publicvoid testGetOpenChangesets() {231 void testGetOpenChangesets() { 232 232 // empty cache => empty list 233 assertTrue( 234 "Empty cache should produce an empty list.", 235 cache.getOpenChangesets().isEmpty() 236 ); 237 assertTrue( 238 "Empty cache should produce an empty list.", 239 cache.getChangesets().isEmpty() 240 ); 233 assertTrue(cache.getOpenChangesets().isEmpty(), "Empty cache should produce an empty list."); 234 assertTrue(cache.getChangesets().isEmpty(), "Empty cache should produce an empty list."); 241 235 242 236 // cache with only closed changesets => empty list … … 244 238 closedCs.setOpen(false); 245 239 cache.update(closedCs); 246 assertTrue( 247 "Cache with only closed changesets should produce an empty list.", 248 cache.getOpenChangesets().isEmpty() 249 ); 240 assertTrue(cache.getOpenChangesets().isEmpty(), 241 "Cache with only closed changesets should produce an empty list."); 250 242 assertEquals(1, cache.getChangesets().size()); 251 243 … … 265 257 */ 266 258 @Test 267 publicvoid testGetOpenChangesetsForCurrentUser() {259 void testGetOpenChangesetsForCurrentUser() { 268 260 // empty cache => empty list 269 assertTrue( 270 "Empty cache should produce an empty list.", 271 cache.getOpenChangesetsForCurrentUser().isEmpty() 272 ); 261 assertTrue(cache.getOpenChangesetsForCurrentUser().isEmpty(), 262 "Empty cache should produce an empty list."); 273 263 274 264 Changeset openCs1 = new Changeset(1); … … 299 289 */ 300 290 @Test 301 publicvoid testRemove() {291 void testRemove() { 302 292 Changeset cs1 = new Changeset(1); 303 293 cache.update(cs1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java
r14961 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;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.assertFalse; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.fail; 8 8 9 9 import java.util.Date; 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.TestUtils; 15 15 import org.openstreetmap.josm.data.coor.LatLon; … … 25 25 * Unit tests for class {@link ChangesetDataSet}. 26 26 */ 27 publicclass ChangesetDataSetTest {27 class ChangesetDataSetTest { 28 28 29 29 /** 30 30 * Setup test. 31 31 */ 32 @R ule32 @RegisterExtension 33 33 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 34 public JOSMTestRules test = new JOSMTestRules(); … … 38 38 */ 39 39 @Test 40 publicvoid testIterator() {40 void testIterator() { 41 41 final ChangesetDataSet cds = new ChangesetDataSet(); 42 42 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); … … 60 60 */ 61 61 @Test 62 publicvoid testGetEntry() {62 void testGetEntry() { 63 63 final ChangesetDataSet cds = new ChangesetDataSet(); 64 64 HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO); … … 80 80 */ 81 81 @Test 82 publicvoid testEnumChangesetModificationType() {82 void testEnumChangesetModificationType() { 83 83 TestUtils.superficialEnumCodeCoverage(ChangesetModificationType.class); 84 84 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java
r12035 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.Date; 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 ChangesetDiscussionComment}. 16 16 */ 17 publicclass ChangesetDiscussionCommentTest {17 class ChangesetDiscussionCommentTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testChangesetDiscussionComment() {30 void testChangesetDiscussionComment() { 31 31 Date d = new Date(1000); 32 32 User foo = User.createOsmUser(1, "foo"); … … 41 41 */ 42 42 @Test 43 publicvoid testText() {43 void testText() { 44 44 ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(new Date(), null); 45 45 cdc.setText("foo"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java
r16436 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.openstreetmap.josm.data.osm.Changeset.MAX_CHANGESET_TAG_LENGTH; 9 9 … … 17 17 18 18 import org.junit.Assert; 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.extension.RegisterExtension; 20 import org.junit.jupiter.api.Test; 21 21 import org.openstreetmap.josm.data.Bounds; 22 22 import org.openstreetmap.josm.data.coor.LatLon; … … 29 29 * Unit tests for class {@link Changeset}. 30 30 */ 31 publicclass ChangesetTest {31 class ChangesetTest { 32 32 33 33 /** 34 34 * Setup test. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules(); … … 43 43 @Test 44 44 @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS") 45 publicvoid testSetKeys() {45 void testSetKeys() { 46 46 final Changeset cs = new Changeset(); 47 47 // Cannot add null map => IllegalArgumentException … … 82 82 */ 83 83 @Test 84 publicvoid testCompareTo() {84 void testCompareTo() { 85 85 Changeset cs1 = new Changeset(1); 86 86 Changeset cs2 = new Changeset(2); … … 94 94 */ 95 95 @Test 96 publicvoid testGetBounds() {96 void testGetBounds() { 97 97 Changeset cs = new Changeset(); 98 98 assertNull(cs.getBounds()); … … 112 112 */ 113 113 @Test 114 publicvoid testGetSetHasContent() {114 void testGetSetHasContent() { 115 115 Changeset cs = new Changeset(); 116 116 assertNull(cs.getContent()); … … 126 126 */ 127 127 @Test 128 publicvoid testGetDisplayName() {128 void testGetDisplayName() { 129 129 assertEquals("Changeset 0", new Changeset().getDisplayName(DefaultNameFormatter.getInstance())); 130 130 } … … 134 134 */ 135 135 @Test 136 publicvoid testGetName() {136 void testGetName() { 137 137 assertEquals("changeset 0", new Changeset().getName()); 138 138 } … … 148 148 */ 149 149 @Test 150 publicvoid testHasEqualSemanticAttributes() {150 void testHasEqualSemanticAttributes() { 151 151 Date today = new Date(); 152 152 Changeset cs1 = new Changeset(); … … 244 244 */ 245 245 @Test 246 publicvoid testKeySet() {246 void testKeySet() { 247 247 Changeset cs = new Changeset(); 248 248 assertTrue(cs.keySet().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java
r12036 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNull; 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 for class {@link DataIntegrityProblemException}. 15 15 */ 16 publicclass DataIntegrityProblemExceptionTest {16 class DataIntegrityProblemExceptionTest { 17 17 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testDataIntegrityException() {29 void testDataIntegrityException() { 30 30 DataIntegrityProblemException e1 = new DataIntegrityProblemException("foo"); 31 31 assertEquals("foo", e1.getMessage()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java
r16657 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.assertNotSame;8 import static org.junit. Assert.assertSame;9 import static org.junit. Assert.assertTrue;10 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.assertNotSame; 8 import static org.junit.jupiter.api.Assertions.assertSame; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 import static org.junit.jupiter.api.Assertions.fail; 11 11 12 12 import java.io.StringWriter; … … 15 15 import java.util.Date; 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.data.coor.LatLon; 22 22 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 29 29 * Unit tests for class {@link DataSetMerger}. 30 30 */ 31 publicclass DataSetMergerTest {31 class DataSetMergerTest { 32 32 33 33 /** 34 34 * Setup test. 35 35 */ 36 @R ule36 @RegisterExtension 37 37 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 38 38 public JOSMTestRules test = new JOSMTestRules(); … … 44 44 * Setup test. 45 45 */ 46 @Before 46 @BeforeEach 47 47 public void setUp() { 48 48 my = new DataSet(); … … 67 67 } 68 68 69 @After 69 @AfterEach 70 70 public void checkDatasets() { 71 71 runConsistencyTests(my); … … 80 80 */ 81 81 @Test 82 publicvoid testNodeSimpleIdenticalNoConflict() {82 void testNodeSimpleIdenticalNoConflict() { 83 83 Node n = new Node(LatLon.ZERO); 84 84 n.setOsmId(1, 1); … … 114 114 */ 115 115 @Test 116 publicvoid testNodeSimpleLocallyUnmodifiedNoConflict() {116 void testNodeSimpleLocallyUnmodifiedNoConflict() { 117 117 Node n = new Node(LatLon.ZERO); 118 118 n.setOsmId(1, 1); … … 154 154 */ 155 155 @Test 156 publicvoid testNodeSimpleTagConflict() {156 void testNodeSimpleTagConflict() { 157 157 Node n = new Node(LatLon.ZERO); 158 158 n.setOsmId(1, 1); … … 188 188 */ 189 189 @Test 190 publicvoid testNodeSimpleDeleteConflict() {190 void testNodeSimpleDeleteConflict() { 191 191 Node n = new Node(1, 1); 192 192 n.setCoor(LatLon.ZERO); … … 218 218 */ 219 219 @Test 220 publicvoid testNodeSimpleDeleteConflict2() {220 void testNodeSimpleDeleteConflict2() { 221 221 Node n = new Node(LatLon.ZERO); 222 222 n.setOsmId(1, 1); … … 246 246 */ 247 247 @Test 248 publicvoid testNodeSimpleDeleteConflict3() {248 void testNodeSimpleDeleteConflict3() { 249 249 Node n = new Node(new LatLon(1, 1)); 250 250 n.setDeleted(true); … … 269 269 */ 270 270 @Test 271 publicvoid testNodeSimpleDeleteConflict4() {271 void testNodeSimpleDeleteConflict4() { 272 272 Node n = new Node(new LatLon(1, 1)); 273 273 n.setDeleted(true); … … 294 294 */ 295 295 @Test 296 publicvoid testNodeSimpleNoIdSemanticallyEqual() {296 void testNodeSimpleNoIdSemanticallyEqual() { 297 297 298 298 User myUser = User.createOsmUser(1111, "my"); … … 334 334 */ 335 335 @Test 336 publicvoid testNodeSimpleIncompleteNode() {336 void testNodeSimpleIncompleteNode() { 337 337 338 338 Node n = new Node(1); … … 364 364 */ 365 365 @Test 366 publicvoid testWaySimpleIdenticalNodesDifferentTags() {366 void testWaySimpleIdenticalNodesDifferentTags() { 367 367 368 368 // -- the target dataset … … 436 436 */ 437 437 @Test 438 publicvoid testWaySimpleAdditionalNodesAndChangedNodes() {438 void testWaySimpleAdditionalNodesAndChangedNodes() { 439 439 440 440 // -- my data set … … 505 505 */ 506 506 @Test 507 publicvoid testWaySimpleDifferentNodesAndMyIsModified() {507 void testWaySimpleDifferentNodesAndMyIsModified() { 508 508 509 509 // -- the target dataset … … 569 569 */ 570 570 @Test 571 publicvoid testWaySimpleTheirVersionNotVisibleMyIsModified() {571 void testWaySimpleTheirVersionNotVisibleMyIsModified() { 572 572 573 573 Node mn1 = new Node(LatLon.ZERO); … … 611 611 */ 612 612 @Test 613 publicvoid testWaySimpleTwoWaysWithNoIdNodesWithId() {613 void testWaySimpleTwoWaysWithNoIdNodesWithId() { 614 614 615 615 // -- my data set … … 668 668 */ 669 669 @Test 670 publicvoid testWaySimpleTwoWaysWithNoIdNodesWithoutId() {670 void testWaySimpleTwoWaysWithNoIdNodesWithoutId() { 671 671 672 672 // -- my data set … … 723 723 */ 724 724 @Test 725 publicvoid testWayComplexMergingADeletedNode() {725 void testWayComplexMergingADeletedNode() { 726 726 727 727 // -- my dataset … … 777 777 */ 778 778 @Test 779 publicvoid testRelationComplexMergingADeletedNode() {779 void testRelationComplexMergingADeletedNode() { 780 780 781 781 Node mn1 = new Node(LatLon.ZERO); … … 826 826 */ 827 827 @Test 828 publicvoid testNewIncompleteWay() {828 void testNewIncompleteWay() { 829 829 830 830 Node n1 = new Node(1); … … 868 868 */ 869 869 @Test 870 publicvoid testIncompleteWayOntoCompleteWay() {870 void testIncompleteWayOntoCompleteWay() { 871 871 872 872 // an incomplete node … … 923 923 */ 924 924 @Test 925 publicvoid testTwoCompleteNodesOntoAnIncompleteWay() {925 void testTwoCompleteNodesOntoAnIncompleteWay() { 926 926 927 927 // -- source dataset … … 1009 1009 */ 1010 1010 @Test 1011 publicvoid testTicket07481ab() {1011 void testTicket07481ab() { 1012 1012 doTestTicket7481(my, their); 1013 1013 } … … 1017 1017 */ 1018 1018 @Test 1019 publicvoid testTicket07481ba() {1019 void testTicket07481ba() { 1020 1020 doTestTicket7481(their, my); 1021 1021 } … … 1025 1025 */ 1026 1026 @Test 1027 publicvoid testTicket12599() {1027 void testTicket12599() { 1028 1028 // Server node: no modifications 1029 1029 Node n1 = new Node(1, 1); … … 1065 1065 */ 1066 1066 @Test 1067 publicvoid testTicket12616() {1067 void testTicket12616() { 1068 1068 // Server node: no modifications 1069 1069 Node n1 = new Node(1, 1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java
r17190 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.util.ArrayList; … … 12 12 13 13 import org.junit.Assert; 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.TestUtils; 17 17 import org.openstreetmap.josm.data.Bounds; … … 27 27 * Unit tests for class {@link DataSet}. 28 28 */ 29 publicclass DataSetTest {29 class DataSetTest { 30 30 31 31 /** 32 32 * Setup test. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules(); … … 40 40 */ 41 41 @Test 42 publicvoid testSearchRelations() {42 void testSearchRelations() { 43 43 final DataSet ds = new DataSet(); 44 44 // null bbox => empty list … … 72 72 */ 73 73 @Test 74 publicvoid testSearchPrimitives() {74 void testSearchPrimitives() { 75 75 final DataSet ds = new DataSet(); 76 76 // null bbox => empty list … … 99 99 */ 100 100 @Test 101 publicvoid testChangesetTags() {101 void testChangesetTags() { 102 102 final DataSet ds = new DataSet(); 103 103 assertTrue(ds.getChangeSetTags().isEmpty()); … … 112 112 */ 113 113 @Test 114 publicvoid testAllNonDeleted() {114 void testAllNonDeleted() { 115 115 final DataSet ds = new DataSet(); 116 116 assertTrue(ds.allNonDeletedPrimitives().isEmpty()); … … 142 142 */ 143 143 @Test 144 publicvoid testTicket14186() {144 void testTicket14186() { 145 145 final DataSet ds = new DataSet(); 146 146 Node n1 = new Node(1); … … 163 163 */ 164 164 @Test 165 publicvoid testTicket19438() {165 void testTicket19438() { 166 166 final DataSet ds = new DataSet(); 167 167 Node n1 = new Node(1); … … 184 184 */ 185 185 @Test 186 publicvoid testSelectionOrderPreserved() {186 void testSelectionOrderPreserved() { 187 187 final DataSet ds = new DataSet(); 188 188 Node n1 = new Node(1); … … 222 222 */ 223 223 @Test 224 publicvoid testCopyConstructor() {224 void testCopyConstructor() { 225 225 DataSet ds = new DataSet(); 226 226 assertEqualsDataSet(ds, new DataSet(ds)); … … 249 249 */ 250 250 @Test 251 publicvoid testMergePolicies() {251 void testMergePolicies() { 252 252 DataSet ds1 = new DataSet(); 253 253 DataSet ds2 = new DataSet(); … … 293 293 */ 294 294 @Test 295 publicvoid testEnumOrder() {295 void testEnumOrder() { 296 296 assertTrue(DownloadPolicy.BLOCKED.compareTo(DownloadPolicy.NORMAL) > 0); 297 297 assertTrue(UploadPolicy.BLOCKED.compareTo(UploadPolicy.NORMAL) > 0); … … 304 304 */ 305 305 @Test 306 publicvoid testAddDataSourceListener() {306 void testAddDataSourceListener() { 307 307 DataSourceListener addListener = new DataSourceListener() { 308 308 @Override … … 322 322 */ 323 323 @Test 324 publicvoid testRemoveDataSourceListener() {324 void testRemoveDataSourceListener() { 325 325 DataSourceListener removeListener = new DataSourceListener() { 326 326 @Override … … 340 340 */ 341 341 @Test 342 publicvoid testCloneReadOnly() {342 void testCloneReadOnly() { 343 343 DataSet ds = new DataSet(); 344 344 Node n1 = new Node(LatLon.SOUTH_POLE); -
trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.InputStream; … … 15 15 import java.util.List; 16 16 17 import org.junit. Rule;18 import org.junit. Test;17 import org.junit.jupiter.api.extension.RegisterExtension; 18 import org.junit.jupiter.api.Test; 19 19 import org.openstreetmap.josm.TestUtils; 20 20 import org.openstreetmap.josm.data.coor.LatLon; … … 33 33 * Unit tests for class {@link Filter}. 34 34 */ 35 publicclass FilterTest {35 class FilterTest { 36 36 37 37 /** 38 38 * Setup test. 39 39 */ 40 @R ule40 @RegisterExtension 41 41 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 42 42 public JOSMTestRules test = new JOSMTestRules(); 43 43 44 44 @Test 45 publicvoid testBasic() throws SearchParseError {45 void testBasic() throws SearchParseError { 46 46 DataSet ds = new DataSet(); 47 47 Node n1 = new Node(LatLon.ZERO); … … 71 71 72 72 @Test 73 publicvoid testFilter() throws Exception {73 void testFilter() throws Exception { 74 74 for (int i : new int[] {1, 2, 3, 11, 12, 13, 14, 15}) { 75 75 DataSet ds; … … 197 197 */ 198 198 @Test 199 publicvoid testFilterPreferenceEntry() {199 void testFilterPreferenceEntry() { 200 200 Filter f = new Filter(); 201 201 FilterPreferenceEntry fpe = f.getPreferenceEntry(); … … 243 243 */ 244 244 @Test 245 publicvoid testEqualsContract() {245 void testEqualsContract() { 246 246 TestUtils.assumeWorkingEqualsVerifier(); 247 247 EqualsVerifier.forClass(FilterPreferenceEntry.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java
r15130 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertNull;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 5 6 6 import java.io.InputStream; 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; 11 11 import org.openstreetmap.josm.io.OsmReader; … … 17 17 * Unit tests of the {@code MultipolygonBuilder} class. 18 18 */ 19 publicclass MultipolygonBuilderTest {19 class MultipolygonBuilderTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().projection().timeout(15000); … … 31 31 */ 32 32 @Test 33 publicvoid testTicket12376() throws Exception {33 void testTicket12376() throws Exception { 34 34 try (InputStream is = TestUtils.getRegressionDataStream(12376, "multipolygon_hang.osm.bz2")) { 35 35 for (Relation r : OsmReader.parseDataSet(is, null).getRelations()) { -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeDataTest.java
r11324 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertNull;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertNull; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.io.ByteArrayInputStream; … … 12 12 13 13 import org.junit.Assert; 14 import org.junit. Test;14 import org.junit.jupiter.api.Test; 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 17 17 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 18 18 19 publicclass NodeDataTest {19 class NodeDataTest { 20 20 21 21 @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION") … … 31 31 32 32 @Test 33 publicvoid testSerializationForDragAndDrop() throws Exception {33 void testSerializationForDragAndDrop() throws Exception { 34 34 final NodeData data = new NodeData(); 35 35 data.setCoor(new LatLon(31.14, 15.9)); … … 46 46 */ 47 47 @Test 48 publicvoid testTicket13395() throws Exception {48 void testTicket13395() throws Exception { 49 49 Node n = new Node(1925320646, 1); 50 50 n.setCoor(null); -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java
r12478 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.util.Arrays; … … 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.testutils.JOSMTestRules; 14 14 … … 18 18 * Unit tests of the {@code NodeGraph} class. 19 19 */ 20 publicclass NodeGraphTest {20 class NodeGraphTest { 21 21 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(); … … 31 31 */ 32 32 @Test 33 publicvoid testNodePairs() {33 void testNodePairs() { 34 34 assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), true).isEmpty()); 35 35 assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), false).isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java
r16077 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.assertNull; 8 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.assertNotNull; 7 import static org.junit.jupiter.api.Assertions.assertNull; 8 import static org.junit.jupiter.api.Assertions.assertTrue; 9 import static org.junit.jupiter.api.Assertions.assertThrows; 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.data.Bounds; 13 14 import org.openstreetmap.josm.data.DataSource; … … 21 22 * Unit tests of the {@code Node} class. 22 23 */ 23 publicclass NodeTest {24 class NodeTest { 24 25 25 26 /** 26 27 * Setup test. 27 28 */ 28 @R ule29 @RegisterExtension 29 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 30 31 public JOSMTestRules test = new JOSMTestRules().projection(); … … 34 35 */ 35 36 @Test 36 publicvoid testTicket12060() {37 void testTicket12060() { 37 38 DataSet ds = new DataSet(); 38 39 ds.addDataSource(new DataSource(new Bounds(LatLon.ZERO), null)); … … 51 52 */ 52 53 @Test 53 publicvoid testBBox() {54 void testBBox() { 54 55 DataSet ds = new DataSet(); 55 56 Node n1 = new Node(1); … … 85 86 * Test that {@link Node#cloneFrom} throws IAE for invalid arguments 86 87 */ 87 @Test (expected = IllegalArgumentException.class)88 publicvoid testCloneFromIAE() {89 new Node().cloneFrom(new Way());88 @Test 89 void testCloneFromIAE() { 90 assertThrows(IllegalArgumentException.class, () -> new Node().cloneFrom(new Way())); 90 91 } 91 92 … … 93 94 * Test that {@link Node#mergeFrom} throws IAE for invalid arguments 94 95 */ 95 @Test (expected = IllegalArgumentException.class)96 publicvoid testMergeFromIAE() {97 new Node().mergeFrom(new Way());96 @Test 97 void testMergeFromIAE() { 98 assertThrows(IllegalArgumentException.class, () -> new Node().mergeFrom(new Way())); 98 99 } 99 100 … … 101 102 * Test that {@link Node#load} throws IAE for invalid arguments 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 publicvoid testLoadIAE() {105 new Node().load(new WayData());104 @Test 105 void testLoadIAE() { 106 assertThrows(IllegalArgumentException.class, () -> new Node().load(new WayData())); 106 107 } 107 108 … … 110 111 */ 111 112 @Test 112 publicvoid testOutsideWorld() {113 void testOutsideWorld() { 113 114 Node n = new Node(1, 1); 114 115 n.setCoor(LatLon.ZERO); … … 134 135 */ 135 136 @Test 136 publicvoid testDirectional() {137 void testDirectional() { 137 138 assertFalse(OsmUtils.createPrimitive("node oneway=yes").hasDirectionKeys()); 138 139 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java
r14101 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 import org.openstreetmap.josm.data.notes.Note; … … 13 13 * Unit tests of the {@code NoteData} class. 14 14 */ 15 publicclass NoteDataTest {15 class NoteDataTest { 16 16 17 17 /** … … 19 19 */ 20 20 @Test 21 publicvoid testNoteData() {21 void testNoteData() { 22 22 NoteData empty = new NoteData(); 23 23 assertEquals(0, empty.getNotes().size()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java
r11933 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 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.coor.LatLon; 11 11 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 17 17 * {@link Node} for the tests, {@link OsmPrimitive} is abstract. 18 18 */ 19 publicclass OsmPrimitiveKeyHandlingTest {19 class OsmPrimitiveKeyHandlingTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 */ 31 31 @Test 32 publicvoid testEmptyNode() {32 void testEmptyNode() { 33 33 Node n = new Node(); 34 34 testKeysSize(n, 0); … … 44 44 */ 45 45 @Test 46 publicvoid testPut() {46 void testPut() { 47 47 Node n = new Node(); 48 48 n.put("akey", "avalue"); … … 56 56 */ 57 57 @Test 58 publicvoid testPut2() {58 void testPut2() { 59 59 Node n = new Node(); 60 60 n.put("key.1", "value.1"); … … 74 74 @Test 75 75 @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test that equals is used and not ==") 76 publicvoid testRemove() {76 void testRemove() { 77 77 Node n = new Node(); 78 78 n.put("key.1", "value.1"); … … 106 106 */ 107 107 @Test 108 publicvoid testRemoveAll() {108 void testRemoveAll() { 109 109 Node n = new Node(); 110 110 … … 121 121 */ 122 122 @Test 123 publicvoid testHasEqualSemanticAttributes() {123 void testHasEqualSemanticAttributes() { 124 124 Node n1 = new Node(1); 125 125 n1.setCoor(LatLon.ZERO); … … 139 139 */ 140 140 @Test 141 publicvoid testHasEqualSemanticAttributes2() {141 void testHasEqualSemanticAttributes2() { 142 142 Node n1 = new Node(1); 143 143 n1.setCoor(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java
r16913 r17275 1 1 // License: GPL. For details, see LICENSE file. 2 2 package org.openstreetmap.josm.data.osm; 3 4 import static org.junit.jupiter.api.Assertions.assertThrows; 3 5 4 6 import java.util.Arrays; … … 6 8 7 9 import org.junit.Assert; 8 import org.junit. BeforeClass;9 import org.junit. Rule;10 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 11 13 import org.openstreetmap.josm.data.coor.LatLon; 12 14 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 19 21 * Unit tests of the {@code OsmPrimitive} class. 20 22 */ 21 publicclass OsmPrimitiveTest {23 class OsmPrimitiveTest { 22 24 23 25 /** 24 26 * Setup test. 25 27 */ 26 @R ule28 @RegisterExtension 27 29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 30 public JOSMTestRules test = new JOSMTestRules(); … … 38 40 * Setup test. 39 41 */ 40 @Before Class42 @BeforeAll 41 43 public static void setUp() { 42 44 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator … … 44 46 45 47 @Test 46 publicvoid testSimpleReferrersTest() {48 void testSimpleReferrersTest() { 47 49 Node n1 = new Node(LatLon.ZERO); 48 50 Way w1 = new Way(); … … 54 56 55 57 @Test 56 publicvoid testAddAndRemoveReferrer() {58 void testAddAndRemoveReferrer() { 57 59 Node n1 = new Node(LatLon.ZERO); 58 60 Node n2 = new Node(LatLon.ZERO); … … 70 72 71 73 @Test 72 publicvoid testMultipleReferrers() {74 void testMultipleReferrers() { 73 75 Node n1 = new Node(LatLon.ZERO); 74 76 Way w1 = new Way(); … … 86 88 87 89 @Test 88 publicvoid testRemoveMemberFromRelationReferrerTest() {90 void testRemoveMemberFromRelationReferrerTest() { 89 91 Node n1 = new Node(LatLon.ZERO); 90 92 Relation r1 = new Relation(); … … 98 100 99 101 @Test 100 publicvoid testSetRelationMemberReferrerTest() {102 void testSetRelationMemberReferrerTest() { 101 103 Node n1 = new Node(LatLon.ZERO); 102 104 Node n2 = new Node(LatLon.ZERO); … … 115 117 116 118 @Test 117 publicvoid testRemovePrimitiveReferrerTest() {119 void testRemovePrimitiveReferrerTest() { 118 120 Node n1 = new Node(LatLon.ZERO); 119 121 Way w1 = new Way(); … … 137 139 138 140 @Test 139 publicvoid testNodeFromMultipleDatasets() {141 void testNodeFromMultipleDatasets() { 140 142 // n has two referrers - w1 and w2. But only w1 is returned because it is in the same dataset as n 141 143 Node n = new Node(LatLon.ZERO); … … 151 153 } 152 154 153 @Test (expected = DataIntegrityProblemException.class)154 publicvoid testCheckMustBeInDatasate() {155 @Test 156 void testCheckMustBeInDatasate() { 155 157 Node n = new Node(); 156 n.getReferrers();158 assertThrows(DataIntegrityProblemException.class, () -> n.getReferrers()); 157 159 } 158 160 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java
r12027 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit.Assert.assertEquals; 5 import static org.junit.Assert.assertNull; 6 import static org.junit.Assert.assertTrue; 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertNull; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.Collection; 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.TestUtils; 13 14 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 19 * Unit tests of the {@code OsmPrimitiveType} class. 19 20 */ 20 publicclass OsmPrimitiveTypeTest {21 class OsmPrimitiveTypeTest { 21 22 22 23 /** 23 24 * Setup test. 24 25 */ 25 @R ule26 @RegisterExtension 26 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 27 28 public JOSMTestRules test = new JOSMTestRules(); … … 31 32 */ 32 33 @Test 33 publicvoid testEnum() {34 void testEnum() { 34 35 TestUtils.superficialEnumCodeCoverage(OsmPrimitiveType.class); 35 36 } … … 39 40 */ 40 41 @Test 41 publicvoid testGetApiName() {42 void testGetApiName() { 42 43 assertEquals("node", OsmPrimitiveType.NODE.getAPIName()); 43 44 assertEquals("way", OsmPrimitiveType.WAY.getAPIName()); … … 49 50 */ 50 51 @Test 51 publicvoid testGetOsmClass() {52 void testGetOsmClass() { 52 53 assertEquals(Node.class, OsmPrimitiveType.NODE.getOsmClass()); 53 54 assertEquals(Way.class, OsmPrimitiveType.WAY.getOsmClass()); … … 61 62 */ 62 63 @Test 63 publicvoid testGetDataClass() {64 void testGetDataClass() { 64 65 assertEquals(NodeData.class, OsmPrimitiveType.NODE.getDataClass()); 65 66 assertEquals(WayData.class, OsmPrimitiveType.WAY.getDataClass()); … … 73 74 */ 74 75 @Test 75 publicvoid testFromApiTypeName() {76 void testFromApiTypeName() { 76 77 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.fromApiTypeName("node")); 77 78 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.fromApiTypeName("way")); … … 82 83 * Unit test of {@link OsmPrimitiveType#fromApiTypeName} method - error case. 83 84 */ 84 @Test (expected = IllegalArgumentException.class)85 publicvoid testFromApiTypeNameError() {86 OsmPrimitiveType.fromApiTypeName("foo");85 @Test 86 void testFromApiTypeNameError() { 87 assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.fromApiTypeName("foo")); 87 88 } 88 89 … … 91 92 */ 92 93 @Test 93 publicvoid testFromIPrimitive() {94 void testFromIPrimitive() { 94 95 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from(new Node())); 95 96 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from(new Way())); … … 100 101 * Unit test of {@link OsmPrimitiveType#from(IPrimitive)} method - error case. 101 102 */ 102 @Test (expected = IllegalArgumentException.class)103 publicvoid testFromIPrimitiveError() {104 OsmPrimitiveType.from((IPrimitive) null);103 @Test 104 void testFromIPrimitiveError() { 105 assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.from((IPrimitive) null)); 105 106 } 106 107 … … 109 110 */ 110 111 @Test 111 publicvoid testFromString() {112 void testFromString() { 112 113 assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from("node")); 113 114 assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from("WAY")); … … 122 123 */ 123 124 @Test 124 publicvoid testDataValues() {125 void testDataValues() { 125 126 Collection<OsmPrimitiveType> values = OsmPrimitiveType.dataValues(); 126 127 assertEquals(3, values.size()); … … 134 135 */ 135 136 @Test 136 publicvoid testNewInstance() {137 void testNewInstance() { 137 138 OsmPrimitive n = OsmPrimitiveType.NODE.newInstance(1, false); 138 139 OsmPrimitive w = OsmPrimitiveType.WAY.newInstance(2, false); … … 151 152 * Unit test of {@link OsmPrimitiveType#newInstance} method - error case. 152 153 */ 153 @Test (expected = AssertionError.class)154 publicvoid testNewInstanceError() {155 OsmPrimitiveType.CLOSEDWAY.newInstance(1, false);154 @Test 155 void testNewInstanceError() { 156 assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newInstance(1, false)); 156 157 } 157 158 … … 160 161 */ 161 162 @Test 162 publicvoid testNewVersionedInstance() {163 void testNewVersionedInstance() { 163 164 OsmPrimitive n = OsmPrimitiveType.NODE.newVersionedInstance(1, 4); 164 165 OsmPrimitive w = OsmPrimitiveType.WAY.newVersionedInstance(2, 5); … … 181 182 * Unit test of {@link OsmPrimitiveType#newVersionedInstance} method - error case. 182 183 */ 183 @Test (expected = AssertionError.class)184 publicvoid testNewVersionedInstanceError() {185 OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0);184 @Test 185 void testNewVersionedInstanceError() { 186 assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0)); 186 187 } 187 188 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java
r15951 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 8 9 9 10 import java.util.Arrays; 10 11 import java.util.stream.Collectors; 11 12 12 import org.junit. Rule;13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 import org.junit.jupiter.api.extension.RegisterExtension; 14 15 import org.openstreetmap.josm.testutils.JOSMTestRules; 15 16 … … 19 20 * Unit tests for class {@link OsmUtils}. 20 21 */ 21 publicclass OsmUtilsTest {22 class OsmUtilsTest { 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(); … … 32 33 */ 33 34 @Test 34 publicvoid testCreatePrimitive() {35 void testCreatePrimitive() { 35 36 final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail"); 36 37 assertTrue(p instanceof Way); … … 44 45 */ 45 46 @Test 46 publicvoid testArea() {47 void testArea() { 47 48 final OsmPrimitive p = OsmUtils.createPrimitive("area name=Foo railway=rail"); 48 49 assertEquals(OsmPrimitiveType.WAY, p.getType()); … … 53 54 * Unit test of {@link OsmUtils#createPrimitive} 54 55 */ 55 @Test (expected = IllegalArgumentException.class)56 publicvoid testCreatePrimitiveFail() {57 OsmUtils.createPrimitive("noway name=Foo");56 @Test 57 void testCreatePrimitiveFail() { 58 assertThrows(IllegalArgumentException.class, () -> OsmUtils.createPrimitive("noway name=Foo")); 58 59 } 59 60 … … 62 63 */ 63 64 @Test 64 publicvoid testSplitMultipleValues() {65 void testSplitMultipleValues() { 65 66 // examples from https://wiki.openstreetmap.org/wiki/Semi-colon_value_separator 66 67 assertEquals(Arrays.asList("B500", "B550"), OsmUtils.splitMultipleValues("B500;B550").collect(Collectors.toList())); … … 74 75 */ 75 76 @Test 76 publicvoid testTrueFalse() {77 void testTrueFalse() { 77 78 assertFalse(OsmUtils.isTrue(null)); 78 79 assertFalse(OsmUtils.isFalse(null)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java
r16547 r17275 16 16 17 17 import org.junit.Assert; 18 import org.junit. Rule;19 import org.junit. Test;18 import org.junit.jupiter.api.extension.RegisterExtension; 19 import org.junit.jupiter.api.Test; 20 20 import org.openstreetmap.josm.data.coor.LatLon; 21 21 import org.openstreetmap.josm.data.projection.ProjectionRegistry; … … 30 30 * Unit tests of {@link QuadBuckets}. 31 31 */ 32 publicclass QuadBucketsTest {32 class QuadBucketsTest { 33 33 34 34 /** 35 35 * Setup test. 36 36 */ 37 @R ule37 @RegisterExtension 38 38 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 39 39 public JOSMTestRules test = new JOSMTestRules(); … … 83 83 */ 84 84 @Test 85 publicvoid testRemove() throws Exception {85 void testRemove() throws Exception { 86 86 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 87 87 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) { … … 96 96 */ 97 97 @Test 98 publicvoid testMove() throws Exception {98 void testMove() throws Exception { 99 99 ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator 100 100 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) { … … 113 113 */ 114 114 @Test 115 publicvoid testSpecialBBox() {115 void testSpecialBBox() { 116 116 QuadBuckets<Node> qbNodes = new QuadBuckets<>(); 117 117 QuadBuckets<Way> qbWays = new QuadBuckets<>(); … … 195 195 */ 196 196 @Test 197 publicvoid testSplitsWithIncompleteData() {197 void testSplitsWithIncompleteData() { 198 198 DataSet ds = new DataSet(); 199 199 long nodeId = 1; -
trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java
r11383 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import org.junit.Assert; 9 import org.junit. Rule;10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 import org.junit.jupiter.api.extension.RegisterExtension; 11 12 import org.openstreetmap.josm.data.coor.LatLon; 12 13 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 15 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 15 16 16 publicclass RelationTest {17 class RelationTest { 17 18 18 19 /** 19 20 * Setup test. 20 21 */ 21 @R ule22 @RegisterExtension 22 23 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 23 24 public JOSMTestRules test = new JOSMTestRules(); 24 25 25 @Test (expected = NullPointerException.class)26 publicvoid testCreateNewRelation() {27 new Relation(null);26 @Test 27 void testCreateNewRelation() { 28 assertThrows(NullPointerException.class, () -> new Relation(null)); 28 29 } 29 30 30 31 @Test 31 publicvoid testEqualSemanticsToNull() {32 void testEqualSemanticsToNull() { 32 33 Relation relation = new Relation(); 33 34 assertFalse(relation.hasEqualTechnicalAttributes(null)); … … 35 36 36 37 @Test 37 publicvoid testBbox() {38 void testBbox() { 38 39 DataSet ds = new DataSet(); 39 40 … … 88 89 89 90 @Test 90 publicvoid testBBoxNotInDataset() {91 void testBBoxNotInDataset() { 91 92 Node n1 = new Node(new LatLon(10, 10)); 92 93 Node n2 = new Node(new LatLon(20, 20)); … … 122 123 */ 123 124 @Test 124 publicvoid testTicket12467() throws Exception {125 void testTicket12467() throws Exception { 125 126 Relation r = new Relation(); 126 127 r.put("type", "boundary"); … … 143 144 * Test that {@link Relation#cloneFrom} throws IAE for invalid arguments 144 145 */ 145 @Test (expected = IllegalArgumentException.class)146 publicvoid testCloneFromIAE() {147 new Relation().cloneFrom(new Node());146 @Test 147 void testCloneFromIAE() { 148 assertThrows(IllegalArgumentException.class, () -> new Relation().cloneFrom(new Node())); 148 149 } 149 150 … … 151 152 * Test that {@link Relation#load} throws IAE for invalid arguments 152 153 */ 153 @Test (expected = IllegalArgumentException.class)154 publicvoid testLoadIAE() {155 new Relation().load(new NodeData());154 @Test 155 void testLoadIAE() { 156 assertThrows(IllegalArgumentException.class, () -> new Relation().load(new NodeData())); 156 157 } 157 158 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/SimplePrimitiveIdTest.java
r13969 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 7 8 8 9 /** 9 10 * Unit tests of {@link SimplePrimitiveId} class. 10 11 */ 11 publicclass SimplePrimitiveIdTest {12 class SimplePrimitiveIdTest { 12 13 13 14 /** … … 15 16 */ 16 17 @Test 17 publicvoid testFromStringNode() {18 void testFromStringNode() { 18 19 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node/123")); 19 20 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("n123")); … … 26 27 */ 27 28 @Test 28 publicvoid testFromStringWay() {29 void testFromStringWay() { 29 30 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way/123")); 30 31 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("w123")); … … 37 38 */ 38 39 @Test 39 publicvoid testFromStringRelation() {40 void testFromStringRelation() { 40 41 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("relation/123")); 41 42 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("r123")); … … 47 48 * Unit test of {@link SimplePrimitiveId#fromString} for invalid input. 48 49 */ 49 @Test (expected = IllegalArgumentException.class)50 publicvoid testFromStringBad() {51 SimplePrimitiveId.fromString("foobar");50 @Test 51 void testFromStringBad() { 52 assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.fromString("foobar")); 52 53 } 53 54 … … 56 57 */ 57 58 @Test 58 publicvoid testFuzzyParse() {59 void testFuzzyParse() { 59 60 assertEquals("[relation 123]", 60 61 SimplePrimitiveId.fuzzyParse("foo relation/123 bar").toString()); … … 68 69 69 70 @Test 70 publicvoid testFromCopyAction() {71 void testFromCopyAction() { 71 72 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node 123")); 72 73 assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way 123")); … … 78 79 */ 79 80 @Test 80 publicvoid testMultipleFromString() {81 void testMultipleFromString() { 81 82 assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234").toString()); 82 83 assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234-234").toString()); … … 101 102 * Unit test of {@link SimplePrimitiveId#multipleFromString} for invalid data. 102 103 */ 103 @Test (expected = IllegalArgumentException.class)104 publicvoid testMultipleFromStringBad() {105 SimplePrimitiveId.multipleFromString("foo node123 bar");104 @Test 105 void testMultipleFromStringBad() { 106 assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.multipleFromString("foo node123 bar")); 106 107 } 107 108 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.osm; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests for class {@link Storage}. 15 15 */ 16 publicclass StorageTest {16 class StorageTest { 17 17 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(); … … 27 27 */ 28 28 @Test 29 publicvoid testEqualsContract() {29 void testEqualsContract() { 30 30 TestUtils.assumeWorkingEqualsVerifier(); 31 31 EqualsVerifier.forClass(Storage.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java
r16643 r17275 2 2 package org.openstreetmap.josm.data.osm; 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.util.Arrays; … … 17 17 import java.util.stream.Stream; 18 18 19 import org.junit. Rule;20 import org.junit. Test;19 import org.junit.jupiter.api.Test; 20 import org.junit.jupiter.api.extension.RegisterExtension; 21 21 import org.openstreetmap.josm.testutils.JOSMTestRules; 22 22 … … 27 27 * @author Michael Zangl 28 28 */ 29 publicclass TagCollectionTest {29 class TagCollectionTest { 30 30 private final Tag tagA = new Tag("k", "v"); 31 31 private final Tag tagB = new Tag("k", "b"); … … 39 39 * We need prefs for using primitives 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 54 54 */ 55 55 @Test 56 publicvoid testFromTagged() {56 void testFromTagged() { 57 57 TagCollection c = TagCollection.from(tagA); 58 58 assertTagCounts(c, 1, 0, 0, 0); … … 72 72 */ 73 73 @Test 74 publicvoid testFromMapOfStringString() {74 void testFromMapOfStringString() { 75 75 TagCollection c = TagCollection.from(tagA.getKeys()); 76 76 assertTagCounts(c, 1, 0, 0, 0); … … 90 90 */ 91 91 @Test 92 publicvoid testUnionOfAllPrimitivesCollectionOfQextendsTagged() {92 void testUnionOfAllPrimitivesCollectionOfQextendsTagged() { 93 93 TagCollection c = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA)); 94 94 assertEquals(1, c.getTagOccurrence(tagA)); … … 111 111 */ 112 112 @Test 113 publicvoid testTagCollection() {113 void testTagCollection() { 114 114 TagCollection c = new TagCollection(); 115 115 assertTagCounts(c, 0, 0, 0, 0); … … 120 120 */ 121 121 @Test 122 publicvoid testTagCollectionTagCollection() {122 void testTagCollectionTagCollection() { 123 123 TagCollection blueprint = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA, tagC, tagC)); 124 124 TagCollection c = new TagCollection(blueprint); … … 133 133 */ 134 134 @Test 135 publicvoid testTagCollectionCollectionOfTag() {135 void testTagCollectionCollectionOfTag() { 136 136 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 137 137 assertTagCounts(c, 1, 0, 2, 0); … … 145 145 */ 146 146 @Test 147 publicvoid testSize() {147 void testSize() { 148 148 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 149 149 assertEquals(2, c.size()); … … 157 157 */ 158 158 @Test 159 publicvoid testIsEmpty() {159 void testIsEmpty() { 160 160 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 161 161 assertFalse(c.isEmpty()); … … 169 169 */ 170 170 @Test 171 publicvoid testAddTag() {171 void testAddTag() { 172 172 TagCollection c = new TagCollection(); 173 173 assertTagCounts(c, 0, 0, 0, 0); … … 182 182 183 183 /** 184 * Test method for {@link TagCollection#getTagOccur ence(Tag)}.185 */ 186 @Test 187 publicvoid testGetTagCount() {184 * Test method for {@link TagCollection#getTagOccurrence}. 185 */ 186 @Test 187 void testGetTagCount() { 188 188 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 189 189 assertEquals(2, c.getTagOccurrence(tagC)); … … 197 197 */ 198 198 @Test 199 publicvoid testAddCollectionOfTag() {199 void testAddCollectionOfTag() { 200 200 TagCollection c = new TagCollection(); 201 201 assertTagCounts(c, 0, 0, 0, 0); … … 214 214 */ 215 215 @Test 216 publicvoid testAddTagCollection() {216 void testAddTagCollection() { 217 217 TagCollection c = new TagCollection(); 218 218 assertTagCounts(c, 0, 0, 0, 0); … … 231 231 */ 232 232 @Test 233 publicvoid testRemoveTag() {233 void testRemoveTag() { 234 234 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 235 235 assertTagCounts(c, 1, 0, 2, 0); … … 246 246 */ 247 247 @Test 248 publicvoid testRemoveCollectionOfTag() {248 void testRemoveCollectionOfTag() { 249 249 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 250 250 assertTagCounts(c, 1, 0, 2, 0); … … 259 259 */ 260 260 @Test 261 publicvoid testRemoveTagCollection() {261 void testRemoveTagCollection() { 262 262 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC)); 263 263 assertTagCounts(c, 1, 0, 2, 0); … … 274 274 */ 275 275 @Test 276 publicvoid testRemoveByKeyString() {276 void testRemoveByKeyString() { 277 277 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC)); 278 278 assertTagCounts(c, 1, 2, 1, 0); … … 287 287 */ 288 288 @Test 289 publicvoid testRemoveByKeyCollectionOfString() {289 void testRemoveByKeyCollectionOfString() { 290 290 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC, tagD)); 291 291 assertTagCounts(c, 1, 2, 1, 1); … … 300 300 */ 301 301 @Test 302 publicvoid testContains() {302 void testContains() { 303 303 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB)); 304 304 assertTrue(c.contains(tagA)); … … 311 311 */ 312 312 @Test 313 publicvoid testContainsAll() {313 void testContainsAll() { 314 314 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB)); 315 315 assertTrue(c.containsAll(Arrays.asList(tagA, tagB))); … … 323 323 */ 324 324 @Test 325 publicvoid testContainsAllKeys() {325 void testContainsAllKeys() { 326 326 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 327 327 assertTrue(c.containsAllKeys(Arrays.asList("k", "k2"))); … … 335 335 */ 336 336 @Test 337 publicvoid testGetNumTagsFor() {337 void testGetNumTagsFor() { 338 338 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 339 339 assertEquals(2, c.getNumTagsFor("k")); … … 346 346 */ 347 347 @Test 348 publicvoid testHasTagsFor() {348 void testHasTagsFor() { 349 349 TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC)); 350 350 assertTrue(c.hasTagsFor("k")); … … 357 357 */ 358 358 @Test 359 publicvoid testHasValuesFor() {359 void testHasValuesFor() { 360 360 TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty)); 361 361 assertFalse(c.hasValuesFor("k")); … … 368 368 */ 369 369 @Test 370 publicvoid testHasUniqueNonEmptyValue() {370 void testHasUniqueNonEmptyValue() { 371 371 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty)); 372 372 assertTrue(c.hasUniqueNonEmptyValue("k")); … … 384 384 */ 385 385 @Test 386 publicvoid testHasEmptyValue() {386 void testHasEmptyValue() { 387 387 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty)); 388 388 assertTrue(c.hasEmptyValue("k")); … … 395 395 */ 396 396 @Test 397 publicvoid testHasUniqueEmptyValue() {397 void testHasUniqueEmptyValue() { 398 398 TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty)); 399 399 assertTrue(c.hasUniqueEmptyValue("k")); … … 411 411 */ 412 412 @Test 413 publicvoid testGetTagsForString() {413 void testGetTagsForString() { 414 414 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty)); 415 415 TagCollection collection = d.getTagsFor("k"); … … 422 422 */ 423 423 @Test 424 publicvoid testGetTagsForCollectionOfString() {424 void testGetTagsForCollectionOfString() { 425 425 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty)); 426 426 TagCollection collection = d.getTagsFor(Arrays.asList("k", "k2")); … … 433 433 */ 434 434 @Test 435 publicvoid testAsSet() {435 void testAsSet() { 436 436 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 437 437 Set<Tag> set = d.asSet(); … … 446 446 */ 447 447 @Test 448 publicvoid testAsList() {448 void testAsList() { 449 449 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 450 450 List<Tag> set = d.asList(); … … 459 459 */ 460 460 @Test 461 publicvoid testIterator() {461 void testIterator() { 462 462 TagCollection d = new TagCollection(Arrays.asList(tagA)); 463 463 Iterator<Tag> it = d.iterator(); … … 471 471 */ 472 472 @Test 473 publicvoid testGetKeys() {473 void testGetKeys() { 474 474 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 475 475 Set<String> set = d.getKeys(); … … 483 483 */ 484 484 @Test 485 publicvoid testGetKeysWithMultipleValues() {485 void testGetKeysWithMultipleValues() { 486 486 TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC)); 487 487 Set<String> set = d.getKeysWithMultipleValues(); … … 494 494 */ 495 495 @Test 496 publicvoid testSetUniqueForKeyTag() {496 void testSetUniqueForKeyTag() { 497 497 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC)); 498 498 assertTagCounts(d, 2, 1, 2, 0); … … 505 505 */ 506 506 @Test 507 publicvoid testSetUniqueForKeyStringString() {507 void testSetUniqueForKeyStringString() { 508 508 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC)); 509 509 assertTagCounts(d, 2, 1, 2, 0); … … 516 516 */ 517 517 @Test 518 publicvoid testGetValues() {518 void testGetValues() { 519 519 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagEmpty)); 520 520 Set<String> set = d.getValues(); … … 529 529 */ 530 530 @Test 531 publicvoid testGetValuesString() {531 void testGetValuesString() { 532 532 TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagC, tagEmpty)); 533 533 Set<String> set = d.getValues("k"); … … 541 541 */ 542 542 @Test 543 publicvoid testIsApplicableToPrimitive() {543 void testIsApplicableToPrimitive() { 544 544 TagCollection c = new TagCollection(); 545 545 assertTrue(c.isApplicableToPrimitive()); … … 554 554 */ 555 555 @Test 556 publicvoid testApplyToTagged() {556 void testApplyToTagged() { 557 557 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 558 558 NodeData tagged = new NodeData(); … … 572 572 */ 573 573 @Test 574 publicvoid testApplyToCollectionOfQextendsTagged() {574 void testApplyToCollectionOfQextendsTagged() { 575 575 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 576 576 NodeData tagged = new NodeData(); … … 590 590 */ 591 591 @Test 592 publicvoid testReplaceTagsOfTagged() {592 void testReplaceTagsOfTagged() { 593 593 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 594 594 NodeData tagged = new NodeData(); … … 605 605 */ 606 606 @Test 607 publicvoid testReplaceTagsOfCollectionOfQextendsTagged() {607 void testReplaceTagsOfCollectionOfQextendsTagged() { 608 608 TagCollection c = new TagCollection(Arrays.asList(tagA, tagC)); 609 609 NodeData tagged = new NodeData(); … … 623 623 */ 624 624 @Test 625 publicvoid testIntersect() {625 void testIntersect() { 626 626 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 627 627 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 636 636 */ 637 637 @Test 638 publicvoid testMinus() {638 void testMinus() { 639 639 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 640 640 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 649 649 */ 650 650 @Test 651 publicvoid testUnion() {651 void testUnion() { 652 652 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 653 653 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 664 664 */ 665 665 @Test 666 publicvoid testEmptyTagsForKeysMissingIn() {666 void testEmptyTagsForKeysMissingIn() { 667 667 TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty)); 668 668 TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD)); … … 677 677 */ 678 678 @Test 679 publicvoid testGetJoinedValues() {679 void testGetJoinedValues() { 680 680 TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "a"))); 681 681 assertEquals("a", c.getJoinedValues("k")); … … 696 696 */ 697 697 @Test 698 publicvoid testGetSummedValues() {698 void testGetSummedValues() { 699 699 TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "10"), new Tag("k", "20"))); 700 700 assertEquals("30", c.getSummedValues("k")); … … 711 711 */ 712 712 @Test 713 publicvoid testCommonToAllPrimitives() {713 void testCommonToAllPrimitives() { 714 714 Tagged t1 = new Node(); 715 715 t1.put("k1", "10"); -
trunk/test/unit/org/openstreetmap/josm/data/osm/TagMapTest.java
r9969 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 5 6 import org.junit. Test;6 import org.junit.jupiter.api.Test; 7 7 8 8 /** 9 9 * Unit tests of the {@code TagMap} class. 10 10 */ 11 publicclass TagMapTest {11 class TagMapTest { 12 12 13 13 /** … … 15 15 */ 16 16 @Test 17 publicvoid testToString() {17 void testToString() { 18 18 assertEquals("TagMap[]", new TagMap().toString()); 19 19 assertEquals("TagMap[key=val]", new TagMap(new String[]{"key", "val"}).toString()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/UserTest.java
r12750 r17275 2 2 package org.openstreetmap.josm.data.osm; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertSame;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 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 * Tests of {@link User}. 16 16 */ 17 publicclass UserTest {17 class UserTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testCreateOsmUser() {30 void testCreateOsmUser() { 31 31 User user1 = User.createOsmUser(1, "name1"); 32 32 assertEquals(1, user1.getId()); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java
r13907 r17275 9 9 10 10 import org.junit.Assert; 11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 12 13 13 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 14 14 15 publicclass WayDataTest {15 class WayDataTest { 16 16 17 17 @Test 18 18 @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION") 19 publicvoid testSerializationForDragAndDrop() throws Exception {19 void testSerializationForDragAndDrop() throws Exception { 20 20 final WayData data = new WayData(); 21 21 data.setNodeIds(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L)); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java
r10945 r17275 5 5 6 6 import org.junit.Assert; 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.data.coor.LatLon; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 15 15 * Unit tests of the {@code WaySegment} class. 16 16 */ 17 publicclass WaySegmentTest {17 class WaySegmentTest { 18 18 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(); 25 25 26 26 @Test 27 publicvoid testForNodePair() throws Exception {27 void testForNodePair() throws Exception { 28 28 final DataSet ds = new DataSet(); 29 29 final Node n1 = new Node(LatLon.ZERO); -
trunk/test/unit/org/openstreetmap/josm/data/osm/WayTest.java
r17186 r17275 2 2 package org.openstreetmap.josm.data.osm; 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 import static org.junit.jupiter.api.Assertions.assertThrows; 7 8 8 9 import java.util.Arrays; 9 10 import java.util.HashSet; 10 11 11 import org.junit. BeforeClass;12 import org.junit. Test;12 import org.junit.jupiter.api.BeforeAll; 13 import org.junit.jupiter.api.Test; 13 14 import org.openstreetmap.josm.JOSMFixture; 14 15 import org.openstreetmap.josm.data.coor.LatLon; … … 18 19 * @since 11270 19 20 */ 20 publicclass WayTest {21 class WayTest { 21 22 22 23 /** 23 24 * Setup test. 24 25 */ 25 @Before Class26 @BeforeAll 26 27 public static void setUpBeforeClass() { 27 28 JOSMFixture.createUnitTestFixture().init(); … … 32 33 */ 33 34 @Test 34 publicvoid testBBox() {35 void testBBox() { 35 36 DataSet ds = new DataSet(); 36 37 Node n1 = new Node(1); … … 61 62 */ 62 63 @Test 63 publicvoid testRemoveNode() {64 void testRemoveNode() { 64 65 DataSet ds = new DataSet(); 65 66 Node n1 = new Node(1); … … 87 88 way.removeNode(n1); 88 89 assertEquals(Arrays.asList(n2, n3, n4, n2), way.getNodes()); 89 90 90 } 91 91 … … 94 94 */ 95 95 @Test 96 publicvoid testRemoveNodes() {96 void testRemoveNodes() { 97 97 DataSet ds = new DataSet(); 98 98 Node n1 = new Node(1); … … 123 123 * Test that {@link Way#cloneFrom} throws IAE for invalid arguments 124 124 */ 125 @Test (expected = IllegalArgumentException.class)126 publicvoid testCloneFromIAE() {127 new Way().cloneFrom(new Node());125 @Test 126 void testCloneFromIAE() { 127 assertThrows(IllegalArgumentException.class, () -> new Way().cloneFrom(new Node())); 128 128 } 129 129 … … 131 131 * Test that {@link Way#load} throws IAE for invalid arguments 132 132 */ 133 @Test (expected = IllegalArgumentException.class)134 publicvoid testLoadIAE() {135 new Way().load(new NodeData());133 @Test 134 void testLoadIAE() { 135 assertThrows(IllegalArgumentException.class, () -> new Way().load(new NodeData())); 136 136 } 137 137 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 ChangesetIdChangedEvent} class. 14 14 */ 15 publicclass ChangesetIdChangedEventTest {15 class ChangesetIdChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("CHANGESET_ID_CHANGED", new ChangesetIdChangedEvent(null, null, 0, 0).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 DataChangedEvent} class. 14 14 */ 15 publicclass DataChangedEventTest {15 class DataChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("DATA_CHANGED", new DataChangedEvent(null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceAddedEventTest.java
r15609 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 3 3 4 import static org.junit. Assert.assertSame;5 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 6 7 7 import java.util.Collections; 8 8 import java.util.stream.Stream; 9 9 10 import org.junit. Test;10 import org.junit.jupiter.api.Test; 11 11 import org.openstreetmap.josm.data.Bounds; 12 12 import org.openstreetmap.josm.data.DataSource; … … 19 19 * @author Taylor Smock 20 20 */ 21 publicclass DataSourceAddedEventTest {21 class DataSourceAddedEventTest { 22 22 /** 23 23 * Get getting the originating data source 24 24 */ 25 25 @Test 26 publicvoid testGetDataEventSource() {26 void testGetDataEventSource() { 27 27 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 28 28 DataSet ds = new DataSet(); … … 34 34 */ 35 35 @Test 36 publicvoid testGetAddedSource() {36 void testGetAddedSource() { 37 37 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 38 38 assertTrue( … … 49 49 */ 50 50 @Test 51 publicvoid testGetRemovedSource() {51 void testGetRemovedSource() { 52 52 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 53 53 assertTrue( … … 64 64 */ 65 65 @Test 66 publicvoid testGetDataSources() {66 void testGetDataSources() { 67 67 DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 68 68 DataSourceChangeEvent event = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(), … … 76 76 */ 77 77 @Test 78 publicvoid testToString() {78 void testToString() { 79 79 String toString = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString(); 80 80 assertTrue(toString.contains("added")); -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceRemovedEventTest.java
r15609 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertSame;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertSame; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.util.Collections; 9 9 import java.util.stream.Stream; 10 10 11 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.data.Bounds; 13 13 import org.openstreetmap.josm.data.DataSource; … … 21 21 */ 22 22 23 publicclass DataSourceRemovedEventTest {23 class DataSourceRemovedEventTest { 24 24 /** 25 25 * Get getting the originating data source 26 26 */ 27 27 @Test 28 publicvoid testGetDataEventSource() {28 void testGetDataEventSource() { 29 29 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 30 30 DataSet ds = new DataSet(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetAddedSource() {38 void testGetAddedSource() { 39 39 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 40 40 assertTrue( … … 51 51 */ 52 52 @Test 53 publicvoid testGetRemovedSource() {53 void testGetRemovedSource() { 54 54 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 55 55 assertTrue(new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).getRemoved() … … 66 66 */ 67 67 @Test 68 publicvoid testGetDataSources() {68 void testGetDataSources() { 69 69 DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source"); 70 70 DataSourceChangeEvent event = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), … … 83 83 */ 84 84 @Test 85 publicvoid testToString() {85 void testToString() { 86 86 String toString = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString(); 87 87 assertTrue(toString.contains("added")); -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 NodeMovedEvent} class. 14 14 */ 15 publicclass NodeMovedEventTest {15 class NodeMovedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("NODE_MOVED", new NodeMovedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 PrimitiveFlagsChangedEvent} class. 14 14 */ 15 publicclass PrimitiveFlagsChangedEventTest {15 class PrimitiveFlagsChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("PRIMITIVE_FLAGS_CHANGED", new PrimitiveFlagsChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.Collections; 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 of {@link PrimitivesAddedEvent} class. 16 16 */ 17 publicclass PrimitivesAddedEventTest {17 class PrimitivesAddedEventTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testToString() {30 void testToString() { 31 31 assertEquals("PRIMITIVES_ADDED", new PrimitivesAddedEvent(null, Collections.emptyList(), false).toString()); 32 32 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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.Collections; 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 of {@link PrimitivesRemovedEvent} class. 16 16 */ 17 publicclass PrimitivesRemovedEventTest {17 class PrimitivesRemovedEventTest { 18 18 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(); … … 28 28 */ 29 29 @Test 30 publicvoid testToString() {30 void testToString() { 31 31 assertEquals("PRIMITIVES_REMOVED", new PrimitivesRemovedEvent(null, Collections.emptyList(), false).toString()); 32 32 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 RelationMembersChangedEvent} class. 14 14 */ 15 publicclass RelationMembersChangedEventTest {15 class RelationMembersChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("RELATION_MEMBERS_CHANGED", new RelationMembersChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java
r14247 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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; … … 9 9 import java.util.List; 10 10 11 import org.junit. Rule;12 import org.junit. Test;11 import org.junit.jupiter.api.Test; 12 import org.junit.jupiter.api.extension.RegisterExtension; 13 13 import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation; 14 14 import org.openstreetmap.josm.data.osm.DataSelectionListener; … … 25 25 * @since 12048 26 26 */ 27 publicclass SelectionEventManagerTest {27 class SelectionEventManagerTest { 28 28 private final class SelectionListener implements DataSelectionListener { 29 29 private Collection<? extends OsmPrimitive> newSelection; … … 42 42 /** 43 43 */ 44 @R ule44 @RegisterExtension 45 45 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 46 46 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 50 50 */ 51 51 @Test 52 publicvoid testEventPropagation() {52 void testEventPropagation() { 53 53 // automatically adds the layers 54 54 CommandTestDataWithRelation testData1 = new CommandTestDataWithRelation(); … … 99 99 GuiHelper.runInEDTAndWait(() -> { }); 100 100 for (SelectionListener listener : listeners) { 101 assertEquals( listener.name, should, listener.newSelection);101 assertEquals(should, listener.newSelection, listener.name); 102 102 listener.newSelection = null; 103 103 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 TagsChangedEvent} class. 14 14 */ 15 publicclass TagsChangedEventTest {15 class TagsChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("TAGS_CHANGED", new TagsChangedEvent(null, null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java
r11928 r17275 2 2 package org.openstreetmap.josm.data.osm.event; 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 WayNodesChangedEvent} class. 14 14 */ 15 publicclass WayNodesChangedEventTest {15 class WayNodesChangedEventTest { 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 testToString() {28 void testToString() { 29 29 assertEquals("WAY_NODES_CHANGED", new WayNodesChangedEvent(null, null).toString()); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java
r12663 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 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.util.Date; … … 9 9 import java.util.Map; 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.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DefaultNameFormatter; … … 23 23 * Unit tests for class {@link HistoryNode}. 24 24 */ 25 publicclass HistoryNodeTest {25 class HistoryNodeTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 48 48 */ 49 49 @Test 50 publicvoid testHistoryNode() {50 void testHistoryNode() { 51 51 Date d = new Date(); 52 52 HistoryNode node = create(d); … … 65 65 */ 66 66 @Test 67 publicvoid testGetType() {67 void testGetType() { 68 68 assertEquals(OsmPrimitiveType.NODE, create(new Date()).getType()); 69 69 } … … 73 73 */ 74 74 @Test 75 publicvoid testGetCoords() {75 void testGetCoords() { 76 76 Node n = new Node(new LatLon(45, 0)); 77 77 n.setOsmId(1, 2); … … 85 85 */ 86 86 @Test 87 publicvoid testGetDisplayName() {87 void testGetDisplayName() { 88 88 HistoryNode node = create(new Date()); 89 89 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java
r12663 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 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.util.Date; … … 9 9 import java.util.Map; 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.DefaultNameFormatter; 14 14 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 22 22 * Unit tests for class {@link HistoryRelation}. 23 23 */ 24 publicclass HistoryRelationTest {24 class HistoryRelationTest { 25 25 26 26 /** 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules test = new JOSMTestRules(); … … 46 46 */ 47 47 @Test 48 publicvoid testHistoryRelation() {48 void testHistoryRelation() { 49 49 Date d = new Date(); 50 50 HistoryRelation rel = create(d); … … 63 63 */ 64 64 @Test 65 publicvoid testGetType() {65 void testGetType() { 66 66 assertEquals(OsmPrimitiveType.RELATION, create(new Date()).getType()); 67 67 } … … 71 71 */ 72 72 @Test 73 publicvoid testGetDisplayName() {73 void testGetDisplayName() { 74 74 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 75 75 HistoryRelation rel0 = create(new Date()); // 0 member -
trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java
r16445 r17275 2 2 package org.openstreetmap.josm.data.osm.history; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;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.fail; 7 7 8 8 import java.util.Date; … … 11 11 import java.util.Map; 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.DefaultNameFormatter; 16 16 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 24 24 * Unit tests for class {@link HistoryWay}. 25 25 */ 26 publicclass HistoryWayTest {26 class HistoryWayTest { 27 27 28 28 /** 29 29 * Setup test. 30 30 */ 31 @R ule31 @RegisterExtension 32 32 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 33 33 public JOSMTestRules test = new JOSMTestRules(); … … 48 48 */ 49 49 @Test 50 publicvoid testHistoryWay() {50 void testHistoryWay() { 51 51 Date d = new Date(); 52 52 HistoryWay way = create(d); … … 67 67 */ 68 68 @Test 69 publicvoid testGetType() {69 void testGetType() { 70 70 assertEquals(OsmPrimitiveType.WAY, create(new Date()).getType()); 71 71 } 72 72 73 73 @Test 74 publicvoid testNodeManipulation() {74 void testNodeManipulation() { 75 75 HistoryWay way = create(new Date()); 76 76 … … 92 92 93 93 @Test 94 publicvoid testIterating() {94 void testIterating() { 95 95 HistoryWay way = create(new Date()); 96 96 … … 108 108 */ 109 109 @Test 110 publicvoid testGetDisplayName() {110 void testGetDisplayName() { 111 111 HistoryNameFormatter hnf = DefaultNameFormatter.getInstance(); 112 112 HistoryWay way0 = create(new Date()); // no node -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java
r12656 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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; 7 7 import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token; … … 13 13 * Unit tests for class {@link SearchCompiler}. 14 14 */ 15 publicclass PushbackTokenizerTest {15 class PushbackTokenizerTest { 16 16 17 17 /** 18 18 * Setup rules. 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 testEnumToken() {28 void testEnumToken() { 29 29 TestUtils.superficialEnumCodeCoverage(Token.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java
r17114 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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 4 import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertFalse; 7 import static org.junit.jupiter.api.Assertions.assertNotNull; 9 8 import static org.junit.jupiter.api.Assertions.assertThrows; 9 import static org.junit.jupiter.api.Assertions.assertTrue; 10 10 11 11 import java.lang.reflect.Field; … … 19 19 20 20 import org.junit.Assert; 21 import org.junit. Rule;22 import org.junit. Test;21 import org.junit.jupiter.api.Test; 22 import org.junit.jupiter.api.extension.RegisterExtension; 23 23 import org.openstreetmap.josm.TestUtils; 24 24 import org.openstreetmap.josm.data.coor.LatLon; … … 53 53 * Unit tests for class {@link SearchCompiler}. 54 54 */ 55 publicclass SearchCompilerTest {55 class SearchCompilerTest { 56 56 57 57 /** 58 58 * We need prefs for this. We access preferences when creating OSM primitives. 59 59 */ 60 @R ule60 @RegisterExtension 61 61 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 62 62 public JOSMTestRules test = new JOSMTestRules().preferences().timeout(30000); … … 95 95 private void match(OsmPrimitive p, boolean cond) { 96 96 if (cond) { 97 assertTrue( p.toString(), m.match(p));98 assertFalse( p.toString(), n.match(p));97 assertTrue(m.match(p), p::toString); 98 assertFalse(n.match(p), p::toString); 99 99 } else { 100 assertFalse( p.toString(), m.match(p));101 assertTrue( p.toString(), n.match(p));100 assertFalse(m.match(p), p::toString); 101 assertTrue(n.match(p), p::toString); 102 102 } 103 103 } … … 109 109 */ 110 110 @Test 111 publicvoid testAny() throws SearchParseError {111 void testAny() throws SearchParseError { 112 112 final SearchCompiler.Match c = SearchCompiler.compile("foo"); 113 113 assertTrue(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 122 122 */ 123 123 @Test 124 publicvoid testEquals() throws SearchParseError {124 void testEquals() throws SearchParseError { 125 125 final SearchCompiler.Match c = SearchCompiler.compile("foo=bar"); 126 126 assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 136 136 */ 137 137 @Test 138 publicvoid testRegexp() throws SearchParseError {138 void testRegexp() throws SearchParseError { 139 139 final SearchCompiler.Match c = SearchCompiler.compile("foo~[Bb]a[rz]"); 140 140 assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true"))); … … 151 151 */ 152 152 @Test 153 publicvoid testCompare() throws SearchParseError {153 void testCompare() throws SearchParseError { 154 154 final SearchCompiler.Match c1 = SearchCompiler.compile("start_date>1950"); 155 155 assertTrue(c1.match(OsmUtils.createPrimitive("node start_date=1950-01-01"))); … … 191 191 */ 192 192 @Test 193 publicvoid testNth() throws SearchParseError {193 void testNth() throws SearchParseError { 194 194 final DataSet dataSet = new DataSet(); 195 195 final Way way = new Way(); … … 219 219 */ 220 220 @Test 221 publicvoid testNthParseNegative() throws SearchParseError {221 void testNthParseNegative() throws SearchParseError { 222 222 assertEquals("Nth{nth=-1, modulo=false}", SearchCompiler.compile("nth:-1").toString()); 223 223 } … … 228 228 */ 229 229 @Test 230 publicvoid testModified() throws SearchParseError {230 void testModified() throws SearchParseError { 231 231 SearchContext sc = new SearchContext("modified"); 232 232 // Not modified but new 233 233 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 234 assertFalse(p. toString(), p.isModified());235 assertTrue(p. toString(), p.isNewOrUndeleted());234 assertFalse(p.isModified(), p::toString); 235 assertTrue(p.isNewOrUndeleted(), p::toString); 236 236 sc.match(p, true); 237 237 } … … 239 239 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 240 240 p.setModified(true); 241 assertTrue(p. toString(), p.isModified());242 assertTrue(p. toString(), p.isNewOrUndeleted());241 assertTrue(p.isModified(), p::toString); 242 assertTrue(p.isNewOrUndeleted(), p::toString); 243 243 sc.match(p, true); 244 244 } … … 246 246 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 247 247 p.setOsmId(1, 1); 248 assertTrue(p. toString(), p.isModified());249 assertFalse(p. toString(), p.isNewOrUndeleted());248 assertTrue(p.isModified(), p::toString); 249 assertFalse(p.isNewOrUndeleted(), p::toString); 250 250 sc.match(p, true); 251 251 } … … 253 253 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 254 254 p.setOsmId(2, 2); 255 assertFalse(p. toString(), p.isModified());256 assertFalse(p. toString(), p.isNewOrUndeleted());255 assertFalse(p.isModified(), p::toString); 256 assertFalse(p.isNewOrUndeleted(), p::toString); 257 257 sc.match(p, false); 258 258 } … … 264 264 */ 265 265 @Test 266 publicvoid testSelected() throws SearchParseError {266 void testSelected() throws SearchParseError { 267 267 SearchContext sc = new SearchContext("selected"); 268 268 // Not selected 269 269 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 270 assertFalse(p. toString(), p.isSelected());270 assertFalse(p.isSelected(), p::toString); 271 271 sc.match(p, false); 272 272 } … … 274 274 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 275 275 sc.ds.addSelected(p); 276 assertTrue(p. toString(), p.isSelected());276 assertTrue(p.isSelected(), p::toString); 277 277 sc.match(p, true); 278 278 } … … 284 284 */ 285 285 @Test 286 publicvoid testIncomplete() throws SearchParseError {286 void testIncomplete() throws SearchParseError { 287 287 SearchContext sc = new SearchContext("incomplete"); 288 288 // Not incomplete 289 289 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 290 assertFalse(p. toString(), p.isIncomplete());290 assertFalse(p.isIncomplete(), p::toString); 291 291 sc.match(p, false); 292 292 } … … 300 300 sc.r2.load(rd); 301 301 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 302 assertTrue(p. toString(), p.isIncomplete());302 assertTrue(p.isIncomplete(), p::toString); 303 303 sc.match(p, true); 304 304 } … … 310 310 */ 311 311 @Test 312 publicvoid testUntagged() throws SearchParseError {312 void testUntagged() throws SearchParseError { 313 313 SearchContext sc = new SearchContext("untagged"); 314 314 // Untagged 315 315 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 316 assertFalse(p. toString(), p.isTagged());316 assertFalse(p.isTagged(), p::toString); 317 317 sc.match(p, true); 318 318 } … … 320 320 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 321 321 p.put("foo", "bar"); 322 assertTrue(p. toString(), p.isTagged());322 assertTrue(p.isTagged(), p::toString); 323 323 sc.match(p, false); 324 324 } … … 330 330 */ 331 331 @Test 332 publicvoid testClosed() throws SearchParseError {332 void testClosed() throws SearchParseError { 333 333 SearchContext sc = new SearchContext("closed"); 334 334 // Closed 335 335 sc.w1.addNode(sc.n1); 336 336 for (Way w : new Way[]{sc.w1}) { 337 assertTrue(w. toString(), w.isClosed());337 assertTrue(w.isClosed(), w::toString); 338 338 sc.match(w, true); 339 339 } … … 349 349 */ 350 350 @Test 351 publicvoid testNew() throws SearchParseError {351 void testNew() throws SearchParseError { 352 352 SearchContext sc = new SearchContext("new"); 353 353 // New 354 354 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) { 355 assertTrue(p. toString(), p.isNew());355 assertTrue(p.isNew(), p::toString); 356 356 sc.match(p, true); 357 357 } … … 359 359 for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) { 360 360 p.setOsmId(2, 2); 361 assertFalse(p. toString(), p.isNew());361 assertFalse(p.isNew(), p::toString); 362 362 sc.match(p, false); 363 363 } … … 369 369 */ 370 370 @Test 371 publicvoid testTypeNode() throws SearchParseError {371 void testTypeNode() throws SearchParseError { 372 372 final SearchContext sc = new SearchContext("type:node"); 373 373 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 381 381 */ 382 382 @Test 383 publicvoid testTypeWay() throws SearchParseError {383 void testTypeWay() throws SearchParseError { 384 384 final SearchContext sc = new SearchContext("type:way"); 385 385 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 393 393 */ 394 394 @Test 395 publicvoid testTypeRelation() throws SearchParseError {395 void testTypeRelation() throws SearchParseError { 396 396 final SearchContext sc = new SearchContext("type:relation"); 397 397 for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) { … … 405 405 */ 406 406 @Test 407 publicvoid testUser() throws SearchParseError {407 void testUser() throws SearchParseError { 408 408 final SearchContext foobar = new SearchContext("user:foobar"); 409 409 foobar.n1.setUser(User.createLocalUser("foobar")); … … 421 421 */ 422 422 @Test 423 publicvoid testFooTypeBar() throws SearchParseError {423 void testFooTypeBar() throws SearchParseError { 424 424 Exception e = assertThrows(SearchParseError.class, () -> SearchCompiler.compile("foo type bar")); 425 425 assertEquals("<html>Expecting <code>:</code> after <i>type</i></html>", e.getMessage()); … … 431 431 */ 432 432 @Test 433 publicvoid testTimestamp() throws SearchParseError {433 void testTimestamp() throws SearchParseError { 434 434 final Node n1 = new Node(); 435 435 n1.setTimestamp(DateUtils.fromString("2010-01-22")); … … 448 448 */ 449 449 @Test 450 publicvoid testBooleanLogic() throws SearchParseError {450 void testBooleanLogic() throws SearchParseError { 451 451 final SearchCompiler.Match c1 = SearchCompiler.compile("foo AND bar AND baz"); 452 452 assertTrue(c1.match(OsmUtils.createPrimitive("node foobar=baz"))); … … 471 471 */ 472 472 @Test 473 publicvoid testBuildSearchStringForTag() throws SearchParseError {473 void testBuildSearchStringForTag() throws SearchParseError { 474 474 final Tag tag1 = new Tag("foo=", "bar\""); 475 475 final Tag tag2 = new Tag("foo=", "=bar"); … … 486 486 /** 487 487 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13870">Bug #13870</a>. 488 * @throws SearchParseError always 489 */ 490 @Test(expected = SearchParseError.class) 491 public void testPattern13870() throws SearchParseError { 488 */ 489 @Test 490 void testPattern13870() { 492 491 // https://bugs.openjdk.java.net/browse/JI-9044959 493 492 SearchSetting setting = new SearchSetting(); 494 493 setting.regexSearch = true; 495 494 setting.text = "["; 496 SearchCompiler.compile(setting);495 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting)); 497 496 } 498 497 … … 502 501 */ 503 502 @Test 504 publicvoid testTicket14217() throws Exception {503 void testTicket14217() throws Exception { 505 504 assertNotNull(SearchCompiler.compile(new String(Files.readAllBytes( 506 505 Paths.get(TestUtils.getRegressionDataFile(14217, "filter.txt"))), StandardCharsets.UTF_8))); … … 509 508 /** 510 509 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/17112">Bug #17112</a>. 511 * @throws SearchParseError always 512 */ 513 @Test(expected = SearchParseError.class) 514 public void testTicket17112() throws SearchParseError { 510 */ 511 @Test 512 void testTicket17112() { 515 513 SearchSetting setting = new SearchSetting(); 516 514 setting.mapCSSSearch = true; 517 515 setting.text = "w"; // partial input 518 SearchCompiler.compile(setting);516 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting)); 519 517 } 520 518 … … 524 522 */ 525 523 @Test 526 publicvoid testEmptyValues15943() throws SearchParseError {524 void testEmptyValues15943() throws SearchParseError { 527 525 Match matcher = SearchCompiler.compile("access="); 528 526 assertTrue(matcher.match(new Tag("access", null))); … … 536 534 */ 537 535 @Test 538 publicvoid testKeyExists15943() throws SearchParseError {536 void testKeyExists15943() throws SearchParseError { 539 537 Match matcher = SearchCompiler.compile("surface:"); 540 538 assertTrue(matcher.match(new Tag("surface", ""))); … … 549 547 */ 550 548 @Test 551 publicvoid testEnumExactKeyValueMode() {549 void testEnumExactKeyValueMode() { 552 550 assertDoesNotThrow(() -> TestUtils.superficialEnumCodeCoverage(ExactKeyValue.Mode.class)); 553 551 } … … 555 553 /** 556 554 * Robustness test for preset searching. Ensures that the query 'preset:' is not accepted. 557 * @throws SearchParseError always558 555 * @since 12464 559 556 */ 560 @Test (expected = SearchParseError.class)561 public void testPresetSearchMissingValue() throws SearchParseError{557 @Test 558 void testPresetSearchMissingValue() { 562 559 SearchSetting settings = new SearchSetting(); 563 560 settings.text = "preset:"; … … 566 563 TaggingPresets.readFromPreferences(); 567 564 568 SearchCompiler.compile(settings);565 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings)); 569 566 } 570 567 … … 572 569 * Robustness test for preset searching. Validates that it is not possible to search for 573 570 * non existing presets. 574 * @throws SearchParseError always575 571 * @since 12464 576 572 */ 577 @Test (expected = SearchParseError.class)578 public void testPresetNotExist() throws SearchParseError{573 @Test 574 void testPresetNotExist() { 579 575 String testPresetName = "groupnamethatshouldnotexist/namethatshouldnotexist"; 580 576 SearchSetting settings = new SearchSetting(); … … 585 581 TaggingPresets.readFromPreferences(); 586 582 587 SearchCompiler.compile(settings);583 assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings)); 588 584 } 589 585 … … 591 587 * Robustness tests for preset searching. Ensures that combined preset names (having more than 592 588 * 1 word) must be enclosed with " . 593 * @throws SearchParseError always594 589 * @since 12464 595 590 */ 596 @Test (expected = SearchParseError.class)597 public void testPresetMultipleWords() throws SearchParseError{591 @Test 592 void testPresetMultipleWords() { 598 593 TaggingPreset testPreset = new TaggingPreset(); 599 594 testPreset.name = "Test Combined Preset Name"; … … 609 604 TaggingPresets.readFromPreferences(); 610 605 611 SearchCompiler.compile(settings);606 assertThrows(IllegalArgumentException.class, () -> SearchCompiler.compile(settings)); 612 607 } 613 608 … … 621 616 */ 622 617 @Test 623 publicvoid testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException {618 void testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException { 624 619 TaggingPreset testPreset = new TaggingPreset(); 625 620 testPreset.name = "Test Preset Name"; … … 660 655 */ 661 656 @Test 662 publicvoid testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException {657 void testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException { 663 658 TaggingPresetMenu group = new TaggingPresetMenu(); 664 659 group.name = "TestPresetGroup"; … … 705 700 */ 706 701 @Test 707 publicvoid testPreset() throws SearchParseError {702 void testPreset() throws SearchParseError { 708 703 final String presetName = "Test Preset Name"; 709 704 final String presetGroupName = "Test Preset Group"; … … 744 739 */ 745 740 @Test 746 publicvoid testEqualsContract() {741 void testEqualsContract() { 747 742 TestUtils.assumeWorkingEqualsVerifier(); 748 743 Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class); … … 768 763 */ 769 764 @Test 770 publicvoid testNodeCount() throws SearchParseError {765 void testNodeCount() throws SearchParseError { 771 766 final SearchContext sc = new SearchContext("nodes:2"); 772 767 sc.match(sc.n1, false); … … 784 779 */ 785 780 @Test 786 publicvoid testWayCount() throws SearchParseError {781 void testWayCount() throws SearchParseError { 787 782 final SearchContext sc = new SearchContext("ways:2"); 788 783 sc.match(sc.n1, true); … … 800 795 */ 801 796 @Test 802 publicvoid testMemberCount() throws SearchParseError {797 void testMemberCount() throws SearchParseError { 803 798 final SearchContext sc = new SearchContext("members:2"); 804 799 sc.match(sc.n1, false); … … 814 809 */ 815 810 @Test 816 publicvoid testRole() throws SearchParseError {811 void testRole() throws SearchParseError { 817 812 final SearchContext sc = new SearchContext("role:foo"); 818 813 sc.match(sc.r1, false); -
trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java
r12659 r17275 2 2 package org.openstreetmap.josm.data.osm.search; 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; 7 7 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 12 12 * Unit tests for class {@link SearchMode}. 13 13 */ 14 publicclass SearchModeTest {14 class SearchModeTest { 15 15 16 16 /** 17 17 * Setup rules. 18 18 */ 19 @R ule19 @RegisterExtension 20 20 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 21 21 public JOSMTestRules test = new JOSMTestRules(); … … 25 25 */ 26 26 @Test 27 publicvoid testEnumSearchMode() {27 void testEnumSearchMode() { 28 28 TestUtils.superficialEnumCodeCoverage(SearchMode.class); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java
r16445 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertNotNull;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.assertNotNull; 6 import static org.junit.jupiter.api.Assertions.assertNull; 7 import static org.junit.jupiter.api.Assertions.assertTrue; 8 8 9 9 import java.util.Collection; 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.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * Unit tests for class {@link MergeSourceBuildingVisitor}. 27 27 */ 28 publicclass MergeSourceBuildingVisitorTest {28 class MergeSourceBuildingVisitorTest { 29 29 30 30 protected OsmPrimitive lookupByName(Collection<? extends OsmPrimitive> primitives, String name) { … … 39 39 * Setup test. 40 40 */ 41 @R ule41 @RegisterExtension 42 42 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 43 43 public JOSMTestRules test = new JOSMTestRules(); 44 44 45 45 @Test 46 publicvoid testNodes() {46 void testNodes() { 47 47 DataSet source = new DataSet(); 48 48 Node n1 = new Node(1); … … 78 78 79 79 @Test 80 publicvoid testOneWay() {80 void testOneWay() { 81 81 DataSet source = new DataSet(); 82 82 Node n1 = new Node(1); … … 110 110 111 111 @Test 112 publicvoid testOneWayNodesSelectedToo() {112 void testOneWayNodesSelectedToo() { 113 113 DataSet source = new DataSet(); 114 114 Node n1 = new Node(1); … … 142 142 143 143 @Test 144 publicvoid testOneWayIncomplete() {144 void testOneWayIncomplete() { 145 145 DataSet source = new DataSet(); 146 146 Way w1 = new Way(3); … … 160 160 161 161 @Test 162 publicvoid testOneRelationExistingMembersSelected() {162 void testOneRelationExistingMembersSelected() { 163 163 DataSet source = new DataSet(); 164 164 Relation r1 = new Relation(1, 1); … … 219 219 220 220 @Test 221 publicvoid testOneRelationExistingMembersNotSelected() {221 void testOneRelationExistingMembersNotSelected() { 222 222 DataSet source = new DataSet(); 223 223 Relation r1 = new Relation(1, 1); … … 278 278 279 279 @Test 280 publicvoid testOneRelationNewMembersNotSelected() {280 void testOneRelationNewMembersNotSelected() { 281 281 DataSet source = new DataSet(); 282 282 Relation r1 = new Relation(); … … 345 345 346 346 @Test 347 publicvoid testOneRelationExistingRecursive() {347 void testOneRelationExistingRecursive() { 348 348 DataSet source = new DataSet(); 349 349 Relation r1 = new Relation(1, 1); … … 364 364 365 365 @Test 366 publicvoid testOneRelationNewRecursive() {366 void testOneRelationNewRecursive() { 367 367 DataSet source = new DataSet(); 368 368 Relation r1 = new Relation(); … … 384 384 385 385 @Test 386 publicvoid testTwoRelationExistingCircular() {386 void testTwoRelationExistingCircular() { 387 387 DataSet source = new DataSet(); 388 388 Relation r1 = new Relation(1, 1); -
trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererTest.java
r14694 r17275 2 2 package org.openstreetmap.josm.data.osm.visitor.paint; 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 import org.junit. Test;7 import org.junit.jupiter.api.Test; 8 8 import org.openstreetmap.josm.TestUtils; 9 9 import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.StyleRecord; … … 17 17 * @since 12078 18 18 */ 19 publicclass StyledMapRendererTest {19 class StyledMapRendererTest { 20 20 21 21 /** … … 23 23 */ 24 24 @Test 25 publicvoid testFloatToFixed() {25 void testFloatToFixed() { 26 26 long inf = floatToFixedCheckBits(Float.POSITIVE_INFINITY, 24); 27 27 long big = floatToFixedCheckBits(Float.MAX_VALUE, 24); … … 85 85 */ 86 86 @Test 87 publicvoid testEqualsContract() {87 void testEqualsContract() { 88 88 TestUtils.assumeWorkingEqualsVerifier(); 89 89 EqualsVerifier.forClass(StyleRecord.class).usingGetClass() -
trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java
r14119 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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.spi.preferences.Config; 9 9 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 14 14 * Unit tests of {@link JosmUrls} class. 15 15 */ 16 publicclass JosmUrlsTest {16 class JosmUrlsTest { 17 17 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().devAPI(); … … 27 27 */ 28 28 @Test 29 publicvoid testGetBaseUserUrl() {29 void testGetBaseUserUrl() { 30 30 assertEquals("https://api06.dev.openstreetmap.org/user", Config.getUrls().getBaseUserUrl()); 31 31 } -
trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java
r17119 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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.awt.Color; … … 11 11 import javax.swing.UIManager; 12 12 13 import org.junit. Before;14 import org.junit. Rule;15 import org.junit. Test;13 import org.junit.jupiter.api.BeforeEach; 14 import org.junit.jupiter.api.Test; 15 import org.junit.jupiter.api.extension.RegisterExtension; 16 16 import org.openstreetmap.josm.data.Preferences; 17 17 import org.openstreetmap.josm.spi.preferences.Config; … … 24 24 * @author Michael Zangl 25 25 */ 26 publicclass NamedColorPropertyTest {26 class NamedColorPropertyTest { 27 27 /** 28 28 * This is a preference test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 36 36 * Set up test case 37 37 */ 38 @Before 38 @BeforeEach 39 39 public void createTestProperty() { 40 40 base = new NamedColorProperty("test", Color.RED); … … 45 45 */ 46 46 @Test 47 publicvoid testGet() {47 void testGet() { 48 48 assertEquals(Color.RED, base.get()); 49 49 … … 65 65 */ 66 66 @Test 67 publicvoid testPut() {67 void testPut() { 68 68 assertEquals(Color.RED, base.get()); 69 69 … … 80 80 */ 81 81 @Test 82 publicvoid testColorAlpha() {82 void testColorAlpha() { 83 83 assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha()); 84 84 assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar"))); … … 90 90 */ 91 91 @Test 92 publicvoid testColorNameAlpha() {92 void testColorNameAlpha() { 93 93 assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha()); 94 94 } … … 98 98 */ 99 99 @Test 100 publicvoid testGetChildColor() {100 void testGetChildColor() { 101 101 AbstractProperty<Color> child = base.getChildColor("test2"); 102 102 -
trunk/test/unit/org/openstreetmap/josm/data/preferences/PreferencesWriterTest.java
r12884 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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; … … 13 13 import java.util.TreeMap; 14 14 15 import org.junit. Test;15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.data.Version; 17 17 import org.openstreetmap.josm.spi.preferences.Setting; … … 25 25 * Unit tests for class {@link PreferencesWriter}. 26 26 */ 27 publicclass PreferencesWriterTest {27 class PreferencesWriterTest { 28 28 29 29 private static <T extends AbstractSetting<?>> T setting(T s, long time) { … … 37 37 */ 38 38 @Test 39 publicvoid testListList() throws IOException {39 void testListList() throws IOException { 40 40 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 41 41 long time = System.currentTimeMillis() / 1000; … … 56 56 */ 57 57 @Test 58 publicvoid testList() throws IOException {58 void testList() throws IOException { 59 59 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 60 60 long time = System.currentTimeMillis() / 1000; … … 73 73 */ 74 74 @Test 75 publicvoid testMapList() throws IOException {75 void testMapList() throws IOException { 76 76 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 77 77 long time = System.currentTimeMillis() / 1000; … … 94 94 */ 95 95 @Test 96 publicvoid testString() throws IOException {96 void testString() throws IOException { 97 97 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 98 98 long time = System.currentTimeMillis() / 1000; … … 109 109 */ 110 110 @Test 111 publicvoid testWrite() throws IOException {111 void testWrite() throws IOException { 112 112 try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) { 113 113 long time = System.currentTimeMillis() / 1000; … … 132 132 */ 133 133 @Test 134 publicvoid testNullValue() throws IOException {134 void testNullValue() throws IOException { 135 135 long time = System.currentTimeMillis() / 1000; 136 136 // CHECKSTYLE.OFF: LineLength -
trunk/test/unit/org/openstreetmap/josm/data/preferences/StrokePropertyTest.java
r15775 r17275 2 2 package org.openstreetmap.josm.data.preferences; 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.awt.BasicStroke; 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.spi.preferences.Config; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * @author Michael Zangl 19 19 */ 20 publicclass StrokePropertyTest {20 class StrokePropertyTest { 21 21 /** 22 22 * This is a preference test 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testGetValue() {32 void testGetValue() { 33 33 StrokeProperty property = new StrokeProperty("x", "1"); 34 34 … … 75 75 */ 76 76 @Test 77 publicvoid testPutValue() {77 void testPutValue() { 78 78 StrokeProperty property = new StrokeProperty("x", new BasicStroke(12)); 79 79 BasicStroke bs = property.get(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/CustomProjectionTest.java
r13602 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;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.fail; 7 7 8 8 import java.util.stream.Stream; 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.data.coor.LatLon; 13 13 import org.openstreetmap.josm.data.projection.CustomProjection.Polarity; … … 20 20 * @author Michael Zangl 21 21 */ 22 publicclass CustomProjectionTest {22 class CustomProjectionTest { 23 23 /** 24 24 * Need pref to load pref. 25 25 */ 26 @R ule26 @RegisterExtension 27 27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 28 28 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 33 33 */ 34 34 @Test 35 publicvoid testParseAngle() throws ProjectionConfigurationException {35 void testParseAngle() throws ProjectionConfigurationException { 36 36 assertEquals(0, CustomProjection.parseAngle("0", "xxx"), 1e-10); 37 37 assertEquals(1, CustomProjection.parseAngle("1", "xxx"), 1e-10); … … 86 86 */ 87 87 @Test 88 publicvoid testPolarity() {88 void testPolarity() { 89 89 assertEquals(LatLon.NORTH_POLE, Polarity.NORTH.getLatLon()); 90 90 assertEquals(LatLon.SOUTH_POLE, Polarity.SOUTH.getLatLon()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java
r11324 r17275 6 6 7 7 import org.junit.Assert; 8 import org.junit. Test;8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.data.coor.LatLon; 10 10 … … 12 12 * Unit tests for class {@link Ellipsoid}. 13 13 */ 14 publicclass EllipsoidTest {14 class EllipsoidTest { 15 15 16 16 private static final double EPSILON = 1e-8; … … 20 20 */ 21 21 @Test 22 publicvoid testLatLon2Cart2LatLon() {22 void testLatLon2Cart2LatLon() { 23 23 Random r = new SecureRandom(); 24 24 double maxErrLat = 0, maxErrLon = 0; -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java
r16643 r17275 34 34 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 35 35 import org.junit.Assert; 36 import org.junit. Rule;37 import org.junit. Test;36 import org.junit.jupiter.api.extension.RegisterExtension; 37 import org.junit.jupiter.api.Test; 38 38 import org.openstreetmap.josm.data.Bounds; 39 39 import org.openstreetmap.josm.data.coor.EastNorth; … … 59 59 * of the algorithm, given a certain definition. 60 60 */ 61 publicclass ProjectionRefTest {61 class ProjectionRefTest { 62 62 63 63 private static final String CS2CS_EXE = "cs2cs"; … … 86 86 * Setup test. 87 87 */ 88 @R ule88 @RegisterExtension 89 89 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 90 90 public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000); … … 373 373 */ 374 374 @Test 375 publicvoid testProjections() throws IOException {375 void testProjections() throws IOException { 376 376 StringBuilder fail = new StringBuilder(); 377 377 Map<String, Set<String>> failingProjs = new HashMap<>(); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java
r16643 r17275 19 19 import java.util.stream.Collectors; 20 20 21 import org.junit. BeforeClass;22 import org.junit. Test;21 import org.junit.jupiter.api.BeforeAll; 22 import org.junit.jupiter.api.Test; 23 23 import org.openstreetmap.josm.JOSMFixture; 24 24 import org.openstreetmap.josm.data.Bounds; … … 39 39 * test data, by running the main method of this class and commit the new data file. 40 40 */ 41 publicclass ProjectionRegressionTest {41 class ProjectionRegressionTest { 42 42 43 43 private static final String PROJECTION_DATA_FILE = "nodist/data/projection/projection-regression-test-data"; … … 136 136 * Setup test. 137 137 */ 138 @Before Class138 @BeforeAll 139 139 public static void setUp() { 140 140 JOSMFixture.createUnitTestFixture().init(); … … 146 146 */ 147 147 @Test 148 publicvoid testNonRegression() throws IOException {148 void testNonRegression() throws IOException { 149 149 List<TestData> allData = readData(); 150 150 Set<String> dataCodes = allData.stream().map(data -> data.code).collect(Collectors.toSet()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 5 5 6 6 import java.security.SecureRandom; … … 11 11 12 12 import org.junit.Assert; 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.Bounds; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; … … 19 19 * Unit tests for class {@link Projection}. 20 20 */ 21 publicclass ProjectionTest {21 class ProjectionTest { 22 22 23 23 private static final Random rand = new SecureRandom(); … … 30 30 */ 31 31 @Test 32 publicvoid testProjections() {32 void testProjections() { 33 33 error = false; 34 34 text = ""; … … 120 120 */ 121 121 @Test 122 publicvoid testProjs() {122 void testProjs() { 123 123 error2 = false; 124 124 text2 = ""; … … 150 150 Assert.fail(); 151 151 } 152 assertTrue( "missing test: "+projIds, projIds.isEmpty());152 assertTrue(projIds.isEmpty(), "missing test: "+projIds); 153 153 } 154 154 … … 170 170 EastNorth en = p.latlon2eastNorth(ll1); 171 171 LatLon ll2 = p.eastNorth2latlon(en); 172 assertTrue( p.toCode() + " at " + ll1 + " is " + ll2, ll2.isValid());172 assertTrue(ll2.isValid(), p.toCode() + " at " + ll1 + " is " + ll2); 173 173 double dist = ll1.greatCircleDistance(ll2); 174 174 if (dist > eps) { … … 189 189 */ 190 190 @Test 191 publicvoid testSwedishProjections() {191 void testSwedishProjections() { 192 192 for (int code = 3006; code <= 3018; code++) { 193 193 assertTrue(Projections.getProjectionByCode("EPSG:"+code).switchXY()); -
trunk/test/unit/org/openstreetmap/josm/data/projection/ShiftedProjectionTest.java
r12161 r17275 2 2 package org.openstreetmap.josm.data.projection; 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.Comparator; … … 11 11 import java.util.stream.Collectors; 12 12 13 import org.junit. Test;13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.data.ProjectionBounds; 15 15 import org.openstreetmap.josm.data.coor.EastNorth; … … 21 21 * @author Michael Zangl 22 22 */ 23 publicclass ShiftedProjectionTest {23 class ShiftedProjectionTest { 24 24 private static final class ProjectingBase implements Projecting { 25 25 @Override … … 57 57 */ 58 58 @Test 59 publicvoid testLatlon2eastNorth() {59 void testLatlon2eastNorth() { 60 60 Projecting base = new ProjectingBase(); 61 61 … … 81 81 */ 82 82 @Test 83 publicvoid testEastNorth2latlonClamped() {83 void testEastNorth2latlonClamped() { 84 84 Projecting base = new ProjectingBase(); 85 85 … … 105 105 */ 106 106 @Test 107 publicvoid testGetProjectingsForArea() {107 void testGetProjectingsForArea() { 108 108 Projecting base = new ProjectingBase(); 109 109 ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7)); … … 124 124 */ 125 125 @Test 126 publicvoid testGetProjectingsForAreaMultiple() {126 void testGetProjectingsForAreaMultiple() { 127 127 Projecting base = new ProjectingBase(); 128 128 ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7)); -
trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java
r16913 r17275 2 2 package org.openstreetmap.josm.data.projection; 3 3 4 import static org.junit. Assert.assertSame;5 import static org.junit. Assert.assertTrue;6 7 import org.junit. BeforeClass;8 import org.junit. Rule;9 import org.junit. Test;4 import static org.junit.jupiter.api.Assertions.assertSame; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 6 7 import org.junit.jupiter.api.BeforeAll; 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 10 import org.openstreetmap.josm.data.coor.EastNorth; 11 11 import org.openstreetmap.josm.data.coor.LatLon; … … 17 17 * Unit tests for the Swiss projection grid. 18 18 */ 19 publicclass SwissGridTest {19 class SwissGridTest { 20 20 private static final String SWISS_EPSG_CODE = "EPSG:21781"; 21 21 private final boolean debug = false; … … 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().projectionNadGrids(); … … 31 31 * Setup test. 32 32 */ 33 @Before Class33 @BeforeAll 34 34 public static void setUp() { 35 35 ProjectionRegistry.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid … … 79 79 } 80 80 } 81 assertSame(errs. toString(), errs.length(), 0);81 assertSame(errs.length(), 0, errs::toString); 82 82 } 83 83 … … 86 86 */ 87 87 @Test 88 publicvoid testProjReferenceTestAccurate() {88 void testProjReferenceTestAccurate() { 89 89 projReferenceTest(EPSILON_ACCURATE); 90 90 } … … 94 94 */ 95 95 @Test 96 publicvoid testAlatlon2eastNorth() {96 void testAlatlon2eastNorth() { 97 97 LatLon ll = new LatLon(46.518, 6.567); 98 98 EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(ll); … … 100 100 System.out.println(en); 101 101 } 102 assertTrue( "Lausanne", Math.abs(en.east() - 533112.13) < 0.1);103 assertTrue( "Lausanne", Math.abs(en.north() - 152227.35) < 0.1);102 assertTrue(Math.abs(en.east() - 533112.13) < 0.1, "Lausanne"); 103 assertTrue(Math.abs(en.north() - 152227.35) < 0.1, "Lausanne"); 104 104 105 105 ll = new LatLon(47.78, 8.58); … … 108 108 System.out.println(en); 109 109 } 110 assertTrue( "Schafouse", Math.abs(en.east() - 685542.97) < 0.1);111 assertTrue( "Schafouse", Math.abs(en.north() - 292783.21) < 0.1);110 assertTrue(Math.abs(en.east() - 685542.97) < 0.1, "Schafouse"); 111 assertTrue(Math.abs(en.north() - 292783.21) < 0.1, "Schafouse"); 112 112 113 113 ll = new LatLon(46.58, 10.48); … … 116 116 System.out.println(en); 117 117 } 118 assertTrue( "Grinson", Math.abs(en.east() - 833066.95) < 0.1);119 assertTrue( "Grinson", Math.abs(en.north() - 163265.32) < 0.1);118 assertTrue(Math.abs(en.east() - 833066.95) < 0.1, "Grinson"); 119 assertTrue(Math.abs(en.north() - 163265.32) < 0.1, "Grinson"); 120 120 121 121 ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600); … … 124 124 System.out.println(en); 125 125 } 126 assertTrue( "Berne", Math.abs(en.east() - 600000.0) < 0.1);127 assertTrue( "Berne", Math.abs(en.north() - 200000.0) < 0.1);126 assertTrue(Math.abs(en.east() - 600000.0) < 0.1, "Berne"); 127 assertTrue(Math.abs(en.north() - 200000.0) < 0.1, "Berne"); 128 128 129 129 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 … … 133 133 System.out.println(en); 134 134 } 135 assertTrue( "Ref", Math.abs(en.east() - 700000.0) < 0.1);136 assertTrue( "Ref", Math.abs(en.north() - 100000.0) < 0.1);135 assertTrue(Math.abs(en.east() - 700000.0) < 0.1, "Ref"); 136 assertTrue(Math.abs(en.north() - 100000.0) < 0.1, "Ref"); 137 137 } 138 138 … … 141 141 */ 142 142 @Test 143 publicvoid testBeastNorth2latlon() {143 void testBeastNorth2latlon() { 144 144 EastNorth en = new EastNorth(533112.13, 152227.35); 145 145 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); … … 147 147 System.out.println(ll); 148 148 } 149 assertTrue( "Lausanne", Math.abs(ll.lat() - 46.518) < 0.00001);150 assertTrue( "Lausanne", Math.abs(ll.lon() - 6.567) < 0.00001);149 assertTrue(Math.abs(ll.lat() - 46.518) < 0.00001, "Lausanne"); 150 assertTrue(Math.abs(ll.lon() - 6.567) < 0.00001, "Lausanne"); 151 151 152 152 en = new EastNorth(685542.97, 292783.21); … … 155 155 System.out.println(ll); 156 156 } 157 assertTrue( "Schafouse", Math.abs(ll.lat() - 47.78) < 0.00001);158 assertTrue( "Schafouse", Math.abs(ll.lon() - 8.58) < 0.00001);157 assertTrue(Math.abs(ll.lat() - 47.78) < 0.00001, "Schafouse"); 158 assertTrue(Math.abs(ll.lon() - 8.58) < 0.00001, "Schafouse"); 159 159 160 160 en = new EastNorth(833066.95, 163265.32); … … 163 163 System.out.println(ll); 164 164 } 165 assertTrue( "Grinson", Math.abs(ll.lat() - 46.58) < 0.00001);166 assertTrue( "Grinson", Math.abs(ll.lon() - 10.48) < 0.00001);165 assertTrue(Math.abs(ll.lat() - 46.58) < 0.00001, "Grinson"); 166 assertTrue(Math.abs(ll.lon() - 10.48) < 0.00001, "Grinson"); 167 167 168 168 en = new EastNorth(600000.0, 200000.0); … … 171 171 System.out.println(ll); 172 172 } 173 assertTrue( "Berne", Math.abs(ll.lat() - (46.0 + 57.0 / 60 + 3.89813884505 / 3600)) < 0.00001);174 assertTrue( "Berne", Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001);173 assertTrue(Math.abs(ll.lat() - (46.0 + 57.0 / 60 + 3.89813884505 / 3600)) < 0.00001, "Berne"); 174 assertTrue(Math.abs(ll.lon() - (7.0 + 26.0 / 60 + 19.076595154147 / 3600)) < 0.00001, "Berne"); 175 175 176 176 // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000 … … 180 180 System.out.println(ll); 181 181 } 182 assertTrue( "Ref", Math.abs(ll.lat() - 46.04412093223244) < 0.00001);183 assertTrue( "Ref", Math.abs(ll.lon() - 8.730497366167727) < 0.00001);182 assertTrue(Math.abs(ll.lat() - 46.04412093223244) < 0.00001, "Ref"); 183 assertTrue(Math.abs(ll.lon() - 8.730497366167727) < 0.00001, "Ref"); 184 184 } 185 185 … … 188 188 */ 189 189 @Test 190 publicvoid testCsendandreturn() {190 void testCsendandreturn() { 191 191 EastNorth en = new EastNorth(533111.69, 152227.85); 192 192 LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en); … … 198 198 System.out.println(en.north() - en2.north()); 199 199 } 200 assertTrue( "Lausanne", Math.abs(en.east() - en2.east()) < 0.002);201 assertTrue( "Lausanne", Math.abs(en.north() - en2.north()) < 0.002);200 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Lausanne"); 201 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Lausanne"); 202 202 203 203 en = new EastNorth(685544.16, 292782.91); … … 210 210 System.out.println(en.north() - en2.north()); 211 211 } 212 assertTrue( "Schafouse", Math.abs(en.east() - en2.east()) < 0.002);213 assertTrue( "Schafouse", Math.abs(en.north() - en2.north()) < 0.002);212 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Schafouse"); 213 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Schafouse"); 214 214 215 215 en = new EastNorth(833068.04, 163265.39); … … 222 222 System.out.println(en.north() - en2.north()); 223 223 } 224 assertTrue( "Grinson", Math.abs(en.east() - en2.east()) < 0.002);225 assertTrue( "Grinson", Math.abs(en.north() - en2.north()) < 0.002);224 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Grinson"); 225 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Grinson"); 226 226 227 227 en = new EastNorth(600000.0, 200000.0); … … 234 234 System.out.println(en.north() - en2.north()); 235 235 } 236 assertTrue( "Berne", Math.abs(en.east() - en2.east()) < 0.002);237 assertTrue( "Berne", Math.abs(en.north() - en2.north()) < 0.002);236 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Berne"); 237 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Berne"); 238 238 239 239 en = new EastNorth(700000.0, 100000.0); … … 246 246 System.out.println(en.north() - en2.north()); 247 247 } 248 assertTrue( "Ref", Math.abs(en.east() - en2.east()) < 0.002);249 assertTrue( "Ref", Math.abs(en.north() - en2.north()) < 0.002);248 assertTrue(Math.abs(en.east() - en2.east()) < 0.002, "Ref"); 249 assertTrue(Math.abs(en.north() - en2.north()) < 0.002, "Ref"); 250 250 } 251 251 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java
r11931 r17275 2 2 package org.openstreetmap.josm.data.projection.proj; 3 3 4 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertFalse; 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 * Tests for {@link LonLat}. 14 14 */ 15 publicclass LonLatTest {15 class LonLatTest { 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(); … … 25 25 */ 26 26 @Test 27 publicvoid testLonIsLinearToEast() {27 void testLonIsLinearToEast() { 28 28 assertFalse(new LonLat().lonIsLinearToEast()); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java
r11931 r17275 2 2 package org.openstreetmap.josm.data.projection.proj; 3 3 4 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertTrue; 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 * Tests for {@link Mercator}. 14 14 */ 15 publicclass MercatorTest {15 class MercatorTest { 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(); … … 25 25 */ 26 26 @Test 27 publicvoid testLonIsLinearToEast() {27 void testLonIsLinearToEast() { 28 28 assertTrue(new Mercator().lonIsLinearToEast()); 29 29 } -
trunk/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java
r13079 r17275 2 2 package org.openstreetmap.josm.data.tagging.ac; 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 9 9 import java.util.ArrayList; … … 12 12 import java.util.TreeSet; 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.TestUtils; 17 17 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 23 23 * Unit tests of {@link AutoCompletionPriority}. 24 24 */ 25 publicclass AutoCompletionPriorityTest {25 class AutoCompletionPriorityTest { 26 26 27 27 /** 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testGetters() {38 void testGetters() { 39 39 assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInStandard()); 40 40 assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInDataSet()); … … 69 69 */ 70 70 @Test 71 publicvoid testOrdering() {71 void testOrdering() { 72 72 SortedSet<AutoCompletionPriority> set = new TreeSet<>(); 73 73 set.add(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET); … … 96 96 */ 97 97 @Test 98 publicvoid testEqualsContract() {98 void testEqualsContract() { 99 99 TestUtils.assumeWorkingEqualsVerifier(); 100 100 EqualsVerifier.forClass(AutoCompletionPriority.class).usingGetClass() … … 106 106 */ 107 107 @Test 108 publicvoid testToString() {108 void testToString() { 109 109 assertEquals("<Priority; userInput: no, inDataSet: true, inStandard: false, selected: false>", 110 110 AutoCompletionPriority.IS_IN_DATASET.toString()); … … 117 117 */ 118 118 @Test 119 publicvoid testMergeWith() {119 void testMergeWith() { 120 120 assertEquals(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET, 121 121 AutoCompletionPriority.IS_IN_DATASET.mergeWith(AutoCompletionPriority.IS_IN_STANDARD)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java
r16447 r17275 2 2 package org.openstreetmap.josm.data.validation; 3 3 4 import static org.junit. Assert.assertFalse;5 import static org.junit. Assert.assertNotEquals;6 import static org.junit. Assert.assertTrue;4 import static org.junit.jupiter.api.Assertions.assertFalse; 5 import static org.junit.jupiter.api.Assertions.assertNotEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 import org.junit. Before;9 import org.junit. Rule;10 import org.junit. Test;8 import org.junit.jupiter.api.BeforeEach; 9 import org.junit.jupiter.api.Test; 10 import org.junit.jupiter.api.extension.RegisterExtension; 11 11 import org.openstreetmap.josm.data.validation.tests.Addresses; 12 12 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 18 18 * Unit tests for class {@link OsmValidator}. 19 19 */ 20 publicclass OsmValidatorTest {20 class OsmValidatorTest { 21 21 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().projection(); … … 31 31 * @throws Exception if an error occurs 32 32 */ 33 @Before 33 @BeforeEach 34 34 public void setUp() throws Exception { 35 35 OsmValidator.clearIgnoredErrors(); … … 41 41 */ 42 42 @Test 43 publicvoid testUtilityClass() throws ReflectiveOperationException {43 void testUtilityClass() throws ReflectiveOperationException { 44 44 UtilityClassTestUtil.assertUtilityClassWellDefined(OsmValidator.class); 45 45 } … … 49 49 */ 50 50 @Test 51 publicvoid testCleanupIgnoredErrors1() {51 void testCleanupIgnoredErrors1() { 52 52 OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way"); 53 53 OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way"); … … 64 64 */ 65 65 @Test 66 publicvoid testCleanupIgnoredErrorsTicket17837() {66 void testCleanupIgnoredErrorsTicket17837() { 67 67 OsmValidator.addIgnoredError("120"); 68 68 OsmValidator.addIgnoredError("3000"); … … 77 77 */ 78 78 @Test 79 publicvoid testCleanupIgnoredErrorsTicket18223() {79 void testCleanupIgnoredErrorsTicket18223() { 80 80 OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way"); 81 81 OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way"); … … 90 90 */ 91 91 @Test 92 publicvoid testRemoveTests() {92 void testRemoveTests() { 93 93 org.openstreetmap.josm.data.validation.Test test = new org.openstreetmap.josm.data.validation.Test("test") { 94 94 }; -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTest.java
r12620 r17275 22 22 import static org.junit.Assert.assertNull; 23 23 import static org.junit.Assert.assertTrue; 24 import static org.junit. Assert.fail;24 import static org.junit.jupiter.api.Assertions.fail; 25 25 26 26 import java.lang.reflect.Field; … … 28 28 import java.util.Locale; 29 29 30 import org.junit. Before;31 import org.junit. Test;30 import org.junit.jupiter.api.BeforeEach; 31 import org.junit.jupiter.api.Test; 32 32 import org.openstreetmap.josm.data.validation.routines.DomainValidator.ArrayType; 33 33 import org.openstreetmap.josm.tools.Logging; … … 38 38 * @version $Revision: 1741724 $ 39 39 */ 40 publicclass DomainValidatorTest {40 class DomainValidatorTest { 41 41 42 42 private DomainValidator validator; … … 45 45 * Setup test. 46 46 */ 47 @Before 47 @BeforeEach 48 48 public void setUp() { 49 49 validator = DomainValidator.getInstance(); … … 55 55 */ 56 56 @Test 57 publicvoid testValidDomains() {57 void testValidDomains() { 58 58 assertTrue("apache.org should validate", validator.isValid("apache.org")); 59 59 assertTrue("www.google.com should validate", validator.isValid("www.google.com")); … … 75 75 */ 76 76 @Test 77 publicvoid testInvalidDomains() {77 void testInvalidDomains() { 78 78 assertFalse("bare TLD .org shouldn't validate", validator.isValid(".org")); 79 79 assertFalse("domain name with spaces shouldn't validate", validator.isValid(" apache.org ")); … … 94 94 */ 95 95 @Test 96 publicvoid testTopLevelDomains() {96 void testTopLevelDomains() { 97 97 // infrastructure TLDs 98 98 assertTrue(".arpa should validate as iTLD", validator.isValidInfrastructureTld(".arpa")); … … 121 121 */ 122 122 @Test 123 publicvoid testAllowLocal() {123 void testAllowLocal() { 124 124 DomainValidator noLocal = DomainValidator.getInstance(false); 125 125 DomainValidator allowLocal = DomainValidator.getInstance(true); … … 147 147 */ 148 148 @Test 149 publicvoid testIDN() {149 void testIDN() { 150 150 assertTrue("b\u00fccher.ch in IDN should validate", validator.isValid("www.xn--bcher-kva.ch")); 151 151 } … … 155 155 */ 156 156 @Test 157 publicvoid testIDNJava6OrLater() {157 void testIDNJava6OrLater() { 158 158 String version = System.getProperty("java.version"); 159 159 if (version.compareTo("1.6") < 0) { … … 171 171 */ 172 172 @Test 173 publicvoid testRFC2396domainlabel() { // use fixed valid TLD173 void testRFC2396domainlabel() { // use fixed valid TLD 174 174 assertTrue("a.ch should validate", validator.isValid("a.ch")); 175 175 assertTrue("9.ch should validate", validator.isValid("9.ch")); … … 185 185 */ 186 186 @Test 187 publicvoid testRFC2396toplabel() {187 void testRFC2396toplabel() { 188 188 // These tests use non-existent TLDs so currently need to use a package protected method 189 189 assertTrue("a.c (alpha) should validate", validator.isValidDomainSyntax("a.c")); … … 203 203 */ 204 204 @Test 205 publicvoid testDomainNoDots() {205 void testDomainNoDots() { 206 206 assertTrue("a (alpha) should validate", validator.isValidDomainSyntax("a")); 207 207 assertTrue("9 (alphanum) should validate", validator.isValidDomainSyntax("9")); … … 217 217 */ 218 218 @Test 219 publicvoid testValidator297() {219 void testValidator297() { 220 220 assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai")); // This uses a valid TLD 221 221 } … … 226 226 */ 227 227 @Test 228 publicvoid testValidator306() {228 void testValidator306() { 229 229 final String longString = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789A"; 230 230 assertEquals(63, longString.length()); // 26 * 2 + 11 … … 251 251 */ 252 252 @Test 253 publicvoid testUnicodeToASCII() {253 void testUnicodeToASCII() { 254 254 String[] asciidots = { 255 255 "", … … 289 289 */ 290 290 @Test 291 publicvoid test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {291 void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception { 292 292 final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS"); 293 293 assertTrue(sorted); … … 299 299 */ 300 300 @Test 301 publicvoid test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {301 void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception { 302 302 final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS"); 303 303 assertTrue(sorted); … … 309 309 */ 310 310 @Test 311 publicvoid test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {311 void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception { 312 312 final boolean sorted = isSortedLowerCase("GENERIC_TLDS"); 313 313 assertTrue(sorted); … … 319 319 */ 320 320 @Test 321 publicvoid test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {321 void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception { 322 322 final boolean sorted = isSortedLowerCase("LOCAL_TLDS"); 323 323 assertTrue(sorted); … … 328 328 */ 329 329 @Test 330 publicvoid testEnumIsPublic() {330 void testEnumIsPublic() { 331 331 assertTrue(Modifier.isPublic(DomainValidator.ArrayType.class.getModifiers())); 332 332 } … … 336 336 */ 337 337 @Test 338 publicvoid testUpdateBaseArrays() {338 void testUpdateBaseArrays() { 339 339 try { 340 340 DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"}); … … 371 371 */ 372 372 @Test 373 publicvoid testGetArray() {373 void testGetArray() { 374 374 assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS)); 375 375 assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_PLUS)); … … 386 386 */ 387 387 @Test 388 publicvoid testUpdateCountryCode() {388 void testUpdateCountryCode() { 389 389 assertFalse(validator.isValidCountryCodeTld("com")); // cannot be valid 390 390 DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_PLUS, new String[]{"com"}); … … 404 404 */ 405 405 @Test 406 publicvoid testUpdateGeneric() {406 void testUpdateGeneric() { 407 407 assertFalse(validator.isValidGenericTld("ch")); // cannot be valid 408 408 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); … … 422 422 */ 423 423 @Test 424 publicvoid testCannotUpdate() {424 void testCannotUpdate() { 425 425 DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); // OK 426 426 DomainValidator dv = DomainValidator.getInstance(); … … 484 484 */ 485 485 @Test 486 publicvoid testValidatorName() {486 void testValidatorName() { 487 487 assertNull(DomainValidator.getInstance().getValidatorName()); 488 488 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java
r16765 r17275 47 47 import java.util.regex.Pattern; 48 48 49 import org.junit. Rule;50 import org.junit. Test;49 import org.junit.jupiter.api.extension.RegisterExtension; 50 import org.junit.jupiter.api.Test; 51 51 import org.openstreetmap.josm.testutils.JOSMTestRules; 52 52 import org.openstreetmap.josm.tools.Logging; … … 59 59 * @version $Revision: 1723861 $ 60 60 */ 61 publicclass DomainValidatorTestIT {61 class DomainValidatorTestIT { 62 62 63 63 /** 64 64 * Setup rule 65 65 */ 66 @R ule66 @RegisterExtension 67 67 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 68 68 public JOSMTestRules test = new JOSMTestRules().https(); … … 75 75 */ 76 76 @Test 77 publicvoid testIanaTldList() throws Exception {77 void testIanaTldList() throws Exception { 78 78 // Check the arrays first as this affects later checks 79 79 // Doing this here makes it easier when updating the lists -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java
r10378 r17275 21 21 import static org.junit.Assert.assertTrue; 22 22 23 import org.junit. Before;24 import org.junit. Ignore;25 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Disabled; 25 import org.junit.jupiter.api.Test; 26 26 27 27 /** … … 31 31 * @version $Revision: 1741724 $ 32 32 */ 33 publicclass EmailValidatorTest {33 class EmailValidatorTest { 34 34 35 35 /** … … 49 49 * Setup 50 50 */ 51 @Before 51 @BeforeEach 52 52 public void setUp() { 53 53 validator = EmailValidator.getInstance(); … … 58 58 */ 59 59 @Test 60 publicvoid testEmail() {60 void testEmail() { 61 61 assertTrue(validator.isValid("jsmith@apache.org")); 62 62 assertFalse(validator.isValid(null)); … … 67 67 */ 68 68 @Test 69 publicvoid testEmailWithNumericAddress() {69 void testEmailWithNumericAddress() { 70 70 assertTrue(validator.isValid("someone@[216.109.118.76]")); 71 71 assertTrue(validator.isValid("someone@yahoo.com")); … … 76 76 */ 77 77 @Test 78 publicvoid testEmailExtension() {78 void testEmailExtension() { 79 79 assertTrue(validator.isValid("jsmith@apache.org")); 80 80 … … 99 99 */ 100 100 @Test 101 publicvoid testEmailWithDash() {101 void testEmailWithDash() { 102 102 assertTrue(validator.isValid("andy.noble@data-workshop.com")); 103 103 … … 114 114 */ 115 115 @Test 116 publicvoid testEmailWithDotEnd() {116 void testEmailWithDotEnd() { 117 117 assertFalse(validator.isValid("andy.noble@data-workshop.com.")); 118 118 } … … 123 123 */ 124 124 @Test 125 publicvoid testEmailWithBogusCharacter() {125 void testEmailWithBogusCharacter() { 126 126 127 127 assertFalse(validator.isValid("andy.noble@\u008fdata-workshop.com")); … … 148 148 */ 149 149 @Test 150 publicvoid testVALIDATOR_315() {150 void testVALIDATOR_315() { 151 151 assertFalse(validator.isValid("me@at&t.net")); 152 152 assertTrue(validator.isValid("me@att.net")); // Make sure TLD is not the cause of the failure … … 157 157 */ 158 158 @Test 159 publicvoid testVALIDATOR_278() {159 void testVALIDATOR_278() { 160 160 assertFalse(validator.isValid("someone@-test.com")); // hostname starts with dash/hyphen 161 161 assertFalse(validator.isValid("someone@test-.com")); // hostname ends with dash/hyphen … … 166 166 */ 167 167 @Test 168 publicvoid testValidator235() {168 void testValidator235() { 169 169 String version = System.getProperty("java.version"); 170 170 if (version.compareTo("1.6") < 0) { … … 184 184 */ 185 185 @Test 186 publicvoid testEmailWithCommas() {186 void testEmailWithCommas() { 187 187 assertFalse(validator.isValid("joeblow@apa,che.org")); 188 188 … … 196 196 */ 197 197 @Test 198 publicvoid testEmailWithSpaces() {198 void testEmailWithSpaces() { 199 199 assertFalse(validator.isValid("joeblow @apache.org")); // TODO - this should be valid? 200 200 … … 215 215 */ 216 216 @Test 217 publicvoid testEmailWithControlChars() {217 void testEmailWithControlChars() { 218 218 for (char c = 0; c < 32; c++) { 219 219 assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com")); … … 227 227 */ 228 228 @Test 229 publicvoid testEmailLocalhost() {229 void testEmailLocalhost() { 230 230 // Check the default is not to allow 231 231 EmailValidator noLocal = EmailValidator.getInstance(false); … … 258 258 */ 259 259 @Test 260 publicvoid testEmailWithSlashes() {260 void testEmailWithSlashes() { 261 261 assertTrue( 262 262 "/ and ! valid in username", … … 278 278 */ 279 279 @Test 280 publicvoid testEmailUserName() {280 void testEmailUserName() { 281 281 282 282 assertTrue(validator.isValid("joe1blow@apache.org")); … … 490 490 * The real solution is to fix the email parsing. 491 491 */ 492 @ Ignore("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing")493 @Test 494 publicvoid testEmailFromPerl() {492 @Disabled("This test fails so disable it for 1.1.4 release. The real solution is to fix the email parsing") 493 @Test 494 void testEmailFromPerl() { 495 495 for (int index = 0; index < testEmailFromPerl.length; index++) { 496 496 String item = testEmailFromPerl[index].item; … … 507 507 */ 508 508 @Test 509 publicvoid testValidator293() {509 void testValidator293() { 510 510 assertTrue(validator.isValid("abc-@abc.com")); 511 511 assertTrue(validator.isValid("abc_@abc.com")); … … 519 519 */ 520 520 @Test 521 publicvoid testValidator365() {521 void testValidator365() { 522 522 assertFalse(validator.isValid( 523 523 "Loremipsumdolorsitametconsecteturadipiscingelit.Nullavitaeligulamattisrhoncusnuncegestasmattisleo."+ … … 554 554 */ 555 555 @Test 556 publicvoid testEmailAtTLD() {556 void testEmailAtTLD() { 557 557 EmailValidator val = EmailValidator.getInstance(false, true); 558 558 assertTrue(val.isValid("test@com")); … … 563 563 */ 564 564 @Test 565 publicvoid testValidator359() {565 void testValidator359() { 566 566 EmailValidator val = EmailValidator.getInstance(false, true); 567 567 assertFalse(val.isValid("test@.com")); … … 572 572 */ 573 573 @Test 574 publicvoid testValidator374() {574 void testValidator374() { 575 575 assertTrue(validator.isValid("abc@school.school")); 576 576 } … … 580 580 */ 581 581 @Test 582 publicvoid testValidatorName() {582 void testValidatorName() { 583 583 assertEquals("Email validator", EmailValidator.getInstance().getValidatorName()); 584 584 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java
r10378 r17275 15 15 * limitations under the License. 16 16 */ 17 18 17 package org.openstreetmap.josm.data.validation.routines; 19 18 … … 22 21 import static org.junit.Assert.assertTrue; 23 22 24 import org.junit. Before;25 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Test; 26 25 27 26 /** … … 30 29 * @version $Revision: 1741724 $ 31 30 */ 32 publicclass InetAddressValidatorTest {31 class InetAddressValidatorTest { 33 32 34 33 private InetAddressValidator validator; … … 37 36 * Setup 38 37 */ 39 @Before 38 @BeforeEach 40 39 public void setUp() { 41 40 validator = new InetAddressValidator(); … … 46 45 */ 47 46 @Test 48 publicvoid testInetAddressesFromTheWild() {47 void testInetAddressesFromTheWild() { 49 48 // CHECKSTYLE.OFF: SingleSpaceSeparator 50 49 assertTrue("www.apache.org IP should be valid", validator.isValid("140.211.11.130")); … … 59 58 */ 60 59 @Test 61 publicvoid testVALIDATOR_335() {60 void testVALIDATOR_335() { 62 61 assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid", 63 62 validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35")); … … 68 67 */ 69 68 @Test 70 publicvoid testInetAddressesByClass() {69 void testInetAddressesByClass() { 71 70 // CHECKSTYLE.OFF: SingleSpaceSeparator 72 71 assertTrue("class A IP should be valid", validator.isValid("24.25.231.12")); … … 91 90 */ 92 91 @Test 93 publicvoid testReservedInetAddresses() {92 void testReservedInetAddresses() { 94 93 assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1")); 95 94 assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255")); … … 100 99 */ 101 100 @Test 102 publicvoid testBrokenInetAddresses() {101 void testBrokenInetAddresses() { 103 102 // CHECKSTYLE.OFF: SingleSpaceSeparator 104 103 assertFalse("IP with characters should be invalid", validator.isValid("124.14.32.abc")); … … 119 118 */ 120 119 @Test 121 publicvoid testIPv6() {120 void testIPv6() { 122 121 // The original Perl script contained a lot of duplicate tests. 123 122 // I removed the duplicates I noticed, but there may be more. … … 627 626 */ 628 627 @Test 629 publicvoid testValidatorName() {628 void testValidatorName() { 630 629 assertNull(new InetAddressValidator().getValidatorName()); 631 630 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java
r12620 r17275 21 21 import static org.junit.Assert.assertNull; 22 22 import static org.junit.Assert.assertTrue; 23 import static org.junit. Assert.fail;23 import static org.junit.jupiter.api.Assertions.fail; 24 24 25 25 import java.util.Arrays; 26 26 import java.util.regex.PatternSyntaxException; 27 27 28 import org.junit. Test;28 import org.junit.jupiter.api.Test; 29 29 import org.openstreetmap.josm.tools.Logging; 30 30 … … 35 35 * @since Validator 1.4 36 36 */ 37 publicclass RegexValidatorTest {37 class RegexValidatorTest { 38 38 39 39 private static final String REGEX = "^([abc]*)(?:\\-)([DEF]*)(?:\\-)([123]*)$"; … … 55 55 */ 56 56 @Test 57 publicvoid testSingle() {57 void testSingle() { 58 58 RegexValidator sensitive = new RegexValidator(REGEX); 59 59 RegexValidator insensitive = new RegexValidator(REGEX, false); … … 84 84 */ 85 85 @Test 86 publicvoid testMultipleSensitive() {86 void testMultipleSensitive() { 87 87 88 88 // ------------ Set up Sensitive Validators … … 126 126 */ 127 127 @Test 128 publicvoid testMultipleInsensitive() {128 void testMultipleInsensitive() { 129 129 130 130 // ------------ Set up In-sensitive Validators … … 168 168 */ 169 169 @Test 170 publicvoid testNullValue() {170 void testNullValue() { 171 171 RegexValidator validator = new RegexValidator(REGEX); 172 172 assertFalse("Instance isValid()", validator.isValid(null)); … … 181 181 */ 182 182 @Test 183 publicvoid testMissingRegex() {183 void testMissingRegex() { 184 184 185 185 // Single Regular Expression - null … … 238 238 */ 239 239 @Test 240 publicvoid testExceptions() {240 void testExceptions() { 241 241 String invalidRegex = "^([abCD12]*$"; 242 242 try { … … 252 252 */ 253 253 @Test 254 publicvoid testToString() {254 void testToString() { 255 255 RegexValidator single = new RegexValidator(REGEX); 256 256 assertEquals("Single", "RegexValidator{" + REGEX + "}", single.toString()); … … 264 264 */ 265 265 @Test 266 publicvoid testValidatorName() {266 void testValidatorName() { 267 267 assertNull(new RegexValidator(".*").getValidatorName()); 268 268 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java
r11621 r17275 21 21 import static org.junit.Assert.assertTrue; 22 22 23 import org.junit. Before;24 import org.junit. Test;23 import org.junit.jupiter.api.BeforeEach; 24 import org.junit.jupiter.api.Test; 25 25 26 26 /** … … 29 29 * @version $Revision: 1741724 $ 30 30 */ 31 publicclass UrlValidatorTest {31 class UrlValidatorTest { 32 32 33 33 private static final boolean printStatus = false; … … 37 37 * Setup 38 38 */ 39 @Before 39 @BeforeEach 40 40 public void setUp() { 41 41 for (int index = 0; index < testPartsIndex.length - 1; index++) { … … 140 140 */ 141 141 @Test 142 publicvoid testValidator202() {142 void testValidator202() { 143 143 String[] schemes = {"http", "https"}; 144 144 UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS); … … 151 151 */ 152 152 @Test 153 publicvoid testValidator204() {153 void testValidator204() { 154 154 String[] schemes = {"http", "https"}; 155 155 UrlValidator urlValidator = new UrlValidator(schemes); … … 161 161 */ 162 162 @Test 163 publicvoid testValidator218() {163 void testValidator218() { 164 164 UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_2_SLASHES); 165 165 assertTrue("parentheses should be valid in URLs", … … 171 171 */ 172 172 @Test 173 publicvoid testValidator235() {173 void testValidator235() { 174 174 String version = System.getProperty("java.version"); 175 175 if (version.compareTo("1.6") < 0) { … … 190 190 */ 191 191 @Test 192 publicvoid testValidator248() {192 void testValidator248() { 193 193 RegexValidator regex = new RegexValidator(new String[] {"localhost", ".*\\.my-testing"}); 194 194 UrlValidator validator = new UrlValidator(regex, 0); … … 224 224 */ 225 225 @Test 226 publicvoid testValidator288() {226 void testValidator288() { 227 227 UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS); 228 228 … … 262 262 */ 263 263 @Test 264 publicvoid testValidator276() {264 void testValidator276() { 265 265 // file:// isn't allowed by default 266 266 UrlValidator validator = new UrlValidator(); … … 319 319 */ 320 320 @Test 321 publicvoid testValidator309() {321 void testValidator309() { 322 322 UrlValidator urlValidator = new UrlValidator(); 323 323 assertTrue(urlValidator.isValid("http://sample.ondemand.com/")); … … 334 334 */ 335 335 @Test 336 publicvoid testValidator339() {336 void testValidator339() { 337 337 UrlValidator urlValidator = new UrlValidator(); 338 338 assertTrue(urlValidator.isValid("http://www.cnn.com/WORLD/?hpt=sitenav")); // without … … 347 347 */ 348 348 @Test 349 publicvoid testValidator339IDN() {349 void testValidator339IDN() { 350 350 UrlValidator urlValidator = new UrlValidator(); 351 351 assertTrue(urlValidator.isValid("http://президент.рф/WORLD/?hpt=sitenav")); // without … … 360 360 */ 361 361 @Test 362 publicvoid testValidator342() {362 void testValidator342() { 363 363 UrlValidator urlValidator = new UrlValidator(); 364 364 assertTrue(urlValidator.isValid("http://example.rocks/")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java
r15745 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import static org.openstreetmap.josm.data.coor.LatLon.NORTH_POLE; 8 8 import static org.openstreetmap.josm.data.coor.LatLon.SOUTH_POLE; … … 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.TestUtils; 16 16 import org.openstreetmap.josm.data.coor.LatLon; … … 27 27 * JUnit Test of {@link Addresses} validation test. 28 28 */ 29 publicclass AddressesTest {29 class AddressesTest { 30 30 31 31 /** 32 32 * Setup test. 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules test = new JOSMTestRules(); … … 57 57 */ 58 58 @Test 59 publicvoid testHouseNumberWithoutStreet() {59 void testHouseNumberWithoutStreet() { 60 60 assertNull(doTestHouseNumberWithoutStreet("", null, null)); 61 61 assertNotNull(doTestHouseNumberWithoutStreet("addr:housenumber=1", null, null)); … … 90 90 */ 91 91 @Test 92 publicvoid testDuplicateHouseNumber() {92 void testDuplicateHouseNumber() { 93 93 String num1 = "addr:housenumber=1 addr:street=Foo "; 94 94 String num2 = "addr:housenumber=2 addr:street=Foo "; … … 116 116 */ 117 117 @Test 118 publicvoid testMultiAddressDuplicates() {118 void testMultiAddressDuplicates() { 119 119 String num1 = "addr:housenumber=1,3 addr:street=Foo"; 120 120 String num2 = "addr:housenumber=1 addr:street=Foo"; -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java
r16006 r17275 4 4 import java.util.stream.Collectors; 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 * JUnit Test of {@link Coastlines} validation test. 14 14 */ 15 publicclass CoastlinesTest {15 class CoastlinesTest { 16 16 17 17 private static final Coastlines COASTLINES = new Coastlines(); … … 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 30 30 */ 31 31 @Test 32 publicvoid testCoastlineFile() throws Exception {32 void testCoastlineFile() throws Exception { 33 33 ValidatorTestUtils.testSampleFile("nodist/data/coastlines.osm", 34 34 ds -> ds.getWays().stream().filter( -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java
r15071 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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. Before;8 import org.junit. Rule;9 import org.junit. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 import org.junit.jupiter.api.extension.RegisterExtension; 10 10 import org.openstreetmap.josm.testutils.JOSMTestRules; 11 11 … … 15 15 * Unit test of {@link ConditionalKeys}. 16 16 */ 17 publicclass ConditionalKeysTest {17 class ConditionalKeysTest { 18 18 19 19 private final ConditionalKeys test = new ConditionalKeys(); … … 22 22 * Setup test 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules rule = new JOSMTestRules().presets(); … … 30 30 * @throws Exception if an error occurs 31 31 */ 32 @Before 32 @BeforeEach 33 33 public void setUp() throws Exception { 34 34 test.initialize(); … … 39 39 */ 40 40 @Test 41 publicvoid testKeyValid() {41 void testKeyValid() { 42 42 assertTrue(test.isKeyValid("maxspeed:conditional")); 43 43 assertTrue(test.isKeyValid("motor_vehicle:conditional")); … … 55 55 */ 56 56 @Test 57 publicvoid testValueValid() {57 void testValueValid() { 58 58 assertTrue(test.isValueValid("maxspeed:conditional", "120 @ (06:00-19:00)")); 59 59 assertFalse(test.isValueValid("maxspeed:conditional", " @ (06:00-19:00)")); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java
r16298 r17275 3 3 4 4 import org.junit.Assert; 5 import org.junit. Before;6 import org.junit. Test;5 import org.junit.jupiter.api.BeforeEach; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.JOSMFixture; 8 8 import org.openstreetmap.josm.TestUtils; … … 17 17 * @author Taylor Smock 18 18 */ 19 publicclass ConnectivityRelationsTest {19 class ConnectivityRelationsTest { 20 20 private ConnectivityRelations check; 21 21 private static final String CONNECTIVITY = "connectivity"; … … 25 25 * @throws Exception if an error occurs 26 26 */ 27 @Before 27 @BeforeEach 28 28 public void setUp() throws Exception { 29 29 JOSMFixture.createUnitTestFixture().init(); … … 43 43 */ 44 44 @Test 45 publicvoid testNoConnectivityTag() {45 void testNoConnectivityTag() { 46 46 Relation relation = createDefaultTestRelation(); 47 47 check.visit(relation); … … 58 58 */ 59 59 @Test 60 publicvoid testMisMatchedLanes() {60 void testMisMatchedLanes() { 61 61 Relation relation = createDefaultTestRelation(); 62 62 check.visit(relation); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java
r15961 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.util.HashMap; 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.TestUtils; 14 14 import org.openstreetmap.josm.data.coor.EastNorth; … … 27 27 * Unit test of {@link CrossingWays}. 28 28 */ 29 publicclass CrossingWaysTest {29 class CrossingWaysTest { 30 30 31 31 /** 32 32 * Setup test 33 33 */ 34 @R ule34 @RegisterExtension 35 35 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 36 36 public JOSMTestRules rule = new JOSMTestRules().preferences(); … … 48 48 */ 49 49 @Test 50 publicvoid testGetSegments() {50 void testGetSegments() { 51 51 List<List<WaySegment>> list = CrossingWays.getSegments(new HashMap<>(), EastNorth.ZERO, EastNorth.ZERO); 52 52 assertEquals(1, list.size()); … … 58 58 */ 59 59 @Test 60 publicvoid testIsCoastline() {60 void testIsCoastline() { 61 61 assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=water"))); 62 62 assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=coastline"))); … … 69 69 */ 70 70 @Test 71 publicvoid testIsHighway() {71 void testIsHighway() { 72 72 assertTrue(CrossingWays.isHighway(TestUtils.newWay("highway=motorway"))); 73 73 assertFalse(CrossingWays.isHighway(TestUtils.newWay("highway=rest_area"))); … … 78 78 */ 79 79 @Test 80 publicvoid testIsRailway() {80 void testIsRailway() { 81 81 assertTrue(CrossingWays.isRailway(TestUtils.newWay("railway=rail"))); 82 82 assertFalse(CrossingWays.isRailway(TestUtils.newWay("railway=subway"))); … … 88 88 */ 89 89 @Test 90 publicvoid testIsSubwayOrTramOrRazed() {90 void testIsSubwayOrTramOrRazed() { 91 91 assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=subway"))); 92 92 assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=construction construction=tram"))); … … 101 101 */ 102 102 @Test 103 publicvoid testIsProposedOrAbandoned() {103 void testIsProposedOrAbandoned() { 104 104 assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("highway=proposed"))); 105 105 assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("railway=proposed"))); … … 112 112 */ 113 113 @Test 114 publicvoid testWays() {114 void testWays() { 115 115 Ways test = new CrossingWays.Ways(); 116 116 // isPrimitiveUsable … … 157 157 */ 158 158 @Test 159 publicvoid testBoundaries() {159 void testBoundaries() { 160 160 Boundaries test = new CrossingWays.Boundaries(); 161 161 // isPrimitiveUsable … … 171 171 */ 172 172 @Test 173 publicvoid testSelfCrossing() {173 void testSelfCrossing() { 174 174 SelfCrossing test = new CrossingWays.SelfCrossing(); 175 175 // isPrimitiveUsable -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java
r11747 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.data.coor.LatLon; 9 9 import org.openstreetmap.josm.data.osm.DataSet; … … 20 20 * JUnit Test of "Duplicate node" validation test. 21 21 */ 22 publicclass DuplicateNodeTest {22 class DuplicateNodeTest { 23 23 24 24 /** 25 25 * Setup test by initializing JOSM preferences and projection. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules(); … … 70 70 */ 71 71 @Test 72 publicvoid testDuplicateNode() {72 void testDuplicateNode() { 73 73 DataSet ds = new DataSet(); 74 74 … … 88 88 */ 89 89 @Test 90 publicvoid testDuplicateNodeMixed() {90 void testDuplicateNodeMixed() { 91 91 doTest(DuplicateNode.DUPLICATE_NODE_MIXED, new Tag("building", "foo"), new Tag("highway", "bar")); 92 92 } … … 96 96 */ 97 97 @Test 98 publicvoid testDuplicateNodeOther() {98 void testDuplicateNodeOther() { 99 99 doTest(DuplicateNode.DUPLICATE_NODE_OTHER); 100 100 } … … 104 104 */ 105 105 @Test 106 publicvoid testDuplicateNodeBuilding() {106 void testDuplicateNodeBuilding() { 107 107 doTest(DuplicateNode.DUPLICATE_NODE_BUILDING, new Tag("building", "foo")); 108 108 } … … 112 112 */ 113 113 @Test 114 publicvoid testDuplicateNodeBoundary() {114 void testDuplicateNodeBoundary() { 115 115 doTest(DuplicateNode.DUPLICATE_NODE_BOUNDARY, new Tag("boundary", "foo")); 116 116 } … … 120 120 */ 121 121 @Test 122 publicvoid testDuplicateNodeHighway() {122 void testDuplicateNodeHighway() { 123 123 doTest(DuplicateNode.DUPLICATE_NODE_HIGHWAY, new Tag("highway", "foo")); 124 124 } … … 128 128 */ 129 129 @Test 130 publicvoid testDuplicateNodeLanduse() {130 void testDuplicateNodeLanduse() { 131 131 doTest(DuplicateNode.DUPLICATE_NODE_LANDUSE, new Tag("landuse", "foo")); 132 132 } … … 136 136 */ 137 137 @Test 138 publicvoid testDuplicateNodeNatural() {138 void testDuplicateNodeNatural() { 139 139 doTest(DuplicateNode.DUPLICATE_NODE_NATURAL, new Tag("natural", "foo")); 140 140 } … … 144 144 */ 145 145 @Test 146 publicvoid testDuplicateNodePower() {146 void testDuplicateNodePower() { 147 147 doTest(DuplicateNode.DUPLICATE_NODE_POWER, new Tag("power", "foo")); 148 148 } … … 152 152 */ 153 153 @Test 154 publicvoid testDuplicateNodeRailway() {154 void testDuplicateNodeRailway() { 155 155 doTest(DuplicateNode.DUPLICATE_NODE_RAILWAY, new Tag("railway", "foo")); 156 156 } … … 160 160 */ 161 161 @Test 162 publicvoid testDuplicateNodeWaterway() {162 void testDuplicateNodeWaterway() { 163 163 doTest(DuplicateNode.DUPLICATE_NODE_WATERWAY, new Tag("waterway", "foo")); 164 164 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateRelationTest.java
r14817 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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; 9 9 import org.openstreetmap.josm.data.coor.LatLon; … … 20 20 * JUnit Test of "Duplicate relation" validation test. 21 21 */ 22 publicclass DuplicateRelationTest {22 class DuplicateRelationTest { 23 23 24 24 /** 25 25 * Setup test by initializing JOSM preferences and projection. 26 26 */ 27 @R ule27 @RegisterExtension 28 28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 29 29 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 71 71 */ 72 72 @Test 73 publicvoid testDuplicateRelationNoTags() {73 void testDuplicateRelationNoTags() { 74 74 doTest("", "", 75 75 new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true), … … 81 81 */ 82 82 @Test 83 publicvoid testDuplicateRelationSameTags() {83 void testDuplicateRelationSameTags() { 84 84 doTest("type=boundary", "type=boundary", 85 85 new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true), … … 91 91 */ 92 92 @Test 93 publicvoid testDuplicateRelationDifferentTags() {93 void testDuplicateRelationDifferentTags() { 94 94 doTest("type=boundary", "type=multipolygon", 95 95 new ExpectedResult(DuplicateRelation.SAME_RELATION, false)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java
r17222 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.nio.file.Files; 9 9 import java.nio.file.Paths; 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.TestUtils; 14 14 import org.openstreetmap.josm.command.Command; … … 26 26 * JUnit Test of "Duplicate way" validation test. 27 27 */ 28 publicclass DuplicateWayTest {28 class DuplicateWayTest { 29 29 30 30 /** 31 31 * Setup test by initializing JOSM preferences and projection. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 76 76 */ 77 77 @Test 78 publicvoid testDuplicateWayNoTags() {78 void testDuplicateWayNoTags() { 79 79 doTest(DuplicateWay.DUPLICATE_WAY); 80 80 } … … 84 84 */ 85 85 @Test 86 publicvoid testDuplicateWaySameTags() {86 void testDuplicateWaySameTags() { 87 87 doTest(DuplicateWay.DUPLICATE_WAY, "highway=motorway"); 88 88 } … … 92 92 */ 93 93 @Test 94 publicvoid testDuplicateWayDifferentTags() {94 void testDuplicateWayDifferentTags() { 95 95 doTest(DuplicateWay.SAME_WAY, "highway=motorway", "highway=trunk", false); 96 96 } … … 101 101 */ 102 102 @Test 103 publicvoid testFixError() throws Exception {103 void testFixError() throws Exception { 104 104 DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "duplicate-ways.osm")), null); 105 105 TEST.startTest(NullProgressMonitor.INSTANCE); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java
r14779 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;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.assertFalse; 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.InputStream; 10 10 import java.util.Collection; 11 11 12 import org.junit. Before;13 import org.junit. Test;12 import org.junit.jupiter.api.BeforeEach; 13 import org.junit.jupiter.api.Test; 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.TestUtils; … … 24 24 * Unit test of {@link HighwaysTest}. 25 25 */ 26 publicclass HighwaysTest {26 class HighwaysTest { 27 27 28 28 /** 29 29 * Setup test. 30 30 */ 31 @Before 31 @BeforeEach 32 32 public void setUp() { 33 33 JOSMFixture.createUnitTestFixture().init(); … … 77 77 */ 78 78 @Test 79 publicvoid testCombinations() {79 void testCombinations() { 80 80 assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary_link"))); 81 81 assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary"))); … … 90 90 */ 91 91 @Test 92 publicvoid testSourceMaxSpeedUnitedKingdom() {92 void testSourceMaxSpeedUnitedKingdom() { 93 93 Way link = createTestSetting("primary", "primary"); 94 94 link.put("maxspeed", "60 mph"); … … 108 108 */ 109 109 @Test 110 publicvoid testTicket14891() throws Exception {110 void testTicket14891() throws Exception { 111 111 try (InputStream is = TestUtils.getRegressionDataStream(14891, "14891.osm.bz2")) { 112 112 Collection<Way> ways = OsmReader.parseDataSet(is, null).getWays(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java
r14803 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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;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 8 import static org.openstreetmap.josm.tools.I18n.tr; 9 9 10 10 import java.util.List; 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; 15 15 import org.openstreetmap.josm.data.validation.TestError; … … 24 24 * JUnit Test of "Internet Tags" validation test. 25 25 */ 26 publicclass InternetTagsTest {26 class InternetTagsTest { 27 27 28 28 private static final InternetTags TEST = new InternetTags(); … … 31 31 * Setup test by initializing JOSM preferences and projection. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules(); … … 39 39 */ 40 40 @Test 41 publicvoid testValidUrls() {41 void testValidUrls() { 42 42 testUrl("url", "www.domain.com", true); // No protocol 43 43 testUrl("url", "http://josm.openstreetmap.de", true); // Simple HTTP … … 57 57 */ 58 58 @Test 59 publicvoid testMultipleUrls() {59 void testMultipleUrls() { 60 60 testUrl("url", "http://www.domain-a.com;https://www.domain-b.com", true); // multiple values 61 61 } … … 65 65 */ 66 66 @Test 67 publicvoid testInvalidUrls() {67 void testInvalidUrls() { 68 68 testUrl("url", "something://www.domain.com", false); // invalid protocol 69 69 testUrl("url", "http://www.domain.invalidtld", false); // invalid TLD … … 74 74 */ 75 75 @Test 76 publicvoid testValidEmails() {76 void testValidEmails() { 77 77 testEmail("email", "contact@www.domain.com", true); // Simple email 78 78 testEmail("contact:email", "john.doe@other-domain.org", true); // Key with : + dash in domain … … 83 83 */ 84 84 @Test 85 publicvoid testInvalidEmails() {85 void testInvalidEmails() { 86 86 testEmail("email", "contact at www.domain.com", false); // No @ 87 87 testEmail("contact:email", "john.doe@other-domain.invalidtld", false); // invalid TLD … … 92 92 */ 93 93 @Test 94 publicvoid testInvalidSlashes() {94 void testInvalidSlashes() { 95 95 TestError error = testUrl("website", "http:\\\\www.sjoekurs.no", false).get(0); 96 96 assertEquals(tr("''{0}'': {1}", "website", tr("URL contains backslashes instead of slashes")), error.getDescription()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LanesTest.java
r11403 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import org.junit. Before;8 import org.junit. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 import org.openstreetmap.josm.data.osm.OsmUtils; … … 13 13 * Unit tests of {@link Lanes}. 14 14 */ 15 publicclass LanesTest {15 class LanesTest { 16 16 17 17 private final Lanes lanes = new Lanes(); … … 21 21 * @throws Exception if an error occurs 22 22 */ 23 @Before 23 @BeforeEach 24 24 public void setUp() throws Exception { 25 25 JOSMFixture.createUnitTestFixture().init(); … … 32 32 */ 33 33 @Test 34 publicvoid testLanesCount() {34 void testLanesCount() { 35 35 assertEquals(0, Lanes.getLanesCount("")); 36 36 assertEquals(1, Lanes.getLanesCount("left")); … … 41 41 42 42 @Test 43 publicvoid test1() {43 void test1() { 44 44 lanes.check(OsmUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes")); 45 45 assertEquals("Number of lane dependent values inconsistent", lanes.getErrors().get(0).getMessage()); … … 47 47 48 48 @Test 49 publicvoid test2() {49 void test2() { 50 50 lanes.check(OsmUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated")); 51 51 assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage()); … … 53 53 54 54 @Test 55 publicvoid test3() {55 void test3() { 56 56 lanes.check(OsmUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left")); 57 57 assertTrue(lanes.getErrors().isEmpty()); … … 59 59 60 60 @Test 61 publicvoid test4() {61 void test4() { 62 62 lanes.check(OsmUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3")); 63 63 assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage()); … … 65 65 66 66 @Test 67 publicvoid test5() {67 void test5() { 68 68 lanes.check(OsmUtils.createPrimitive("way lanes:forward=5 turn:lanes:forward=left|right")); 69 69 assertEquals("Number of lanes:forward greater than *:lanes:forward", lanes.getErrors().get(0).getMessage()); … … 71 71 72 72 @Test 73 publicvoid test6() {73 void test6() { 74 74 lanes.check(OsmUtils.createPrimitive("way lanes:forward=foo|bar turn:lanes:forward=foo+bar")); 75 75 assertTrue(lanes.getErrors().isEmpty()); … … 77 77 78 78 @Test 79 publicvoid test7() {79 void test7() { 80 80 lanes.check(OsmUtils.createPrimitive("way lanes=3 lanes:forward=3 lanes:backward=7")); 81 81 assertEquals("Number of lanes:forward+lanes:backward greater than lanes", lanes.getErrors().get(0).getMessage()); … … 83 83 84 84 @Test 85 publicvoid test8() {85 void test8() { 86 86 lanes.check(OsmUtils.createPrimitive( 87 87 "way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none")); … … 90 90 91 91 @Test 92 publicvoid test9() {92 void test9() { 93 93 lanes.check(OsmUtils.createPrimitive("way highway=secondary lanes=2 source:lanes=survey")); 94 94 assertTrue(lanes.getErrors().isEmpty()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java
r10945 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.data.coor.LatLon; 9 9 import org.openstreetmap.josm.data.osm.Node; … … 16 16 * JUnit Test of "Long Segment" validation test. 17 17 */ 18 publicclass LongSegmentTest {18 class LongSegmentTest { 19 19 20 20 /** 21 21 * Setup test. 22 22 */ 23 @R ule23 @RegisterExtension 24 24 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 25 25 public JOSMTestRules test = new JOSMTestRules(); … … 39 39 */ 40 40 @Test 41 publicvoid testLongSegment() throws Exception {41 void testLongSegment() throws Exception { 42 42 // Long way 43 43 Way w = new Way(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java
r16360 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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;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 8 9 9 import java.io.InputStream; … … 16 16 import java.util.Set; 17 17 18 import org.junit. Before;19 import org.junit. Rule;20 import org.junit. Test;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.command.ChangePropertyCommand; … … 51 51 * JUnit Test of {@link MapCSSTagChecker}. 52 52 */ 53 publicclass MapCSSTagCheckerTest {53 class MapCSSTagCheckerTest { 54 54 55 55 /** 56 56 * Setup test. 57 57 */ 58 @R ule58 @RegisterExtension 59 59 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 60 60 public JOSMTestRules test = new JOSMTestRules().projection().territories().preferences(); … … 63 63 * Setup test. 64 64 */ 65 @Before 65 @BeforeEach 66 66 public void setUp() { 67 67 MapCSSTagCheckerAsserts.clear(); … … 72 72 Set<String> errors = new HashSet<>(); 73 73 test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css), errors::add).parseChecks); 74 assertTrue(errors. toString(), errors.isEmpty());74 assertTrue(errors.isEmpty(), errors::toString); 75 75 return test; 76 76 } … … 81 81 */ 82 82 @Test 83 publicvoid testNaturalMarsh() throws ParseException {83 void testNaturalMarsh() throws ParseException { 84 84 ParseResult result = TagCheck.readMapCSS(new StringReader( 85 85 "*[natural=marsh] {\n" + … … 122 122 */ 123 123 @Test 124 publicvoid testTicket10913() throws ParseException {124 void testTicket10913() throws ParseException { 125 125 final OsmPrimitive p = TestUtils.addFakeDataSet(TestUtils.newWay("highway=tertiary construction=yes")); 126 126 final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" + … … 141 141 */ 142 142 @Test 143 publicvoid testTicket9782() throws ParseException {143 void testTicket9782() throws ParseException { 144 144 final MapCSSTagChecker test = buildTagChecker("*[/.+_name/][!name] {" + 145 145 "throwWarning: tr(\"has {0} but not {1}\", \"{0.key}\", \"{1.key}\");}"); … … 156 156 */ 157 157 @Test 158 publicvoid testTicket10859() throws ParseException {158 void testTicket10859() throws ParseException { 159 159 final MapCSSTagChecker test = buildTagChecker("way[highway=footway][foot?!] {\n" + 160 160 " throwWarning: tr(\"{0} used with {1}\", \"{0.value}\", \"{1.tag}\");}"); … … 171 171 */ 172 172 @Test 173 publicvoid testTicket13630() throws ParseException {173 void testTicket13630() throws ParseException { 174 174 ParseResult result = TagCheck.readMapCSS(new StringReader( 175 175 "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}")); … … 183 183 */ 184 184 @Test 185 publicvoid testPreprocessing() throws ParseException {185 void testPreprocessing() throws ParseException { 186 186 final MapCSSTagChecker test = buildTagChecker( 187 187 "@supports (min-josm-version: 0) { *[foo] { throwWarning: \"!\"; } }\n" + … … 196 196 */ 197 197 @Test 198 publicvoid testInit() throws Exception {198 void testInit() throws Exception { 199 199 Logging.clearLastErrorAndWarnings(); 200 200 MapCSSTagChecker c = new MapCSSTagChecker(); 201 201 c.initialize(); 202 202 203 assertTrue( "no warnings/errors are logged", Logging.getLastErrorAndWarnings().isEmpty());203 assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), "no warnings/errors are logged"); 204 204 205 205 // to trigger MapCSSStyleIndex code … … 214 214 */ 215 215 @Test 216 publicvoid testAssertions() throws Exception {216 void testAssertions() throws Exception { 217 217 MapCSSTagChecker c = new MapCSSTagChecker(); 218 218 Set<String> assertionErrors = new LinkedHashSet<>(); … … 226 226 Logging.error(msg); 227 227 } 228 assertTrue( "not all assertions included in the tests are met", assertionErrors.isEmpty());228 assertTrue(assertionErrors.isEmpty(), "not all assertions included in the tests are met"); 229 229 } 230 230 … … 234 234 */ 235 235 @Test 236 publicvoid testAssertInsideCountry() throws ParseException {236 void testAssertInsideCountry() throws ParseException { 237 237 final MapCSSTagChecker test = buildTagChecker( 238 238 "node[amenity=parking][inside(\"BR\")] {\n" + … … 249 249 */ 250 250 @Test 251 publicvoid testTicket17058() throws ParseException {251 void testTicket17058() throws ParseException { 252 252 final MapCSSTagChecker test = buildTagChecker( 253 253 "*[name =~ /(?i).*Straße.*/][inside(\"LI,CH\")] {\n" + … … 264 264 */ 265 265 @Test 266 publicvoid testTicket13762() throws ParseException {266 void testTicket13762() throws ParseException { 267 267 final ParseResult parseResult = TagCheck.readMapCSS(new StringReader("" + 268 268 "meta[lang=de] {\n" + … … 277 277 */ 278 278 @Test 279 publicvoid testTicket14287() throws Exception {279 void testTicket14287() throws Exception { 280 280 final MapCSSTagChecker test = buildTagChecker( 281 281 "node[amenity=parking] ∈ *[amenity=parking] {" + … … 293 293 */ 294 294 @Test 295 publicvoid testTicket17053() throws ParseException {295 void testTicket17053() throws ParseException { 296 296 final MapCSSTagChecker test = buildTagChecker( 297 297 "way[highway=cycleway][cycleway=track] {\n" + … … 336 336 */ 337 337 @Test 338 publicvoid testTicket12627() throws Exception {338 void testTicket12627() throws Exception { 339 339 doTestNaturalWood(12627, "overlapping.osm", 1, 1); 340 340 } … … 345 345 */ 346 346 @Test 347 publicvoid testTicket14289() throws Exception {347 void testTicket14289() throws Exception { 348 348 doTestNaturalWood(14289, "example2.osm", 3, 3); 349 349 } … … 354 354 */ 355 355 @Test 356 publicvoid testTicket15641() throws ParseException {356 void testTicket15641() throws ParseException { 357 357 assertNotNull(buildTagChecker( 358 358 "relation[type=public_transport][public_transport=stop_area_group] > way {" + … … 366 366 */ 367 367 @Test 368 publicvoid testTicket17358() throws ParseException {368 void testTicket17358() throws ParseException { 369 369 final Collection<TestError> errors = buildTagChecker( 370 370 "*[/^name/=~/Test/]{" + … … 379 379 */ 380 380 @Test 381 publicvoid testTicket17695() throws Exception {381 void testTicket17695() throws Exception { 382 382 final MapCSSTagChecker test = buildTagChecker( 383 383 "*[building] ∈ *[building] {" + … … 396 396 */ 397 397 @Test 398 publicvoid testTicket13165() throws Exception {398 void testTicket13165() throws Exception { 399 399 final MapCSSTagChecker test = buildTagChecker( 400 400 "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {" … … 413 413 */ 414 414 @Test 415 publicvoid testTicket13165IncompleteMP() throws Exception {415 void testTicket13165IncompleteMP() throws Exception { 416 416 final MapCSSTagChecker test = buildTagChecker( 417 417 "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {" … … 431 431 */ 432 432 @Test 433 publicvoid testTicket19053() throws ParseException {433 void testTicket19053() throws ParseException { 434 434 final MapCSSTagChecker test = buildTagChecker( 435 435 "*[ele][ele =~ /^-?[0-9]+\\.[0-9][0-9][0-9]+$/] {" -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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; 8 8 import java.util.stream.Collectors; 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.data.osm.Relation; … … 20 20 * JUnit Test of Multipolygon validation test. 21 21 */ 22 publicclass MultipolygonTestTest {22 class MultipolygonTestTest { 23 23 24 24 … … 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().projection().mapStyles().presets().main().preferences(); … … 35 35 */ 36 36 @Test 37 publicvoid testMultipolygonFile() throws Exception {37 void testMultipolygonFile() throws Exception { 38 38 final MultipolygonTest MULTIPOLYGON_TEST = new MultipolygonTest(); 39 39 final RelationChecker RELATION_TEST = new RelationChecker(); … … 48 48 */ 49 49 @Test 50 publicvoid testTicket17768TouchingInner() throws Exception {50 void testTicket17768TouchingInner() throws Exception { 51 51 try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner.osm")) { 52 52 MultipolygonTest mpTest = new MultipolygonTest(); … … 62 62 */ 63 63 @Test 64 publicvoid testTicket17768TouchingInnerOuter() throws Exception {64 void testTicket17768TouchingInnerOuter() throws Exception { 65 65 try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner-outer.osm")) { 66 66 MultipolygonTest mpTest = new MultipolygonTest(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java
r11131 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.List; 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.OsmUtils; 11 11 import org.openstreetmap.josm.data.validation.TestError; … … 17 17 * JUnit Test of "Name mismatch" validation test. 18 18 */ 19 publicclass NameMismatchTest {19 class NameMismatchTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testCase0() {38 void testCase0() { 39 39 final List<TestError> errors = test("node name:de=Europa"); 40 40 assertEquals(1, errors.size()); … … 46 46 */ 47 47 @Test 48 publicvoid testCase1() {48 void testCase1() { 49 49 final List<TestError> errors = test("node name=Europe name:de=Europa"); 50 50 assertEquals(1, errors.size()); … … 56 56 */ 57 57 @Test 58 publicvoid testCase2() {58 void testCase2() { 59 59 final List<TestError> errors = test("node name=Europe name:de=Europa name:en=Europe"); 60 60 assertEquals(0, errors.size()); … … 65 65 */ 66 66 @Test 67 publicvoid testCase3() {67 void testCase3() { 68 68 List<TestError> errors; 69 69 errors = test("node \"name\"=\"Italia - Italien - Italy\""); … … 82 82 */ 83 83 @Test 84 publicvoid testEtymologyWikidata() {84 void testEtymologyWikidata() { 85 85 final List<TestError> errors = test("node name=Foo name:etymology:wikidata=Bar"); 86 86 assertEquals(0, errors.size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java
r17085 r17275 6 6 import static org.hamcrest.CoreMatchers.not; 7 7 import static org.hamcrest.MatcherAssert.assertThat; 8 import static org.junit. Assert.assertEquals;9 import static org.junit. Assert.assertNotNull;10 import static org.junit. Assert.assertTrue;8 import static org.junit.jupiter.api.Assertions.assertEquals; 9 import static org.junit.jupiter.api.Assertions.assertNotNull; 10 import static org.junit.jupiter.api.Assertions.assertTrue; 11 11 12 12 import java.util.Arrays; … … 17 17 import java.util.Set; 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.command.ChangePropertyCommand; 23 23 import org.openstreetmap.josm.data.coor.LatLon; … … 41 41 * @see OpeningHourTest 42 42 */ 43 publicclass OpeningHourTestTest {43 class OpeningHourTestTest { 44 44 /** 45 45 * We need preferences for this. We check strings so we need i18n. 46 46 */ 47 @R ule47 @RegisterExtension 48 48 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 49 49 public JOSMTestRules test = new JOSMTestRules().preferences().i18n(); … … 55 55 * @throws Exception if test cannot be initialized 56 56 */ 57 @Before 57 @BeforeEach 58 58 public void setUp() throws Exception { 59 59 openingHourTest = new OpeningHourTest(); … … 66 66 */ 67 67 @Test 68 publicvoid testCheckOpeningHourSyntax1() {68 void testCheckOpeningHourSyntax1() { 69 69 final String key = "opening_hours"; 70 70 // frequently used tags according to https://taginfo.openstreetmap.org/keys/opening_hours#values … … 82 82 */ 83 83 @Test 84 publicvoid testI18n() {84 void testI18n() { 85 85 final String key = "opening_hours"; 86 86 String value = "."; … … 100 100 */ 101 101 @Test 102 publicvoid testCheckOpeningHourSyntax2() {102 void testCheckOpeningHourSyntax2() { 103 103 final String key = "opening_hours"; 104 104 final List<TestError> errors = checkOpeningHourSyntax(key, "Mo-Tue"); … … 113 113 */ 114 114 @Test 115 publicvoid testCheckOpeningHourSyntax3() {115 void testCheckOpeningHourSyntax3() { 116 116 final String key = "opening_hours"; 117 117 final List<TestError> errors = checkOpeningHourSyntax(key, "Sa-Su 10.00-20.00"); … … 126 126 */ 127 127 @Test 128 publicvoid testCheckOpeningHourSyntax4() {128 void testCheckOpeningHourSyntax4() { 129 129 assertThat(checkOpeningHourSyntax(null, null), isEmpty()); 130 130 assertThat(checkOpeningHourSyntax(null, ""), isEmpty()); … … 139 139 */ 140 140 @Test 141 publicvoid testCheckOpeningHourSyntax5() {141 void testCheckOpeningHourSyntax5() { 142 142 final String key = "opening_hours"; 143 143 assertThat(checkOpeningHourSyntax(key, "badtext"), hasSize(1)); … … 153 153 */ 154 154 @Test 155 publicvoid testCheckOpeningHourSyntax6() {155 void testCheckOpeningHourSyntax6() { 156 156 final String key = "opening_hours"; 157 157 assertThat(checkOpeningHourSyntax(key, "PH open \"always open on public holidays\""), isEmpty()); … … 162 162 */ 163 163 @Test 164 publicvoid testCheckOpeningHourSyntax7() {164 void testCheckOpeningHourSyntax7() { 165 165 final String key = "opening_hours"; 166 166 assertThat(checkOpeningHourSyntax(key, "9:00-18:00"), hasSize(1)); … … 173 173 */ 174 174 @Test 175 publicvoid testCheckOpeningHourSyntaxTicket9367() {175 void testCheckOpeningHourSyntaxTicket9367() { 176 176 final String key = "opening_hours"; 177 177 assertEquals(Severity.WARNING, checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getSeverity()); … … 184 184 */ 185 185 @Test 186 publicvoid testCheckServiceTimeSyntax1() {186 void testCheckServiceTimeSyntax1() { 187 187 final String key = "service_times"; 188 188 // frequently used tags according to https://taginfo.openstreetmap.org/keys/service_times#values … … 203 203 */ 204 204 @Test 205 publicvoid testCheckCollectionTimeSyntax1() {205 void testCheckCollectionTimeSyntax1() { 206 206 final String key = "collection_times"; 207 207 // frequently used tags according to https://taginfo.openstreetmap.org/keys/collection_times#values … … 221 221 */ 222 222 @Test 223 publicvoid testPresetValues() {223 void testPresetValues() { 224 224 final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false, false); 225 225 final Set<Tag> values = new LinkedHashSet<>(); … … 247 247 */ 248 248 @Test 249 publicvoid testTicket17932() {249 void testTicket17932() { 250 250 Logging.clearLastErrorAndWarnings(); 251 251 assertTrue(checkOpeningHourSyntax("opening_hours", "SH off").isEmpty()); … … 261 261 262 262 private static void assertFixEquals(String value, TestError error) { 263 assertNotNull( "fix is not null", error.getFix());264 assertTrue( "fix is ChangePropertyCommand", error.getFix() instanceof ChangePropertyCommand);263 assertNotNull(error.getFix(), "fix is not null"); 264 assertTrue(error.getFix() instanceof ChangePropertyCommand, "fix is ChangePropertyCommand"); 265 265 final ChangePropertyCommand command = (ChangePropertyCommand) error.getFix(); 266 266 assertEquals(1, command.getTags().size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java
r13411 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.TestUtils; 12 12 import org.openstreetmap.josm.data.osm.Node; … … 21 21 * JUnit Test of "Public Transport Route" validation test. 22 22 */ 23 publicclass PublicTransportRouteTestTest {23 class PublicTransportRouteTestTest { 24 24 25 25 final PublicTransportRouteTest test = new PublicTransportRouteTest(); … … 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules rules = new JOSMTestRules(); … … 36 36 */ 37 37 @Test 38 publicvoid testVarious() {38 void testVarious() { 39 39 final List<Node> nodes = Arrays.asList(new Node(), new Node(), new Node(), new Node(), new Node(), new Node()); 40 40 final Way w1 = TestUtils.newWay("", nodes.get(0), nodes.get(1)); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java
r16703 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 import static org.openstreetmap.josm.data.osm.OsmUtils.createPrimitive; 7 7 8 8 import java.util.List; 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.data.osm.Node; 13 13 import org.openstreetmap.josm.data.osm.OsmUtils; … … 23 23 * Unit tests of {@link RelationChecker} class. 24 24 */ 25 publicclass RelationCheckerTest {25 class RelationCheckerTest { 26 26 /** 27 27 * Setup test. 28 28 */ 29 @R ule29 @RegisterExtension 30 30 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 31 31 public JOSMTestRules rule = new JOSMTestRules().presets(); … … 48 48 49 49 @Test 50 publicvoid testUnknownType() {50 void testUnknownType() { 51 51 Relation r = createRelation("type=foobar"); 52 52 r.addMember(new RelationMember("", new Way())); … … 58 58 59 59 @Test 60 publicvoid testEmpty() {60 void testEmpty() { 61 61 List<TestError> errors = testRelation(createRelation("type=multipolygon")); 62 62 assertEquals(1, errors.size()); … … 65 65 66 66 @Test 67 publicvoid testNormal() {67 void testNormal() { 68 68 Relation r = createRelation("type=multipolygon"); 69 69 r.addMember(new RelationMember("outer", new Way())); … … 73 73 74 74 @Test 75 publicvoid testOuter2() {75 void testOuter2() { 76 76 Relation r = createRelation("type=multipolygon"); 77 77 r.addMember(new RelationMember("outer", new Way())); … … 84 84 85 85 @Test 86 publicvoid testRestrictionViaMissing() {86 void testRestrictionViaMissing() { 87 87 Relation r = createRelation("type=restriction"); 88 88 r.addMember(new RelationMember("from", new Way())); … … 95 95 96 96 @Test 97 publicvoid testRestrictionViaRelation() {97 void testRestrictionViaRelation() { 98 98 Relation r = createRelation("type=restriction"); 99 99 r.addMember(new RelationMember("from", new Way())); … … 108 108 109 109 @Test 110 publicvoid testRestrictionTwoFrom() {110 void testRestrictionTwoFrom() { 111 111 Relation r = createRelation("type=restriction"); 112 112 r.addMember(new RelationMember("from", new Way())); … … 121 121 122 122 @Test 123 publicvoid testRestrictionEmpty() {123 void testRestrictionEmpty() { 124 124 Relation r = createRelation("type=restriction"); 125 125 r.addMember(new RelationMember("from", new Way())); … … 134 134 135 135 @Test 136 publicvoid testPowerMemberExpression() {136 void testPowerMemberExpression() { 137 137 Relation r = createRelation("type=route route=power"); 138 138 r.addMember(new RelationMember("", new Way())); … … 145 145 146 146 @Test 147 publicvoid testBuildingMemberExpression() {147 void testBuildingMemberExpression() { 148 148 Relation r = createRelation("type=building"); 149 149 r.addMember(new RelationMember("outline", new Way())); … … 161 161 162 162 @Test 163 publicvoid testHikingRouteMembers() {163 void testHikingRouteMembers() { 164 164 Relation r = createRelation("type=route route=hiking"); 165 165 r.addMember(new RelationMember("", OsmUtils.createPrimitive("way highway=path"))); … … 176 176 177 177 @Test 178 publicvoid testRouteMemberExpression() {178 void testRouteMemberExpression() { 179 179 Relation r = createRelation("type=route route=tram public_transport:version=2"); 180 180 r.addMember(new RelationMember("", createPrimitive("way railway=tram"))); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java
r16445 r17275 8 8 9 9 import org.junit.Assert; 10 import org.junit. BeforeClass;11 import org.junit. Test;10 import org.junit.jupiter.api.BeforeAll; 11 import org.junit.jupiter.api.Test; 12 12 import org.openstreetmap.josm.JOSMFixture; 13 13 import org.openstreetmap.josm.data.coor.LatLon; … … 19 19 * JUnit Test of Multipolygon validation test. 20 20 */ 21 publicclass SelfIntersectingWayTest {21 class SelfIntersectingWayTest { 22 22 23 23 /** … … 25 25 * @throws Exception if test cannot be initialized 26 26 */ 27 @Before Class27 @BeforeAll 28 28 public static void setUp() throws Exception { 29 29 JOSMFixture.createUnitTestFixture().init(); … … 45 45 */ 46 46 @Test 47 publicvoid testUnclosedWayNormal() {47 void testUnclosedWayNormal() { 48 48 List<Node> nodes = createNodes(); 49 49 … … 68 68 */ 69 69 @Test 70 publicvoid testUnclosedWayFirst() {70 void testUnclosedWayFirst() { 71 71 List<Node> nodes = createNodes(); 72 72 … … 90 90 */ 91 91 @Test 92 publicvoid testUnclosedWayFirstRepeated() {92 void testUnclosedWayFirstRepeated() { 93 93 List<Node> nodes = createNodes(); 94 94 … … 112 112 */ 113 113 @Test 114 publicvoid testUnclosedWayLast() {114 void testUnclosedWayLast() { 115 115 List<Node> nodes = createNodes(); 116 116 … … 134 134 */ 135 135 @Test 136 publicvoid testClosedWay() {136 void testClosedWay() { 137 137 List<Node> nodes = createNodes(); 138 138 … … 158 158 */ 159 159 @Test 160 publicvoid testSpikeWithStartInClosedWay() {160 void testSpikeWithStartInClosedWay() { 161 161 List<Node> nodes = createNodes(); 162 162 … … 181 181 */ 182 182 @Test 183 publicvoid testSpikeWithEndInClosedWay() {183 void testSpikeWithEndInClosedWay() { 184 184 List<Node> nodes = createNodes(); 185 185 … … 204 204 */ 205 205 @Test 206 publicvoid testSpikeInClosedWay() {206 void testSpikeInClosedWay() { 207 207 List<Node> nodes = createNodes(); 208 208 … … 227 227 */ 228 228 @Test 229 publicvoid testClosedWayBarbell() {229 void testClosedWayBarbell() { 230 230 List<Node> nodes = createNodes(); 231 231 -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java
r15412 r17275 3 3 4 4 import org.junit.Assert; 5 import org.junit. Before;6 import org.junit. Test;5 import org.junit.jupiter.api.BeforeEach; 6 import org.junit.jupiter.api.Test; 7 7 import org.openstreetmap.josm.JOSMFixture; 8 8 import org.openstreetmap.josm.TestUtils; … … 14 14 * JUnit Test of the Sharp Angles validation test. 15 15 */ 16 17 public class SharpAnglesTest { 16 class SharpAnglesTest { 18 17 private SharpAngles angles; 19 18 … … 22 21 * @throws Exception if an error occurs 23 22 */ 24 @Before 23 @BeforeEach 25 24 public void setUp() throws Exception { 26 25 JOSMFixture.createUnitTestFixture().init(); … … 33 32 */ 34 33 @Test 35 publicvoid testClosedLoopNoSharpAngles() {34 void testClosedLoopNoSharpAngles() { 36 35 Way way = TestUtils.newWay("highway=residential", 37 36 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 46 45 */ 47 46 @Test 48 publicvoid testClosedLoopSharpAngles() {47 void testClosedLoopSharpAngles() { 49 48 Way way = TestUtils.newWay("highway=residential", 50 49 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 60 59 */ 61 60 @Test 62 publicvoid testMultipleSharpAngles() {61 void testMultipleSharpAngles() { 63 62 Way way = TestUtils.newWay("highway=residential", 64 63 new Node(new LatLon(0.005069377713748322, -0.0014832642674429382)), … … 75 74 */ 76 75 @Test 77 publicvoid testNoSharpAngles() {76 void testNoSharpAngles() { 78 77 Way way = TestUtils.newWay("highway=residential", 79 78 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), … … 88 87 */ 89 88 @Test 90 publicvoid testCheckBadAnglesFromSameNodeTwice() {89 void testCheckBadAnglesFromSameNodeTwice() { 91 90 Way way = TestUtils.newWay("highway=service oneway=yes", 92 91 new Node(new LatLon(52.8903308, 8.4302322)), … … 106 105 */ 107 106 @Test 108 publicvoid testIgnoredCases() {107 void testIgnoredCases() { 109 108 Way way = TestUtils.newWay("highway=residential", 110 109 new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)), -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SimilarNamedWaysTest.java
r15749 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertFalse;4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertFalse; 6 6 7 import org.junit. Before;8 import org.junit. Test;7 import org.junit.jupiter.api.BeforeEach; 8 import org.junit.jupiter.api.Test; 9 9 import org.openstreetmap.josm.JOSMFixture; 10 10 … … 12 12 * Unit test of {@link SimilarNamedWays} 13 13 */ 14 publicclass SimilarNamedWaysTest {14 class SimilarNamedWaysTest { 15 15 16 16 private final SimilarNamedWays test = new SimilarNamedWays(); … … 19 19 * Setup test 20 20 */ 21 @Before 21 @BeforeEach 22 22 public void setUp() { 23 23 JOSMFixture.createUnitTestFixture().init(); … … 26 26 private void checkSimilarity(String message, String name1, String name2, boolean expected) { 27 27 boolean actual = test.similaryName(name1, name2); 28 assertEquals( message, expected, actual);28 assertEquals(expected, actual, message); 29 29 } 30 30 … … 33 33 */ 34 34 @Test 35 publicvoid testSimilarNames() {35 void testSimilarNames() { 36 36 checkSimilarity("same string", "Testname", "Testname", false); 37 37 checkSimilarity("different case", "Testname", "TestName", true); … … 81 81 */ 82 82 @Test 83 publicvoid testSimilarNamesRegression() {83 void testSimilarNamesRegression() { 84 84 assertFalse(test.similaryName("Unnecessary Name", "Third")); 85 85 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java
r16788 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.IOException; … … 12 12 13 13 import org.junit.Assert; 14 import org.junit. Ignore;15 import org.junit. Rule;16 import org.junit. Test;14 import org.junit.jupiter.api.Disabled; 15 import org.junit.jupiter.api.Test; 16 import org.junit.jupiter.api.extension.RegisterExtension; 17 17 import org.openstreetmap.josm.TestUtils; 18 18 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 28 28 * JUnit Test of {@link TagChecker}. 29 29 */ 30 publicclass TagCheckerTest {30 class TagCheckerTest { 31 31 32 32 /** 33 33 * Setup test. 34 34 */ 35 @R ule35 @RegisterExtension 36 36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 37 37 public JOSMTestRules rule = new JOSMTestRules().presets(); … … 55 55 */ 56 56 @Test 57 publicvoid testMisspelledKey1() throws IOException {57 void testMisspelledKey1() throws IOException { 58 58 final List<TestError> errors = test(OsmUtils.createPrimitive("node Name=Main")); 59 59 assertEquals(1, errors.size()); … … 68 68 */ 69 69 @Test 70 publicvoid testMisspelledKey2() throws IOException {70 void testMisspelledKey2() throws IOException { 71 71 final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse;=forest")); 72 72 assertEquals(1, errors.size()); … … 81 81 */ 82 82 @Test 83 publicvoid testMisspelledKeyButAlternativeInUse() throws IOException {83 void testMisspelledKeyButAlternativeInUse() throws IOException { 84 84 // ticket 12329 85 85 final List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=fuel brand=bah Brand=foo")); … … 97 97 */ 98 98 @Test 99 publicvoid testUpperCaseIgnoredKey() throws IOException {99 void testUpperCaseIgnoredKey() throws IOException { 100 100 // ticket 17468 101 101 final List<TestError> errors = test(OsmUtils.createPrimitive("node wheelchair:Description=bla")); … … 113 113 */ 114 114 @Test 115 publicvoid testUpperCaseInKeyIgnoredTag() throws IOException {115 void testUpperCaseInKeyIgnoredTag() throws IOException { 116 116 // ticket 17468 117 117 final List<TestError> errors = test(OsmUtils.createPrimitive("node land_Area=administrative")); … … 128 128 */ 129 129 @Test 130 publicvoid testTranslatedNameKey() throws IOException {130 void testTranslatedNameKey() throws IOException { 131 131 final List<TestError> errors = test(OsmUtils.createPrimitive("node namez=Baz")); 132 132 assertEquals(1, errors.size()); … … 142 142 */ 143 143 @Test 144 publicvoid testMisspelledTag() throws IOException {144 void testMisspelledTag() throws IOException { 145 145 final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse=forrest")); 146 146 assertEquals(1, errors.size()); … … 156 156 */ 157 157 @Test 158 publicvoid testMisspelledTag2() throws IOException {158 void testMisspelledTag2() throws IOException { 159 159 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=servics")); 160 160 assertEquals(1, errors.size()); … … 172 172 */ 173 173 @Test 174 publicvoid testMisspelledTag3() throws IOException {174 void testMisspelledTag3() throws IOException { 175 175 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=residentail")); 176 176 assertEquals(1, errors.size()); … … 187 187 */ 188 188 @Test 189 publicvoid testShortValNotInPreset2() throws IOException {189 void testShortValNotInPreset2() throws IOException { 190 190 final List<TestError> errors = test(OsmUtils.createPrimitive("node shop=abs")); 191 191 assertEquals(1, errors.size()); … … 201 201 */ 202 202 @Test 203 publicvoid testIgnoredTagsNotInPresets() throws IOException {203 void testIgnoredTagsNotInPresets() throws IOException { 204 204 new TagChecker().initialize(); 205 205 List<String> errors = TagChecker.getIgnoredTags().stream() … … 207 207 .map(Tag::toString) 208 208 .collect(Collectors.toList()); 209 assertTrue(errors. toString(), errors.isEmpty());209 assertTrue(errors.isEmpty(), errors::toString); 210 210 } 211 211 … … 215 215 */ 216 216 @Test 217 publicvoid testTooShortToFix() throws IOException {217 void testTooShortToFix() throws IOException { 218 218 final List<TestError> errors = test(OsmUtils.createPrimitive("node surface=u")); 219 219 assertEquals(1, errors.size()); … … 229 229 */ 230 230 @Test 231 publicvoid testValueDifferentCase() throws IOException {231 void testValueDifferentCase() throws IOException { 232 232 final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=Residential")); 233 233 assertEquals(1, errors.size()); … … 244 244 */ 245 245 @Test 246 publicvoid testRegression17246() throws IOException {246 void testRegression17246() throws IOException { 247 247 final List<TestError> errors = test(OsmUtils.createPrimitive("node access=privat")); 248 248 assertEquals(1, errors.size()); … … 274 274 */ 275 275 @Test 276 publicvoid testContainsRemoveUnwantedNonprintingControlCharacters() {276 void testContainsRemoveUnwantedNonprintingControlCharacters() { 277 277 // Check empty string is handled 278 278 doTestUnwantedNonprintingControlCharacters("", Assert::assertFalse, ""); … … 311 311 */ 312 312 @Test 313 publicvoid testTicket17667() {313 void testTicket17667() { 314 314 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Bus 118: Berlin, Rathaus Zehlendorf => Potsdam, Drewitz Stern-Center")); 315 315 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Καρδίτσα → Λάρισα")); … … 324 324 */ 325 325 @Test 326 publicvoid testTicket18322() {326 void testTicket18322() { 327 327 assertTrue(TagChecker.containsUnusualUnicodeCharacter("name", "D36ᴬ")); 328 328 assertFalse(TagChecker.containsUnusualUnicodeCharacter("ref", "D36ᴬ")); … … 337 337 */ 338 338 @Test 339 publicvoid testTicket18449() {339 void testTicket18449() { 340 340 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Hökumət Evi")); 341 341 } … … 345 345 */ 346 346 @Test 347 publicvoid testTicket18740() {347 void testTicket18740() { 348 348 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:ak", "Frɛnkyeman")); 349 349 assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:bm", "Esipaɲi")); … … 356 356 */ 357 357 @Test 358 publicvoid testObjectTypeNotSupportedByPreset() throws IOException {358 void testObjectTypeNotSupportedByPreset() throws IOException { 359 359 List<TestError> errors = test(OsmUtils.createPrimitive("relation waterway=river")); 360 360 assertEquals(1, errors.size()); 361 361 assertEquals(TagChecker.INVALID_PRESETS_TYPE, errors.get(0).getCode()); 362 362 errors = test(OsmUtils.createPrimitive("relation type=waterway waterway=river")); 363 assertTrue(errors. toString(), errors.isEmpty());363 assertTrue(errors.isEmpty(), errors::toString); 364 364 } 365 365 366 366 /** 367 367 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19519">Bug #19519</a>. 368 */ 369 @Test 370 @Ignore("broken, see #19519") 371 public void testTicket19519() throws IOException { 368 * @throws IOException ignored 369 */ 370 @Test 371 @Disabled("broken, see #19519") 372 void testTicket19519() throws IOException { 372 373 List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=restaurant cuisine=bavarian;beef_bowl")); 373 374 assertEquals(0, errors.size()); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java
r16006 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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 … … 11 11 * JUnit Test of turn restriction validation test. 12 12 */ 13 publicclass TurnRestrictionTestTest {13 class TurnRestrictionTestTest { 14 14 15 15 private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest(); … … 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().projection().mapStyles().presets().main(); … … 28 28 */ 29 29 @Test 30 publicvoid testTurnrestrictionFile() throws Exception {30 void testTurnrestrictionFile() throws Exception { 31 31 ValidatorTestUtils.testSampleFile("nodist/data/restriction.osm", 32 32 ds -> ds.getRelations(), -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java
r16377 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 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.util.ArrayList; 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.coor.LatLon; 14 14 import org.openstreetmap.josm.data.osm.DataSet; … … 26 26 * JUnit Test of unclosed ways validation test. 27 27 */ 28 publicclass UnclosedWaysTest {28 class UnclosedWaysTest { 29 29 30 30 /** 31 31 * Setup test. 32 32 */ 33 @R ule33 @RegisterExtension 34 34 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 35 35 public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets(); … … 52 52 */ 53 53 @Test 54 publicvoid testTicket10469() throws Exception {54 void testTicket10469() throws Exception { 55 55 UnclosedWays uwTest = new UnclosedWays(); 56 56 uwTest.initialize(); … … 84 84 */ 85 85 @Test 86 publicvoid testWayInMultiPolygon() throws Exception {86 void testWayInMultiPolygon() throws Exception { 87 87 UnclosedWays uwTest = new UnclosedWays(); 88 88 uwTest.initialize(); … … 108 108 */ 109 109 @Test 110 publicvoid testWayInBoundary() throws Exception {110 void testWayInBoundary() throws Exception { 111 111 UnclosedWays uwTest = new UnclosedWays(); 112 112 uwTest.initialize(); … … 132 132 */ 133 133 @Test 134 publicvoid testAmenity() throws Exception {134 void testAmenity() throws Exception { 135 135 UnclosedWays uwTest = new UnclosedWays(); 136 136 uwTest.initialize(); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java
r16802 r17275 12 12 import java.nio.file.Paths; 13 13 14 import org.junit. Before;15 import org.junit. Test;14 import org.junit.jupiter.api.BeforeEach; 15 import org.junit.jupiter.api.Test; 16 16 import org.openstreetmap.josm.JOSMFixture; 17 17 import org.openstreetmap.josm.TestUtils; … … 26 26 * Unit tests of {@code UnconnectedWays} class. 27 27 */ 28 publicclass UnconnectedWaysTest {28 class UnconnectedWaysTest { 29 29 30 30 private UnconnectedWays bib; … … 34 34 * @throws Exception if the test cannot be initialized 35 35 */ 36 @Before 36 @BeforeEach 37 37 public void setUp() throws Exception { 38 38 bib = new UnconnectedWays.UnconnectedHighways(); … … 48 48 */ 49 49 @Test 50 publicvoid testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {50 void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException { 51 51 try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/UnconnectedWaysTest.osm"))) { 52 52 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 67 67 */ 68 68 @Test 69 publicvoid testTicket18051() throws IOException, IllegalDataException, FileNotFoundException {69 void testTicket18051() throws IOException, IllegalDataException, FileNotFoundException { 70 70 try (InputStream fis = TestUtils.getRegressionDataStream(18051, "modified-ways.osm.bz2")) { 71 71 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 87 87 */ 88 88 @Test 89 publicvoid testTicket18106() throws IOException, IllegalDataException, FileNotFoundException {89 void testTicket18106() throws IOException, IllegalDataException, FileNotFoundException { 90 90 try (InputStream fis = TestUtils.getRegressionDataStream(18106, "uncon3.osm")) { 91 91 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 107 107 */ 108 108 @Test 109 publicvoid testTicket18137() throws IOException, IllegalDataException, FileNotFoundException {109 void testTicket18137() throws IOException, IllegalDataException, FileNotFoundException { 110 110 try (InputStream fis = TestUtils.getRegressionDataStream(18137, "18137_npe.osm")) { 111 111 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); … … 127 127 */ 128 128 @Test 129 publicvoid testTicket19568() throws IOException, IllegalDataException, FileNotFoundException {129 void testTicket19568() throws IOException, IllegalDataException, FileNotFoundException { 130 130 try (InputStream fis = TestUtils.getRegressionDataStream(19568, "data.osm")) { 131 131 final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UntaggedNodeTest.java
r16618 r17275 8 8 import java.io.InputStream; 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.data.osm.DataSet; … … 21 21 * Unit tests of {@code UntaggedNode} class. 22 22 */ 23 publicclass UntaggedNodeTest {23 class UntaggedNodeTest { 24 24 25 25 private final UntaggedNode test = new UntaggedNode(); … … 28 28 * Setup test. 29 29 */ 30 @R ule30 @RegisterExtension 31 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 32 32 public JOSMTestRules rules = new JOSMTestRules(); … … 37 37 */ 38 38 @Test 39 publicvoid testTicket12436() throws Exception {39 void testTicket12436() throws Exception { 40 40 test.initialize(); 41 41 test.startTest(null); … … 53 53 */ 54 54 @Test 55 publicvoid testTicket12464() throws Exception {55 void testTicket12464() throws Exception { 56 56 test.initialize(); 57 57 test.startTest(null); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java
r16643 r17275 2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 import static org.junit. Assert.assertEquals;5 import static org.junit. Assert.assertTrue;6 import static org.junit. Assert.fail;4 import static org.junit.jupiter.api.Assertions.fail; 5 import static org.junit.jupiter.api.Assertions.assertEquals; 6 import static org.junit.jupiter.api.Assertions.assertTrue; 7 7 8 8 import java.io.InputStream; … … 27 27 * Utilities for validator unit tests. 28 28 */ 29 publicfinal class ValidatorTestUtils {29 final class ValidatorTestUtils { 30 30 31 31 private ValidatorTestUtils() { … … 58 58 for (TestError error : errors) { 59 59 Integer code = error.getCode(); 60 assertTrue( name + " does not expect JOSM error code " + code + ": " + error.getDescription(),61 expectedCodes.contains(code));60 assertTrue(expectedCodes.contains(code), 61 name + " does not expect JOSM error code " + code + ": " + error.getDescription()); 62 62 actualCodes.add(code); 63 63 } 64 assertEquals( name + " " + expectedCodes + " => " + actualCodes,65 expectedCodes.size(), actualCodes.size());64 assertEquals(expectedCodes.size(), actualCodes.size(), 65 name + " " + expectedCodes + " => " + actualCodes); 66 66 } else if (t.hasKey("name") && namePredicate != null && namePredicate.test(t.getName())) { 67 67 fail(name + " lacks josm_error_codes tag"); -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/EntitiesTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 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 for class {@link Entities}. 13 13 */ 14 publicclass EntitiesTest {14 class EntitiesTest { 15 15 16 16 /** 17 17 * Setup test. 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(Entities.class); 30 30 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/MultipleNameVisitorTest.java
r16951 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 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 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; 11 11 import org.openstreetmap.josm.data.osm.Way; … … 17 17 * Unit tests for class {@link MultipleNameVisitor}. 18 18 */ 19 publicclass MultipleNameVisitorTest {19 class MultipleNameVisitorTest { 20 20 21 21 /** 22 22 * Setup test. 23 23 */ 24 @R ule24 @RegisterExtension 25 25 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 26 26 public JOSMTestRules test = new JOSMTestRules().preferences(); … … 30 30 */ 31 31 @Test 32 publicvoid testTicket11967() {32 void testTicket11967() { 33 33 MultipleNameVisitor visitor = new MultipleNameVisitor(); 34 34 visitor.visit(Arrays.asList(new Way(), new Way())); … … 40 40 */ 41 41 @Test 42 publicvoid testTicket16652() {42 void testTicket16652() { 43 43 MultipleNameVisitor visitor = new MultipleNameVisitor(); 44 44 visitor.visit(Arrays.asList( -
trunk/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java
r16182 r17275 2 2 package org.openstreetmap.josm.data.validation.util; 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 for class {@link ValUtil}. 13 13 */ 14 publicclass ValUtilTest {14 class ValUtilTest { 15 15 16 16 /** 17 17 * Setup test. 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(ValUtil.class); 30 30 }
Note:
See TracChangeset
for help on using the changeset viewer.