Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (3 years ago)
Author:
Don-vip
Message:

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

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  
    22package org.openstreetmap.josm.data;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.conflict.ConflictCollection;
    1414import org.openstreetmap.josm.data.osm.CyclicUploadDependencyException;
     
    2626 * Unit tests for class {@link APIDataSet}.
    2727 */
    28 public class APIDataSetTest {
     28class APIDataSetTest {
    2929
    3030    /**
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
    3636
    3737    @Test
    38     public void testOneNewRelationOnly() throws CyclicUploadDependencyException {
     38    void testOneNewRelationOnly() throws CyclicUploadDependencyException {
    3939        Relation r = new Relation();
    4040        r.put("name", "r1");
     
    5252
    5353    @Test
    54     public void testNewParentChildPair() throws CyclicUploadDependencyException {
     54    void testNewParentChildPair() throws CyclicUploadDependencyException {
    5555        DataSet ds = new DataSet();
    5656        Relation r1 = new Relation();
     
    7575
    7676    @Test
    77     public void testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException {
     77    void testOneExistingAndThreNewInAChain() throws CyclicUploadDependencyException {
    7878        DataSet ds = new DataSet();
    7979
     
    121121
    122122    @Test
    123     public void testOneParentTwoNewChildren() throws CyclicUploadDependencyException {
     123    void testOneParentTwoNewChildren() throws CyclicUploadDependencyException {
    124124        DataSet ds = new DataSet();
    125125        Relation r1 = new Relation();
     
    150150
    151151    @Test // for ticket #9624
    152     public void testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException {
     152    void testDeleteOneParentTwoNewChildren() throws CyclicUploadDependencyException {
    153153        DataSet ds = new DataSet();
    154154        Relation r1 = new Relation(1);
     
    193193
    194194    @Test // for ticket #9656
    195     public void testDeleteWay() throws CyclicUploadDependencyException {
     195    void testDeleteWay() throws CyclicUploadDependencyException {
    196196        DataSet ds = new DataSet();
    197197        final Way way = new Way(1, 2);
     
    230230
    231231    @Test
    232     public void testOneCycle() {
     232    void testOneCycle() {
    233233        DataSet ds = new DataSet();
    234234        Relation r1 = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/data/BoundsTest.java

    r10910 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.awt.geom.Rectangle2D;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.data.coor.LatLon;
    1212
     
    1414 * Unit tests for class {@link Bounds}.
    1515 */
    16 public class BoundsTest {
     16class BoundsTest {
    1717
    1818    @Test
    19     public void testCrossing() {
     19    void testCrossing() {
    2020        Bounds b1 = new Bounds(0, 170, 50, -170);
    2121        assertTrue(b1.crosses180thMeridian());
     
    7070     */
    7171    @Test
    72     public void testConstructorNominalCases() {
     72    void testConstructorNominalCases() {
    7373        doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d)));
    7474        doTestConstructorNominal(new Bounds(new LatLon(1d, 2d), new LatLon(3d, 4d), true));
     
    8585     */
    8686    @Test
    87     public void testConstructorSinglePointCases() {
     87    void testConstructorSinglePointCases() {
    8888        doTestConstructorPoint(new Bounds(new LatLon(1d, 2d)));
    8989        doTestConstructorPoint(new Bounds(new LatLon(1d, 2d), true));
  • trunk/test/unit/org/openstreetmap/josm/data/ImageDataTest.java

    r17120 r17275  
    22package org.openstreetmap.josm.data;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.io.File;
     
    1212import java.util.List;
    1313
    14 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.ImageData.ImageDataUpdateListener;
    1616import org.openstreetmap.josm.data.coor.LatLon;
     
    2626 * Unit tests for class {@link ImageData}.
    2727 */
    28 public class ImageDataTest {
     28class ImageDataTest {
    2929
    3030    private static List<ImageEntry> getOneImage() {
     
    3535
    3636    @Test
    37     public void testWithNullData() {
     37    void testWithNullData() {
    3838        ImageData data = new ImageData();
    3939        assertEquals(0, data.getImages().size());
     
    5353
    5454    @Test
    55     public void testImageEntryWithImages() {
     55    void testImageEntryWithImages() {
    5656        assertEquals(1, new ImageData(getOneImage()).getImages().size());
    5757    }
    5858
    5959    @Test
    60     public void testSortData(@Mocked Collections ignore) {
     60    void testSortData(@Mocked Collections ignore) {
    6161        List<ImageEntry> list = getOneImage();
    6262
     
    6969
    7070    @Test
    71     public void testIsModifiedFalse() {
     71    void testIsModifiedFalse() {
    7272        assertFalse(new ImageData(getOneImage()).isModified());
    7373    }
    7474
    7575    @Test
    76     public void testIsModifiedTrue() {
     76    void testIsModifiedTrue() {
    7777        List<ImageEntry> list = getOneImage();
    7878
     
    8585
    8686    @Test
    87     public 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     public void 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() {
    9898        List<ImageEntry> list = getOneImage();
    9999        list.add(new ImageEntry());
     
    106106
    107107    @Test
    108     public void testSelectNextImage() {
     108    void testSelectNextImage() {
    109109        List<ImageEntry> list = getOneImage();
    110110
     
    120120
    121121    @Test
    122     public void testSelectPreviousImage() {
     122    void testSelectPreviousImage() {
    123123        List<ImageEntry> list = getOneImage();
    124124        list.add(new ImageEntry());
     
    136136
    137137    @Test
    138     public void testSetSelectedImage() {
     138    void testSetSelectedImage() {
    139139        List<ImageEntry> list = getOneImage();
    140140
     
    146146
    147147    @Test
    148     public void testClearSelectedImages() {
     148    void testClearSelectedImages() {
    149149        List<ImageEntry> list = getOneImage();
    150150
     
    156156
    157157    @Test
    158     public void testSelectionListener() {
     158    void testSelectionListener() {
    159159        List<ImageEntry> list = getOneImage();
    160160        ImageData data = new ImageData(list);
     
    175175
    176176    @Test
    177     public void testRemoveSelectedImage() {
     177    void testRemoveSelectedImage() {
    178178        List<ImageEntry> list = getOneImage();
    179179        ImageData data = new ImageData(list);
     
    185185
    186186    @Test
    187     public void testRemoveSelectedImages() {
     187    void testRemoveSelectedImages() {
    188188        List<ImageEntry> list = getOneImage();
    189189        list.add(new ImageEntry());
     
    198198
    199199    @Test
    200     public void testRemoveSelectedImagesWithRemainingImages() {
     200    void testRemoveSelectedImagesWithRemainingImages() {
    201201        List<ImageEntry> list = getOneImage();
    202202        list.add(new ImageEntry());
     
    212212
    213213    @Test
    214     public void testSelectImageAfterRemove() {
     214    void testSelectImageAfterRemove() {
    215215        List<ImageEntry> list = getOneImage();
    216216        list.add(new ImageEntry());
     
    225225
    226226    @Test
    227     public void testSelectImageAfterRemoveWhenTheLastIsSelected() {
     227    void testSelectImageAfterRemoveWhenTheLastIsSelected() {
    228228        List<ImageEntry> list = getOneImage();
    229229        list.add(new ImageEntry());
     
    238238
    239239    @Test
    240     public void testRemoveSelectedImageTriggerListener() {
     240    void testRemoveSelectedImageTriggerListener() {
    241241        List<ImageEntry> list = getOneImage();
    242242        list.add(new ImageEntry());
     
    258258
    259259    @Test
    260     public void testRemoveSelectedImagesTriggerListener() {
     260    void testRemoveSelectedImagesTriggerListener() {
    261261        List<ImageEntry> list = getOneImage();
    262262        list.add(new ImageEntry());
     
    278278
    279279    @Test
    280     public void testRemoveImageAndTriggerListener() {
     280    void testRemoveImageAndTriggerListener() {
    281281        List<ImageEntry> list = getOneImage();
    282282        ImageData data = new ImageData(list);
     
    297297
    298298    @Test
    299     public void testMergeFrom() {
     299    void testMergeFrom() {
    300300        ImageEntry image = new ImageEntry(new File("test2"));
    301301        List<ImageEntry> list1 = getOneImage();
     
    323323
    324324    @Test
    325     public void testMergeFromSelectedImage() {
     325    void testMergeFromSelectedImage() {
    326326        ImageEntry image = new ImageEntry(new File("test2"));
    327327        List<ImageEntry> list1 = getOneImage();
     
    340340
    341341    @Test
    342     public void testAddImageToSelection() {
     342    void testAddImageToSelection() {
    343343        List<ImageEntry> list = getOneImage();
    344344        list.add(new ImageEntry(new File("test2")));
     
    353353
    354354    @Test
    355     public void testRemoveImageToSelection() {
     355    void testRemoveImageToSelection() {
    356356        List<ImageEntry> list = getOneImage();
    357357        list.add(new ImageEntry());
     
    366366
    367367    @Test
    368     public void testIsSelected() {
     368    void testIsSelected() {
    369369        List<ImageEntry> list = getOneImage();
    370370        list.add(new ImageEntry(new File("test2")));
     
    381381
    382382    @Test
    383     public void testActionsWithMultipleImagesSelected() {
     383    void testActionsWithMultipleImagesSelected() {
    384384        List<ImageEntry> list = getOneImage();
    385385        list.add(new ImageEntry(new File("test2")));
     
    402402
    403403    @Test
    404     public void testTriggerListenerWhenNewImageIsSelectedAndRemoved() {
     404    void testTriggerListenerWhenNewImageIsSelectedAndRemoved() {
    405405        List<ImageEntry> list = getOneImage();
    406406        list.add(new ImageEntry());
     
    423423
    424424    @Test
    425     public void testUpdatePosition() {
     425    void testUpdatePosition() {
    426426        List<ImageEntry> list = getOneImage();
    427427        ImageData data = new ImageData(list);
     
    435435
    436436    @Test
    437     public void testUpdateDirection() {
     437    void testUpdateDirection() {
    438438        List<ImageEntry> list = getOneImage();
    439439        ImageData data = new ImageData(list);
     
    447447
    448448    @Test
    449     public void testTriggerListenerOnUpdate() {
     449    void testTriggerListenerOnUpdate() {
    450450        List<ImageEntry> list = getOneImage();
    451451        ImageData data = new ImageData(list);
     
    467467
    468468    @Test
    469     public void testManuallyTriggerUpdateListener() {
     469    void testManuallyTriggerUpdateListener() {
    470470        List<ImageEntry> list = getOneImage();
    471471        ImageData data = new ImageData(list);
  • trunk/test/unit/org/openstreetmap/josm/data/PreferencesTest.java

    r14149 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link Preferences}.
    1414 */
    15 public class PreferencesTest {
     15class PreferencesTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
     
    2626     */
    2727    @Test
    28     public void testToXml() {
     28    void testToXml() {
    2929        assertEquals(String.format(
    3030            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>%n" +
  • trunk/test/unit/org/openstreetmap/josm/data/PreferencesUtilsTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Before;
    7 import org.junit.Rule;
    8 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeEach;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
    1010
     
    1515 * Unit tests for class {@link PreferencesUtils}.
    1616 */
    17 public class PreferencesUtilsTest {
     17class PreferencesUtilsTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2727     * Setup test.
    2828     */
    29     @Before
     29    @BeforeEach
    3030    public void setUp() {
    3131        PreferencesUtils.resetLog();
     
    3636     */
    3737    @Test
    38     public void testLog() {
     38    void testLog() {
    3939        assertEquals("", PreferencesUtils.getLog());
    4040        PreferencesUtils.log("test");
     
    5151     */
    5252    @Test
    53     public void testUtilityClass() throws ReflectiveOperationException {
     53    void testUtilityClass() throws ReflectiveOperationException {
    5454        UtilityClassTestUtil.assertUtilityClassWellDefined(PreferencesUtils.class);
    5555    }
  • trunk/test/unit/org/openstreetmap/josm/data/ProjectionBoundsTest.java

    r10300 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77
    88/**
    99 * Unit tests for class {@link ProjectionBounds}.
    1010 */
    11 public class ProjectionBoundsTest {
     11class ProjectionBoundsTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testToString() {
     17    void testToString() {
    1818        assertEquals("ProjectionBounds[1.0,2.0,3.0,4.0]", new ProjectionBounds(1, 2, 3, 4).toString());
    1919    }
  • trunk/test/unit/org/openstreetmap/josm/data/UserIdentityManagerTest.java

    r14201 r17275  
    22package org.openstreetmap.josm.data;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertSame;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
     10import static org.junit.jupiter.api.Assertions.assertThrows;
     11
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1314import org.openstreetmap.josm.data.osm.User;
    1415import org.openstreetmap.josm.data.osm.UserInfo;
     
    2122 * Unit tests of {@link UserIdentityManager} class.
    2223 */
    23 public class UserIdentityManagerTest {
     24class UserIdentityManagerTest {
    2425
    2526    /**
    2627     * Setup test.
    2728     */
    28     @Rule
     29    @RegisterExtension
    2930    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3031    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4546     */
    4647    @Test
    47     public void testSingletonAccess() {
     48    void testSingletonAccess() {
    4849
    4950        UserIdentityManager im = UserIdentityManager.getInstance();
     
    6263     */
    6364    @Test
    64     public void testSetAnonymous() {
     65    void testSetAnonymous() {
    6566        UserIdentityManager im = UserIdentityManager.getInstance();
    6667
     
    8283     */
    8384    @Test
    84     public void testSetPartiallyIdentified() {
     85    void testSetPartiallyIdentified() {
    8586        UserIdentityManager im = UserIdentityManager.getInstance();
    8687        im.setPartiallyIdentified("test");
     
    101102     * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - null case.
    102103     */
    103     @Test(expected = IllegalArgumentException.class)
     104    @Test
    104105    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS")
    105     public void testSetPartiallyIdentifiedNull() {
    106         UserIdentityManager.getInstance().setPartiallyIdentified(null);
     106    void testSetPartiallyIdentifiedNull() {
     107        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(null));
    107108    }
    108109
     
    110111     * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - empty case.
    111112     */
    112     @Test(expected = IllegalArgumentException.class)
    113     public void testSetPartiallyIdentifiedEmpty() {
    114         UserIdentityManager.getInstance().setPartiallyIdentified("");
     113    @Test
     114    void testSetPartiallyIdentifiedEmpty() {
     115        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified(""));
    115116    }
    116117
     
    118119     * Unit test of {@link UserIdentityManager#setPartiallyIdentified} - blank case.
    119120     */
    120     @Test(expected = IllegalArgumentException.class)
    121     public void testSetPartiallyIdentifiedBlank() {
    122         UserIdentityManager.getInstance().setPartiallyIdentified("  \t  ");
     121    @Test
     122    void testSetPartiallyIdentifiedBlank() {
     123        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setPartiallyIdentified("  \t  "));
    123124    }
    124125
     
    127128     */
    128129    @Test
    129     public void testSetFullyIdentified() {
     130    void testSetFullyIdentified() {
    130131        UserIdentityManager im = UserIdentityManager.getInstance();
    131132
     
    149150     * Unit test of {@link UserIdentityManager#setFullyIdentified} - null name case.
    150151     */
    151     @Test(expected = IllegalArgumentException.class)
     152    @Test
    152153    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS")
    153     public void testSetFullyIdentifiedNullName() {
    154         UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo());
     154    void testSetFullyIdentifiedNullName() {
     155        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(null, newUserInfo()));
    155156    }
    156157
     
    158159     * Unit test of {@link UserIdentityManager#setFullyIdentified} - empty name case.
    159160     */
    160     @Test(expected = IllegalArgumentException.class)
    161     public void testSetFullyIdentifiedEmptyName() {
    162         UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo());
     161    @Test
     162    void testSetFullyIdentifiedEmptyName() {
     163        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("", newUserInfo()));
    163164    }
    164165
     
    166167     * Unit test of {@link UserIdentityManager#setFullyIdentified} - blank name case.
    167168     */
    168     @Test(expected = IllegalArgumentException.class)
    169     public void testSetFullyIdentifiedBlankName() {
    170         UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo());
     169    @Test
     170    void testSetFullyIdentifiedBlankName() {
     171        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified(" \t ", newUserInfo()));
    171172    }
    172173
     
    174175     * Unit test of {@link UserIdentityManager#setFullyIdentified} - null info case.
    175176     */
    176     @Test(expected = IllegalArgumentException.class)
    177     public void testSetFullyIdentifiedNullInfo() {
    178         UserIdentityManager.getInstance().setFullyIdentified("test", null);
     177    @Test
     178    void testSetFullyIdentifiedNullInfo() {
     179        assertThrows(IllegalArgumentException.class, () -> UserIdentityManager.getInstance().setFullyIdentified("test", null));
    179180    }
    180181
     
    183184     */
    184185    @Test
    185     public void testInitFromPreferences1() {
     186    void testInitFromPreferences1() {
    186187        UserIdentityManager im = UserIdentityManager.getInstance();
    187188
     
    208209     */
    209210    @Test
    210     public void testInitFromPreferences2() {
     211    void testInitFromPreferences2() {
    211212        UserIdentityManager im = UserIdentityManager.getInstance();
    212213
     
    233234     */
    234235    @Test
    235     public void testInitFromPreferences3() {
     236    void testInitFromPreferences3() {
    236237        UserIdentityManager im = UserIdentityManager.getInstance();
    237238
     
    260261     */
    261262    @Test
    262     public void testInitFromPreferences4() {
     263    void testInitFromPreferences4() {
    263264        UserIdentityManager im = UserIdentityManager.getInstance();
    264265
     
    286287     */
    287288    @Test
    288     public void testInitFromPreferences5() {
     289    void testInitFromPreferences5() {
    289290        UserIdentityManager im = UserIdentityManager.getInstance();
    290291
     
    307308
    308309    @Test
    309     public void testApiUrlChanged() {
     310    void testApiUrlChanged() {
    310311        UserIdentityManager im = UserIdentityManager.getInstance();
    311312
     
    344345
    345346    @Test
    346     public void testUserNameChanged() {
     347    void testUserNameChanged() {
    347348        UserIdentityManager im = UserIdentityManager.getInstance();
    348349
  • trunk/test/unit/org/openstreetmap/josm/data/VersionTest.java

    r16019 r17275  
    22package org.openstreetmap.josm.data;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.ByteArrayInputStream;
    88import java.nio.charset.StandardCharsets;
    99
    10 import org.junit.BeforeClass;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeAll;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.JOSMFixture;
    1313
     
    1515 * Unit tests for class {@link Version}.
    1616 */
    17 public class VersionTest {
     17class VersionTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @BeforeClass
     22    @BeforeAll
    2323    public static void setUpBeforeClass() {
    2424        JOSMFixture.createUnitTestFixture().init();
     
    2929     */
    3030    @Test
    31     public void testGetAgentString() {
     31    void testGetAgentString() {
    3232        Version version = new Version();
    3333        version.initFromRevisionInfo(null);
    3434        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);
    3636        v = version.getAgentString(true);
    37         assertTrue(v, v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"));
     37        assertTrue(v.matches("JOSM/1\\.5 \\(UNKNOWN en\\).*"), v);
    3838    }
    3939
     
    4242     */
    4343    @Test
    44     public void testInitFromRevisionInfoNull() {
     44    void testInitFromRevisionInfoNull() {
    4545        Version v = new Version();
    4646        v.initFromRevisionInfo(null);
     
    5252     */
    5353    @Test
    54     public void testInitFromRevisionInfoLocal() {
     54    void testInitFromRevisionInfoLocal() {
    5555        Version v = new Version();
    5656        v.initFromRevisionInfo(new ByteArrayInputStream(("\n" +
  • trunk/test/unit/org/openstreetmap/josm/data/cache/HostLimitQueueTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.cache;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.IOException;
     
    1212
    1313import org.apache.commons.jcs3.access.behavior.ICacheAccess;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.imagery.TMSCachedTileLoader;
    1717import org.openstreetmap.josm.data.imagery.TileJobOptions;
     
    2525 * @author Wiktor Niesiobedzki
    2626 */
    27 public class HostLimitQueueTest {
     27class HostLimitQueueTest {
    2828    /**
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20 * 1000);
     
    7979     */
    8080    @Test
    81     public void testSingleThreadPerHost() throws Exception {
     81    void testSingleThreadPerHost() throws Exception {
    8282        ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1);
    8383        ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, "");
     
    9696        // so it should take ~8 seconds to finish
    9797        // 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));
    100100    }
    101101
     
    105105     */
    106106    @Test
    107     public void testMultipleThreadPerHost() throws Exception {
     107    void testMultipleThreadPerHost() throws Exception {
    108108        ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 2);
    109109        ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, "");
     
    121121        // so it should take ~5 seconds to finish
    122122        // 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));
    125125    }
    126126
     
    130130     */
    131131    @Test
    132     public void testTwoHosts() throws Exception {
     132    void testTwoHosts() throws Exception {
    133133        ThreadPoolExecutor tpe = TMSCachedTileLoader.getNewThreadPoolExecutor("test-%d", 3, 1);
    134134        ICacheAccess<String, CacheEntry> cache = JCSCacheManager.getCache("test", 3, 0, "");
     
    147147        // so it should take ~5 seconds to finish
    148148        // 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));
    151151    }
    152152}
  • trunk/test/unit/org/openstreetmap/josm/data/cache/JCSCacheManagerTest.java

    r16398 r17275  
    22package org.openstreetmap.josm.data.cache;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.File;
     
    1111import org.apache.commons.jcs3.access.CacheAccess;
    1212import org.apache.commons.jcs3.auxiliary.disk.block.BlockDiskCacheAttributes;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
    1616
     
    2121 * Unit tests for class {@link JCSCacheManager}.
    2222 */
    23 public class JCSCacheManagerTest {
     23class JCSCacheManagerTest {
    2424
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
     
    3535     */
    3636    @Test
    37     public void testUtilityClass() throws ReflectiveOperationException {
     37    void testUtilityClass() throws ReflectiveOperationException {
    3838        UtilityClassTestUtil.assertUtilityClassWellDefined(JCSCacheManager.class);
    3939    }
     
    4444     */
    4545    @Test
    46     public void testLoggingAdaptor12054() throws IOException {
     46    void testLoggingAdaptor12054() throws IOException {
    4747        JCSCacheManager.getCache("foobar", 1, 0, "foobar"); // cause logging adaptor to be initialized
    4848        Logger.getLogger("org.apache.commons.jcs3").warning("{switch:0}");
     
    5050
    5151    @Test
    52     public void testUseBigDiskFile() throws IOException {
     52    void testUseBigDiskFile() throws IOException {
    5353        if (JCSCacheManager.USE_BLOCK_CACHE.get()) {
    5454            // test only when using block cache
     
    6565
    6666            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");
    6970        }
    7071    }
  • trunk/test/unit/org/openstreetmap/josm/data/coor/CachedLatLonTest.java

    r13079 r17275  
    44import java.text.DecimalFormat;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests for class {@link CachedLatLon}.
    1717 */
    18 public class CachedLatLonTest {
     18class CachedLatLonTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    2929     */
    3030    @Test
    31     public void testEqualsContract() {
     31    void testEqualsContract() {
    3232        TestUtils.assumeWorkingEqualsVerifier();
    3333        EqualsVerifier.forClass(CachedLatLon.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/coor/EastNorthTest.java

    r10915 r17275  
    22package org.openstreetmap.josm.data.coor;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77
    88/**
     
    1111 * @since 10915
    1212 */
    13 public class EastNorthTest {
     13class EastNorthTest {
    1414
    1515    /**
     
    1717     */
    1818    @Test
    19     public void testInterpolate() {
     19    void testInterpolate() {
    2020        EastNorth en1 = new EastNorth(0, 0);
    2121        EastNorth en2 = new EastNorth(30, 60);
     
    3737     */
    3838    @Test
    39     public void testGetCenter() {
     39    void testGetCenter() {
    4040        EastNorth en1 = new EastNorth(0, 0);
    4141        EastNorth en2 = new EastNorth(30, 60);
  • trunk/test/unit/org/openstreetmap/josm/data/coor/LatLonTest.java

    r15451 r17275  
    22package org.openstreetmap.josm.data.coor;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.text.DecimalFormat;
     
    1010import java.util.List;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.data.Bounds;
     
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules().projection();
     
    5252     */
    5353    @Test
    54     public void testRoundToOsmPrecision() {
     54    void testRoundToOsmPrecision() {
    5555
    5656        for (double value : SAMPLE_VALUES) {
     
    110110     */
    111111    @Test
    112     public void testToIntervalLat() {
     112    void testToIntervalLat() {
    113113        assertEquals(-90.0, LatLon.toIntervalLat(-90.0), 0);
    114114        assertEquals(0.0, LatLon.toIntervalLat(0.0), 0);
     
    123123     */
    124124    @Test
    125     public void testToIntervalLon() {
     125    void testToIntervalLon() {
    126126        assertEquals(-180.0, LatLon.toIntervalLon(-180.0), 0);
    127127        assertEquals(0.0, LatLon.toIntervalLon(0.0), 0);
     
    148148     */
    149149    @Test
    150     public void testEqualsContract() {
     150    void testEqualsContract() {
    151151        TestUtils.assumeWorkingEqualsVerifier();
    152152        EqualsVerifier.forClass(LatLon.class).usingGetClass()
     
    159159     */
    160160    @Test
    161     public void testCopyConstructor() {
     161    void testCopyConstructor() {
    162162        assertEquals(LatLon.NORTH_POLE, new LatLon(LatLon.NORTH_POLE));
    163163        assertEquals(LatLon.SOUTH_POLE, new LatLon(LatLon.SOUTH_POLE));
     
    169169     */
    170170    @Test
    171     public void testBearing() {
     171    void testBearing() {
    172172        LatLon c = new LatLon(47.000000, 19.000000);
    173173        LatLon e = new LatLon(47.000000, 19.000001);
     
    183183     */
    184184    @Test
    185     public void testDistance() {
     185    void testDistance() {
    186186        assertEquals(0.0, LatLon.ZERO.distance(LatLon.ZERO), 0);
    187187        assertEquals(90.0, LatLon.ZERO.distance(LatLon.NORTH_POLE), 0);
     
    193193     */
    194194    @Test
    195     public void testDistanceSq() {
     195    void testDistanceSq() {
    196196        assertEquals(0.0, LatLon.ZERO.distanceSq(LatLon.ZERO), 0);
    197197        assertEquals(90d*90d, LatLon.ZERO.distanceSq(LatLon.NORTH_POLE), 0);
     
    203203     */
    204204    @Test
    205     public void testInterpolate() {
     205    void testInterpolate() {
    206206        LatLon ll1 = new LatLon(0, 0);
    207207        LatLon ll2 = new LatLon(30, 60);
     
    225225    @Test
    226226    @Deprecated
    227     public void testIsOutSideWorld() {
     227    void testIsOutSideWorld() {
    228228        assertFalse(LatLon.ZERO.isOutSideWorld());
    229229        assertTrue(LatLon.NORTH_POLE.isOutSideWorld());
     
    237237     */
    238238    @Test
    239     public void testIsValid() {
     239    void testIsValid() {
    240240        assertTrue(LatLon.ZERO.isValid());
    241241        assertTrue(LatLon.NORTH_POLE.isValid());
     
    252252     */
    253253    @Test
    254     public void testIsWithin() {
     254    void testIsWithin() {
    255255        assertTrue(LatLon.ZERO.isWithin(new Bounds(LatLon.ZERO)));
    256256        assertFalse(LatLon.ZERO.isWithin(new Bounds(LatLon.NORTH_POLE)));
     
    261261     */
    262262    @Test
    263     public void testGetCenter() {
     263    void testGetCenter() {
    264264        LatLon ll1 = new LatLon(0, 0);
    265265        LatLon ll2 = new LatLon(30, 60);
  • trunk/test/unit/org/openstreetmap/josm/data/coor/PolarCoorTest.java

    r13107 r17275  
    22package org.openstreetmap.josm.data.coor;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.text.DecimalFormat;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * Test the {@link PolarCoor} class.
    1919 */
    20 public class PolarCoorTest {
     20class PolarCoorTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().projection();
     
    3131     */
    3232    @Test
    33     public void testPolarCoor() {
     33    void testPolarCoor() {
    3434        EastNorth en = new EastNorth(1000, 500);
    3535        PolarCoor pc = new PolarCoor(en);
     
    5050     */
    5151    @Test
    52     public void testEqualsContract() {
     52    void testEqualsContract() {
    5353        TestUtils.assumeWorkingEqualsVerifier();
    5454        EqualsVerifier.forClass(PolarCoor.class).usingGetClass()
     
    6161     */
    6262    @Test
    63     public void testToString() {
     63    void testToString() {
    6464        assertEquals("PolarCoor [radius=1118.033988749, angle=0.463647609, pole=EastNorth[e=0.0, n=0.0]]",
    6565                new PolarCoor(1118.033988749, 0.463647609).toString());
  • trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/ICoordinateFormatTest.java

    r16438 r17275  
    22package org.openstreetmap.josm.data.coor.conversion;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.coor.ILatLon;
    1111import org.openstreetmap.josm.data.coor.LatLon;
     
    1515 * Test for {@link ICoordinateFormat} implementations.
    1616 */
    17 public class ICoordinateFormatTest {
     17class ICoordinateFormatTest {
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().projection();
     
    3030     */
    3131    @Test
    32     public void testFormatting() {
     32    void testFormatting() {
    3333        LatLon c = new LatLon(47.000000, 19.000000);
    3434        assertEquals("47.0", DecimalDegreesCoordinateFormat.INSTANCE.latToString(c));
  • trunk/test/unit/org/openstreetmap/josm/data/coor/conversion/LatLonParserTest.java

    r12795 r17275  
    22package org.openstreetmap.josm.data.coor.conversion;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
     6
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.openstreetmap.josm.data.coor.LatLon;
     10import org.openstreetmap.josm.testutils.JOSMTestRules;
    511
    612import 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;
    1213
    1314/**
    1415 * Unit tests for class {@link LatLonParser}.
    1516 */
    16 public class LatLonParserTest {
     17class LatLonParserTest {
    1718
    1819    /**
    1920     * Setup test.
    2021     */
    21     @Rule
     22    @RegisterExtension
    2223    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2324    public JOSMTestRules test = new JOSMTestRules().projection();
     
    2728     */
    2829    @Test
    29     public void testParse() {
     30    void testParse() {
    3031        assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("49.29918° 19.24788°"));
    3132        assertEquals(new LatLon(49.29918, 19.24788), LatLonParser.parse("N 49.29918 E 19.24788°"));
     
    5455     * Unit test of {@link LatLonParser#parse} method - invalid case 1.
    5556     */
    56     @Test(expected = IllegalArgumentException.class)
    57     public void 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"));
    5960    }
    6061
     
    6263     * Unit test of {@link LatLonParser#parse} method - invalid case 2.
    6364     */
    64     @Test(expected = IllegalArgumentException.class)
    65     public void 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"));
    6768    }
    6869
  • trunk/test/unit/org/openstreetmap/josm/data/correction/TagCorrectionTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.data.correction;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1313 * Unit tests for class {@link TagCorrection}.
    1414 */
    15 public class TagCorrectionTest {
     15class TagCorrectionTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testEqualsContract() {
     28    void testEqualsContract() {
    2929        TestUtils.assumeWorkingEqualsVerifier();
    3030        EqualsVerifier.forClass(TagCorrection.class).usingGetClass().verify();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxDataTest.java

    r15502 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
    910
    1011import java.io.IOException;
     
    1819import java.util.stream.Stream;
    1920
    20 import org.junit.Before;
    21 import org.junit.Rule;
    22 import org.junit.Test;
     21import org.junit.jupiter.api.BeforeEach;
     22import org.junit.jupiter.api.Test;
     23import org.junit.jupiter.api.extension.RegisterExtension;
    2324import org.openstreetmap.josm.TestUtils;
    2425import org.openstreetmap.josm.data.Bounds;
     
    4142 * Unit tests for class {@link GpxData}.
    4243 */
    43 public class GpxDataTest {
     44class GpxDataTest {
    4445
    4546    /**
    4647     * Setup test.
    4748     */
    48     @Rule
     49    @RegisterExtension
    4950    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5051    public JOSMTestRules test = new JOSMTestRules().projection();
     
    5556     * Set up empty test data
    5657     */
    57     @Before
     58    @BeforeEach
    5859    public void setUp() {
    5960        data = new GpxData();
     
    6465     */
    6566    @Test
    66     public void testMergeFrom() {
     67    void testMergeFrom() {
    6768        GpxTrack track = singleWaypointGpxTrack();
    6869        GpxRoute route = singleWaypointRoute();
     
    9394     */
    9495    @Test
    95     public void testMergeFromFiles() throws Exception {
     96    void testMergeFromFiles() throws Exception {
    9697        testMerge(false, false, "Merged-all"); // regular merging
    9798        testMerge(true, false, "Merged-cut"); // cut overlapping tracks, but do not connect them
     
    106107        own.put(GpxConstants.META_BOUNDS, null);
    107108        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!");
    109110    }
    110111
     
    117118     */
    118119    @Test
    119     public void testTracks() {
     120    void testTracks() {
    120121        assertEquals(0, data.getTracks().size());
    121122
     
    138139     * Test method for {@link GpxData#addTrack(IGpxTrack)}.
    139140     */
    140     @Test(expected = IllegalArgumentException.class)
    141     public void testAddTrackFails() {
     141    @Test
     142    void testAddTrackFails() {
    142143        GpxTrack track1 = emptyGpxTrack();
    143144        data.addTrack(track1);
    144         data.addTrack(track1);
     145        assertThrows(IllegalArgumentException.class, () -> data.addTrack(track1));
    145146    }
    146147
     
    148149     * Test method for {@link GpxData#removeTrack(IGpxTrack)}.
    149150     */
    150     @Test(expected = IllegalArgumentException.class)
    151     public void testRemoveTrackFails() {
     151    @Test
     152    void testRemoveTrackFails() {
    152153        GpxTrack track1 = emptyGpxTrack();
    153154        data.addTrack(track1);
    154155        data.removeTrack(track1);
    155         data.removeTrack(track1);
     156        assertThrows(IllegalArgumentException.class, () -> data.removeTrack(track1));
    156157    }
    157158
     
    160161     */
    161162    @Test
    162     public void testRoutes() {
     163    void testRoutes() {
    163164        assertEquals(0, data.getTracks().size());
    164165
     
    182183     * Test method for {@link GpxData#addRoute(GpxRoute)}.
    183184     */
    184     @Test(expected = IllegalArgumentException.class)
    185     public void testAddRouteFails() {
     185    @Test
     186    void testAddRouteFails() {
    186187        GpxRoute route1 = new GpxRoute();
    187188        data.addRoute(route1);
    188         data.addRoute(route1);
     189        assertThrows(IllegalArgumentException.class, () -> data.addRoute(route1));
    189190    }
    190191
     
    192193     * Test method for {@link GpxData#removeRoute(GpxRoute)}.
    193194     */
    194     @Test(expected = IllegalArgumentException.class)
    195     public void testRemoveRouteFails() {
     195    @Test
     196    void testRemoveRouteFails() {
    196197        GpxRoute route1 = new GpxRoute();
    197198        data.addRoute(route1);
    198199        data.removeRoute(route1);
    199         data.removeRoute(route1);
     200        assertThrows(IllegalArgumentException.class, () -> data.removeRoute(route1));
    200201    }
    201202
     
    204205     */
    205206    @Test
    206     public void testWaypoints() {
     207    void testWaypoints() {
    207208        assertEquals(0, data.getTracks().size());
    208209
     
    225226     * Test method for {@link GpxData#addWaypoint(WayPoint)}.
    226227     */
    227     @Test(expected = IllegalArgumentException.class)
    228     public void testAddWaypointFails() {
     228    @Test
     229    void testAddWaypointFails() {
    229230        WayPoint waypoint1 = new WayPoint(LatLon.ZERO);
    230231        data.addWaypoint(waypoint1);
    231         data.addWaypoint(waypoint1);
     232        assertThrows(IllegalArgumentException.class, () -> data.addWaypoint(waypoint1));
    232233    }
    233234
     
    235236     * Test method for {@link GpxData#removeWaypoint(WayPoint)}.
    236237     */
    237     @Test(expected = IllegalArgumentException.class)
    238     public void testRemoveWaypointFails() {
     238    @Test
     239    void testRemoveWaypointFails() {
    239240        WayPoint waypoint1 = new WayPoint(LatLon.ZERO);
    240241        data.addWaypoint(waypoint1);
    241242        data.removeWaypoint(waypoint1);
    242         data.removeWaypoint(waypoint1);
     243        assertThrows(IllegalArgumentException.class, () -> data.removeWaypoint(waypoint1));
    243244    }
    244245
     
    247248     */
    248249    @Test
    249     public void testHasTrackPoints() {
     250    void testHasTrackPoints() {
    250251        assertFalse(data.hasTrackPoints());
    251252        GpxTrack track1 = emptyGpxTrack();
     
    261262     */
    262263    @Test
    263     public void testGetTrackPoints() {
     264    void testGetTrackPoints() {
    264265        assertEquals(0, data.getTrackPoints().count());
    265266        GpxTrack track1 = singleWaypointGpxTrack();
     
    275276     */
    276277    @Test
    277     public void testHasRoutePoints() {
     278    void testHasRoutePoints() {
    278279
    279280    }
     
    283284     */
    284285    @Test
    285     public void testIsEmpty() {
     286    void testIsEmpty() {
    286287        GpxTrack track1 = singleWaypointGpxTrack();
    287288        WayPoint waypoint = new WayPoint(LatLon.ZERO);
     
    310311     */
    311312    @Test
    312     public void testLength() {
     313    void testLength() {
    313314        GpxTrack track1 = waypointGpxTrack(
    314315                new WayPoint(new LatLon(0, 0)),
     
    328329     */
    329330    @Test
    330     public void testGetMinMaxTimeForAllTracks() {
     331    void testGetMinMaxTimeForAllTracks() {
    331332        assertEquals(0, data.getMinMaxTimeForAllTracks().length);
    332333
     
    352353     */
    353354    @Test
    354     public void testNearestPointOnTrack() {
     355    void testNearestPointOnTrack() {
    355356        List<WayPoint> points = Stream
    356357                .of(new EastNorth(10, 10), new EastNorth(10, 0), new EastNorth(-1, 0))
     
    378379     */
    379380    @Test
    380     public void testGetDataSources() {
     381    void testGetDataSources() {
    381382        DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test");
    382383        data.dataSources.add(ds);
     
    388389     */
    389390    @Test
    390     public void testGetDataSourceArea() {
     391    void testGetDataSourceArea() {
    391392        DataSource ds = new DataSource(new Bounds(0, 0, 1, 1), "test");
    392393        data.dataSources.add(ds);
     
    400401     */
    401402    @Test
    402     public void testGetDataSourceBounds() {
     403    void testGetDataSourceBounds() {
    403404        Bounds bounds = new Bounds(0, 0, 1, 1);
    404405        DataSource ds = new DataSource(bounds, "test");
     
    413414     */
    414415    @Test
    415     public void testChangeListener() {
     416    void testChangeListener() {
    416417        TestChangeListener cl1 = new TestChangeListener();
    417418        TestChangeListener cl2 = new TestChangeListener();
     
    474475     */
    475476    @Test
    476     public void testEqualsContract() {
     477    void testEqualsContract() {
    477478        TestUtils.assumeWorkingEqualsVerifier();
    478479        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxExtensionTest.java

    r15629 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.gui.layer.gpx.ConvertToDataLayerActionTest;
     
    1717 * Unit tests for class {@link GpxExtension}
    1818 */
    19 public class GpxExtensionTest {
     19class GpxExtensionTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3333     */
    3434    @Test
    35     public void testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java

    r15431 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.Arrays;
    1010import java.util.List;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.TestUtils;
    1616import org.openstreetmap.josm.data.coor.CachedLatLon;
     
    2828 * Unit tests of {@link GpxImageCorrelation} class.
    2929 */
    30 public class GpxImageCorrelationTest {
     30class GpxImageCorrelationTest {
    3131
    3232    /**
    3333     * Setup test.
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules();
     
    4040     * Setup test.
    4141     */
    42     @BeforeClass
     42    @BeforeAll
    4343    public static void setUp() {
    4444        DateUtilsTest.setTimeZone(DateUtils.UTC);
     
    5050     */
    5151    @Test
    52     public void testMatchGpxTrack() throws Exception {
     52    void testMatchGpxTrack() throws Exception {
    5353        IPreferences s = Config.getPref();
    5454        final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks.gpx");
     
    274274     */
    275275    @Test
    276     public void testGetElevation() {
     276    void testGetElevation() {
    277277        assertNull(GpxImageCorrelation.getElevation(null));
    278278        WayPoint wp = new WayPoint(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageEntryTest.java

    r14209 r17275  
    44import java.io.File;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link GpxImageEntry} class.
    1717 */
    18 public class GpxImageEntryTest {
     18class GpxImageEntryTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    2929     */
    3030    @Test
    31     public void testEqualsContract() {
     31    void testEqualsContract() {
    3232        TestUtils.assumeWorkingEqualsVerifier();
    3333        EqualsVerifier.forClass(GpxImageEntry.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxOffsetTest.java

    r14205 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.text.ParseException;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212import org.openstreetmap.josm.tools.date.DateUtils;
     
    1818 * Unit tests of {@link GpxTimeOffset} class.
    1919 */
    20 public class GpxOffsetTest {
     20class GpxOffsetTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3030     * Setup test.
    3131     */
    32     @BeforeClass
     32    @BeforeAll
    3333    public static void setUp() {
    3434        DateUtilsTest.setTimeZone(DateUtils.UTC);
     
    3939     */
    4040    @Test
    41     public void testFormatOffset() {
     41    void testFormatOffset() {
    4242        assertEquals("0", GpxTimeOffset.seconds(0).formatOffset());
    4343        assertEquals("123", GpxTimeOffset.seconds(123).formatOffset());
     
    5555     */
    5656    @Test
    57     public void testParseOffest() throws ParseException {
     57    void testParseOffest() throws ParseException {
    5858        assertEquals(0, GpxTimeOffset.parseOffset("0").getSeconds());
    5959        assertEquals(4242L, GpxTimeOffset.parseOffset("4242").getSeconds());
     
    6969     */
    7070    @Test
    71     public void testSplitOutTimezone() {
     71    void testSplitOutTimezone() {
    7272        assertEquals("+1:00", GpxTimeOffset.seconds(3602).splitOutTimezone().a.formatTimezone());
    7373        assertEquals("2", GpxTimeOffset.seconds(3602).splitOutTimezone().b.formatOffset());
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxRouteTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.data.coor.LatLon;
     
    1515 * Unit tests for class {@link GpxRoute}.
    1616 */
    17 public class GpxRouteTest {
     17class GpxRouteTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testEqualsContract() {
     30    void testEqualsContract() {
    3131        TestUtils.assumeWorkingEqualsVerifier();
    3232        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTimezoneTest.java

    r14205 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.text.ParseException;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212import org.openstreetmap.josm.tools.date.DateUtils;
     
    1818 * Unit tests of {@link GpxTimezone} class.
    1919 */
    20 public class GpxTimezoneTest {
     20class GpxTimezoneTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3030     * Setup test.
    3131     */
    32     @BeforeClass
     32    @BeforeAll
    3333    public static void setUp() {
    3434        DateUtilsTest.setTimeZone(DateUtils.UTC);
     
    3939     */
    4040    @Test
    41     public void testFormatTimezone() {
     41    void testFormatTimezone() {
    4242        assertEquals("+1:00", new GpxTimezone(1).formatTimezone());
    4343        assertEquals("+6:30", new GpxTimezone(6.5).formatTimezone());
     
    5252     */
    5353    @Test
    54     public void testParseTimezone() throws ParseException {
     54    void testParseTimezone() throws ParseException {
    5555        assertEquals(1, GpxTimezone.parseTimezone("+01:00").getHours(), 1e-3);
    5656        assertEquals(1, GpxTimezone.parseTimezone("+1:00").getHours(), 1e-3);
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackSegmentTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.data.coor.LatLon;
     
    1515 * Unit tests for class {@link GpxTrackSegment}.
    1616 */
    17 public class GpxTrackSegmentTest {
     17class GpxTrackSegmentTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testEqualsContract() {
     30    void testEqualsContract() {
    3131        TestUtils.assumeWorkingEqualsVerifier();
    3232        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxTrackTest.java

    r15560 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    77import java.awt.Color;
     
    99import java.util.HashMap;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2222 * Unit tests for class {@link GpxTrack}.
    2323 */
    24 public class GpxTrackTest {
     24class GpxTrackTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules();
     
    3535     */
    3636    @Test
    37     public void testColors() {
     37    void testColors() {
    3838        GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>());
    3939        GpxExtensionCollection ext = trk.getExtensions();
     
    6161     */
    6262    @Test
    63     public void testEqualsContract() {
     63    void testEqualsContract() {
    6464        TestUtils.assumeWorkingEqualsVerifier();
    6565        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/WayPointTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests for class {@link WayPoint}.
    1515 */
    16 public class WayPointTest {
     16class WayPointTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testEqualsContract() {
     29    void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
    3131        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/WithAttributesTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.data.gpx;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests for class {@link WithAttributes}.
    1515 */
    16 public class WithAttributesTest {
     16class WithAttributesTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testEqualsContract() {
     29    void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
    3131        GpxExtensionCollection col = new GpxExtensionCollection();
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelperTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.data.imagery;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1414 * Unit tests for class {@link GetCapabilitiesParseHelper}.
    1515 */
    16 public class GetCapabilitiesParseHelperTest {
     16class GetCapabilitiesParseHelperTest {
    1717
    1818    /**
    1919     * Setup tests
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testUtilityClass() throws ReflectiveOperationException {
     30    void testUtilityClass() throws ReflectiveOperationException {
    3131        UtilityClassTestUtil.assertUtilityClassWellDefined(GetCapabilitiesParseHelper.class);
    3232    }
     
    3636     */
    3737    @Test
    38     public void testCrsToCode() {
     38    void testCrsToCode() {
    3939        assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg:3127"));
    4040        assertEquals("EPSG:3127", GetCapabilitiesParseHelper.crsToCode("urn:ogc:def:crs:epsg::3127"));
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/ImageryInfoTest.java

    r12851 r17275  
    22package org.openstreetmap.josm.data.imagery;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
     
    1010import java.util.Set;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.data.StructUtils;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2323 *
    2424 */
    25 public class ImageryInfoTest {
     25class ImageryInfoTest {
    2626
    2727    /**
    2828     * Setup tests
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testGetExtendedUrl() {
     38    void testGetExtendedUrl() {
    3939        ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null);
    4040        testImageryTMS.setDefaultMinZoom(16);
     
    4747     */
    4848    @Test
    49     public void testConstruct13264() {
     49    void testConstruct13264() {
    5050        final ImageryInfo info = new ImageryInfo("test imagery", "tms[16-23]:http://localhost");
    5151        assertEquals(ImageryInfo.ImageryType.TMS, info.getImageryType());
     
    5656
    5757    /**
    58      * Tests the {@linkplain StructUtils#serializeStruct(Object, Class) serialization} of {@link ImageryInfo.ImageryPreferenceEntry}
     58     * Tests the {@linkplain StructUtils#serializeStruct serialization} of {@link ImageryInfo.ImageryPreferenceEntry}
    5959     */
    6060    @Test
    61     public void testSerializeStruct() {
     61    void testSerializeStruct() {
    6262        final ImageryInfo.ImageryPreferenceEntry info = new ImageryInfo.ImageryPreferenceEntry();
    6363        info.noTileHeaders = new MultiMap<>();
     
    7272     */
    7373    @Test
    74     public void testDeserializeStruct() {
     74    void testDeserializeStruct() {
    7575        final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct(
    7676                Collections.singletonMap("noTileHeaders", "{\"ETag\":[\"foo\",\"bar\"]}"), ImageryInfo.ImageryPreferenceEntry.class);
     
    8787     */
    8888    @Test
    89     public void testDeserializeStructTicket12474() {
     89    void testDeserializeStructTicket12474() {
    9090        final ImageryInfo.ImageryPreferenceEntry info = StructUtils.deserializeStruct(
    9191                Collections.singletonMap("noTileHeaders", "{\"ETag\":\"foo-and-bar\"}"), ImageryInfo.ImageryPreferenceEntry.class);
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/ShapeTest.java

    r16436 r17275  
    22package org.openstreetmap.josm.data.imagery;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
    99
    1010/**
    1111 * Unit tests for class {@link Shape}.
    1212 */
    13 public class ShapeTest {
     13class ShapeTest {
    1414
    1515    /**
     
    1717     */
    1818    @Test
    19     public void test() {
     19    void test() {
    2020        Shape shape = new Shape();
    2121        shape.addPoint("47.1", "11.1");
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java

    r17094 r17275  
    22package org.openstreetmap.josm.data.imagery;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    99import org.openstreetmap.gui.jmapviewer.TileXY;
    1010import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
     
    2424 * Unit tests for class {@link TemplatedWMSTileSource}.
    2525 */
    26 public class TemplatedWMSTileSourceTest {
     26class TemplatedWMSTileSourceTest {
    2727
    2828    private final ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null);
     
    3232     * Setup test.
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules test = new JOSMTestRules();
     
    4040     */
    4141    @Test
    42     public void testEPSG3857() {
     42    void testEPSG3857() {
    4343        Projection projection = Projections.getProjectionByCode("EPSG:3857");
    4444        ProjectionRegistry.setProjection(projection);
     
    6565     */
    6666    @Test
    67     public void testEPSG4326() {
     67    void testEPSG4326() {
    6868        Projection projection = Projections.getProjectionByCode("EPSG:4326");
    6969        ProjectionRegistry.setProjection(projection);
     
    8181     */
    8282    @Test
    83     public void testEPSG4326widebounds() {
     83    void testEPSG4326widebounds() {
    8484        Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54");
    8585        ProjectionRegistry.setProjection(projection);
     
    9494     */
    9595    @Test
    96     public void testEPSG4326narrowbounds() {
     96    void testEPSG4326narrowbounds() {
    9797        Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90");
    9898        ProjectionRegistry.setProjection(projection);
     
    107107     */
    108108    @Test
    109     public void testEPSG2180() {
     109    void testEPSG2180() {
    110110        Projection projection = Projections.getProjectionByCode("EPSG:2180");
    111111        ProjectionRegistry.setProjection(projection);
     
    124124     */
    125125    @Test
    126     public void testEPSG3006withbounds() {
     126    void testEPSG3006withbounds() {
    127127        Projection projection =
    128128                new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 "
     
    140140     */
    141141    @Test
    142     public void testEPSG3006withoutbounds() {
     142    void testEPSG3006withoutbounds() {
    143143        Projection projection =
    144144                new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 "
     
    156156     */
    157157    @Test
    158     public void testGetTileUrl() {
     158    void testGetTileUrl() {
    159159        // "https://maps.six.nsw.gov.au/arcgis/services/public/NSW_Imagery_Dates/MapServer/WMSServer?
    160160        // SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&CRS={proj}&BBOX={bbox}&WIDTH={width}&HEIGHT={height}
     
    206206        ICoordinate expected = verifier.tileXYToLatLon(x, y, z - 1);
    207207        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);
    209209        LatLon tileCenter = new Bounds(result, getTileLatLon(source, x+1, y+1, z)).getCenter();
    210210        TileXY backwardsResult = source.latLonToTileXY(CoordinateConversion.llToCoor(tileCenter), z);
     
    224224    private void verifyLocation(TemplatedWMSTileSource source, LatLon location, int z) {
    225225        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");
    230227
    231228        TileXY tileIndex = source.latLonToTileXY(CoordinateConversion.llToCoor(location), z);
    232229
    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);
    238235
    239236        ICoordinate x1 = source.tileXYToLatLon(tileIndex.getXIndex(), tileIndex.getYIndex(), z);
     
    245242        bounds.extend(x2.getLat(), x2.getLon());
    246243        // 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());
    249246        verifyTileSquareness(source, tileIndex.getXIndex(), tileIndex.getYIndex(), z);
    250247    }
  • trunk/test/unit/org/openstreetmap/josm/data/notes/NoteCommentTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.data.notes;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Date;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
    1313
     
    1717 * Unit tests for class {@link NoteComment}.
    1818 */
    19 public class NoteCommentTest {
     19class NoteCommentTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3030     */
    3131    @Test
    32     public void testNoteComment() {
     32    void testNoteComment() {
    3333        NoteComment comment = new NoteComment(new Date(), null, "foo", null, true);
    3434        assertEquals("foo", comment.toString());
  • trunk/test/unit/org/openstreetmap/josm/data/notes/NoteTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.data.notes;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotEquals;
    66
    77import java.util.Date;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212import org.openstreetmap.josm.data.coor.LatLon;
     
    2020 * Unit tests for class {@link NoteComment}.
    2121 */
    22 public class NoteTest {
     22class NoteTest {
    2323
    2424    /**
    2525     * Setup test.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    3333     */
    3434    @Test
    35     public void testToString() {
     35    void testToString() {
    3636        Note note = new Note(LatLon.ZERO);
    3737        assertEquals("Note 0: null", note.toString());
     
    4444     */
    4545    @Test
    46     public void testUpdateWith() {
     46    void testUpdateWith() {
    4747        Note n1 = new Note(LatLon.ZERO);
    4848        n1.setId(1);
     
    5858     */
    5959    @Test
    60     public void testEqualsContract() {
     60    void testEqualsContract() {
    6161        TestUtils.assumeWorkingEqualsVerifier();
    6262        EqualsVerifier.forClass(Note.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java

    r14119 r17275  
    22package org.openstreetmap.josm.data.oauth;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotEquals;
    6 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotEquals;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.TestUtils;
    1111import org.openstreetmap.josm.spi.preferences.Config;
     
    1919 * Unit tests for class {@link OAuthParameters}.
    2020 */
    21 public class OAuthParametersTest {
     21class OAuthParametersTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules();
     
    3333    @Test
    3434    @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
    35     public void testCreateDefault() {
     35    void testCreateDefault() {
    3636        OAuthParameters def = OAuthParameters.createDefault();
    3737        assertNotNull(def);
     
    5050     */
    5151    @Test
    52     public void testEqualsContract() {
     52    void testEqualsContract() {
    5353        TestUtils.assumeWorkingEqualsVerifier();
    5454        EqualsVerifier.forClass(OAuthParameters.class).usingGetClass().verify();
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthTokenTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.data.oauth;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
    66
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99
     
    1414 * Unit tests for class {@link OAuthToken}.
    1515 */
    16 public class OAuthTokenTest {
     16class OAuthTokenTest {
    1717
    1818    /**
     
    2020     */
    2121    @Test
    22     public void testCreateToken() {
     22    void testCreateToken() {
    2323        OAuthConsumer defCon = OAuthParameters.createDefault().buildConsumer();
    2424        assertNotNull(defCon);
     
    3434     */
    3535    @Test
    36     public void testEqualsContract() {
     36    void testEqualsContract() {
    3737        TestUtils.assumeWorkingEqualsVerifier();
    3838        EqualsVerifier.forClass(OAuthToken.class).usingGetClass().verify();
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OsmPrivilegesTest.java

    r9666 r17275  
    22package org.openstreetmap.josm.data.oauth;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
    88
    99/**
    1010 * Unit tests for class {@link OsmPrivileges}.
    1111 */
    12 public class OsmPrivilegesTest {
     12class OsmPrivilegesTest {
    1313
    1414    /**
     
    1616     */
    1717    @Test
    18     public void testGettersSetters() {
     18    void testGettersSetters() {
    1919        OsmPrivileges p = new OsmPrivileges();
    2020        assertFalse(p.isAllowModifyNotes());
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/SignpostAdaptersTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.data.oauth;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    89import java.io.IOException;
     
    1011import java.net.URL;
    1112
    12 import org.junit.Rule;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1415import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpRequest;
    1516import org.openstreetmap.josm.data.oauth.SignpostAdapters.HttpResponse;
     
    2425 * Unit tests for class {@link SignpostAdapters}.
    2526 */
    26 public class SignpostAdaptersTest {
     27class SignpostAdaptersTest {
    2728
    2829    /**
    2930     * Setup test.
    3031     */
    31     @Rule
     32    @RegisterExtension
    3233    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3334    public JOSMTestRules test = new JOSMTestRules().https();
     
    4243     */
    4344    @Test
    44     public void testUtilityClass() throws ReflectiveOperationException {
     45    void testUtilityClass() throws ReflectiveOperationException {
    4546        UtilityClassTestUtil.assertUtilityClassWellDefined(SignpostAdapters.class);
    4647    }
     
    5152     */
    5253    @Test
    53     public void testOAuthConsumerWrap() throws MalformedURLException {
     54    void testOAuthConsumerWrap() throws MalformedURLException {
    5455        assertNotNull(new OAuthConsumer("", "").wrap(newClient()));
    5556    }
     
    6061     */
    6162    @Test
    62     public void testHttpRequestGetMessagePayload() throws IOException {
     63    void testHttpRequestGetMessagePayload() throws IOException {
    6364        assertNull(new HttpRequest(newClient()).getMessagePayload());
    6465    }
     
    6667    /**
    6768     * Unit test of method {@link SignpostAdapters.HttpRequest#setRequestUrl}.
    68      * @throws IOException never
    6969     */
    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));
    7373    }
    7474
    7575    /**
    7676     * Unit test of method {@link SignpostAdapters.HttpRequest#getAllHeaders}.
    77      * @throws IOException never
    7877     */
    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());
    8281    }
    8382
    8483    /**
    8584     * Unit test of method {@link SignpostAdapters.HttpRequest#unwrap}.
    86      * @throws IOException never
    8785     */
    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());
    9189    }
    9290
     
    9694     */
    9795    @Test
    98     public void testHttpResponseGetReasonPhrase() throws Exception {
     96    void testHttpResponseGetReasonPhrase() throws Exception {
    9997        assertEquals("OK", new HttpResponse(new HttpRequest(newClient()).request.connect()).getReasonPhrase());
    10098    }
     
    102100    /**
    103101     * Unit test of method {@link SignpostAdapters.HttpResponse#unwrap}.
    104      * @throws IOException never
    105102     */
    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());
    109106    }
    110107}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/AbstractPrimitiveTest.java

    r12027 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Collections;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212
     
    1616 * Unit tests of the {@code AbstractPrimitive} class.
    1717 */
    18 public class AbstractPrimitiveTest {
     18class AbstractPrimitiveTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    2929     */
    3030    @Test
    31     public void testIsUndeleted() {
     31    void testIsUndeleted() {
    3232        AbstractPrimitive p = new Node(1);
    3333        p.setVisible(false);
     
    6060     */
    6161    @Test
    62     public void testHasTagDifferent() {
     62    void testHasTagDifferent() {
    6363        AbstractPrimitive p = new Node();
    6464
  • trunk/test/unit/org/openstreetmap/josm/data/osm/BBoxTest.java

    r16673 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.TestUtils;
    1111import org.openstreetmap.josm.data.coor.LatLon;
     
    1919 * Unit tests for class {@link BBox}.
    2020 */
    21 public class BBoxTest {
     21class BBoxTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules();
     
    3232     */
    3333    @Test
    34     public void testEqualsContract() {
     34    void testEqualsContract() {
    3535        TestUtils.assumeWorkingEqualsVerifier();
    3636        EqualsVerifier.forClass(BBox.class).usingGetClass()
     
    4343     */
    4444    @Test
    45     public void testBboxesAreFunctionallyEqual() {
     45    void testBboxesAreFunctionallyEqual() {
    4646        BBox bbox1 = new BBox(0, 1, 1, 0);
    4747        BBox bbox2 = new BBox(0.1, 0.9, 0.9, 0.1);
     
    6363     */
    6464    @Test
    65     public void testLatLonConstructor() {
     65    void testLatLonConstructor() {
    6666        LatLon latLon1 = new LatLon(10, 20);
    6767        LatLon latLon2 = new LatLon(20, 10);
     
    9595     */
    9696    @Test
    97     public void testDoubleConstructor() {
     97    void testDoubleConstructor() {
    9898        assertTrue(new BBox(1, 2, 3, 4).isValid());
    9999        assertFalse(new BBox(Double.NaN, 2, 3, 4).isValid());
     
    107107     */
    108108    @Test
    109     public void testNodeConstructor() {
     109    void testNodeConstructor() {
    110110        assertTrue(new BBox(new Node(LatLon.NORTH_POLE)).isValid());
    111111        assertFalse(new BBox(new Node()).isValid());
     
    116116     */
    117117    @Test
    118     public void testAddLatLon() {
     118    void testAddLatLon() {
    119119        BBox b = new BBox();
    120120        b.add((LatLon) null);
     
    130130     */
    131131    @Test
    132     public void testAddLatLonBuffer() {
     132    void testAddLatLonBuffer() {
    133133        BBox b = new BBox();
    134134        b.addLatLon(LatLon.NORTH_POLE, 0.5);
     
    142142     */
    143143    @Test
    144     public void testAddDouble() {
     144    void testAddDouble() {
    145145        BBox b = new BBox();
    146146        b.add(1, Double.NaN);
     
    157157     */
    158158    @Test
    159     public void testAddPrimitive() {
     159    void testAddPrimitive() {
    160160        BBox b = new BBox();
    161161        b.addPrimitive(new Node(LatLon.NORTH_POLE), 0.5);
     
    169169     */
    170170    @Test
    171     public void testHeightWidthArea() {
     171    void testHeightWidthArea() {
    172172        BBox b1 = new BBox(1, 2, 3, 5);
    173173        assertEquals(2, b1.width(), 1e-7);
     
    184184     */
    185185    @Test
    186     public void testToString() {
     186    void testToString() {
    187187        assertEquals("[ x: Infinity -> -Infinity, y: Infinity -> -Infinity ]", new BBox().toString());
    188188        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  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.Arrays;
     
    1313import java.util.concurrent.TimeUnit;
    1414
    15 import org.junit.After;
    16 import org.junit.Before;
    17 import org.junit.Rule;
    18 import org.junit.Test;
     15import org.junit.jupiter.api.AfterEach;
     16import org.junit.jupiter.api.BeforeEach;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.data.UserIdentityManager;
    2020import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2626 * Unit test of {@link ChangesetCache}
    2727 */
    28 public class ChangesetCacheTest {
     28class ChangesetCacheTest {
    2929
    3030    /**
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    4040     * Clears cache before/after each unit test.
    4141     */
    42     @After
    43     @Before
     42    @AfterEach
     43    @BeforeEach
    4444    public void clearCache() {
    4545        cache.listeners.clear();
     
    7373     */
    7474    @Test
    75     public void testConstructor() {
     75    void testConstructor() {
    7676        assertNotNull(ChangesetCache.getInstance());
    7777    }
    7878
    7979    @Test
    80     public void testAddAndRemoveListeners() {
     80    void testAddAndRemoveListeners() {
    8181        // should work
    8282        cache.addChangesetCacheListener(null);
     
    9797
    9898    @Test
    99     public void testUpdateGetRemoveCycle() {
     99    void testUpdateGetRemoveCycle() {
    100100        cache.update(new Changeset(1));
    101101        assertEquals(1, cache.size());
     
    107107
    108108    @Test
    109     public void testUpdateTwice() {
     109    void testUpdateTwice() {
    110110        Changeset cs = new Changeset(1);
    111111        cs.setIncomplete(false);
     
    130130
    131131    @Test
    132     public void testContains() {
     132    void testContains() {
    133133        Changeset cs = new Changeset(1);
    134134        cache.update(cs);
     
    144144
    145145    @Test
    146     public void testFireingEventsAddAChangeset() {
     146    void testFireingEventsAddAChangeset() {
    147147        TestListener listener = new TestListener() {
    148148            @Override
    149             public void test() {
     149            void test() {
    150150                await();
    151151                assertNotNull(event);
     
    163163
    164164    @Test
    165     public void testFireingEventsUpdateChangeset() {
     165    void testFireingEventsUpdateChangeset() {
    166166        // Waiter listener to ensure the second listener does not receive the first event
    167167        TestListener waiter = new TestListener() {
     
    195195
    196196    @Test
    197     public void testFireingEventsRemoveChangeset() {
     197    void testFireingEventsRemoveChangeset() {
    198198        // Waiter listener to ensure the second listener does not receive the first event
    199199        TestListener waiter = new TestListener() {
     
    229229     */
    230230    @Test
    231     public void testGetOpenChangesets() {
     231    void testGetOpenChangesets() {
    232232        // 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.");
    241235
    242236        // cache with only closed changesets => empty list
     
    244238        closedCs.setOpen(false);
    245239        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.");
    250242        assertEquals(1, cache.getChangesets().size());
    251243
     
    265257     */
    266258    @Test
    267     public void testGetOpenChangesetsForCurrentUser() {
     259    void testGetOpenChangesetsForCurrentUser() {
    268260        // 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.");
    273263
    274264        Changeset openCs1 = new Changeset(1);
     
    299289     */
    300290    @Test
    301     public void testRemove() {
     291    void testRemove() {
    302292        Changeset cs1 = new Changeset(1);
    303293        cache.update(cs1);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDataSetTest.java

    r14961 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.util.Date;
    1010import java.util.Iterator;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     
    2525 * Unit tests for class {@link ChangesetDataSet}.
    2626 */
    27 public class ChangesetDataSetTest {
     27class ChangesetDataSetTest {
    2828
    2929    /**
    3030     * Setup test.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    3838     */
    3939    @Test
    40     public void testIterator() {
     40    void testIterator() {
    4141        final ChangesetDataSet cds = new ChangesetDataSet();
    4242        HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);
     
    6060     */
    6161    @Test
    62     public void testGetEntry() {
     62    void testGetEntry() {
    6363        final ChangesetDataSet cds = new ChangesetDataSet();
    6464        HistoryNode prim1 = new HistoryNode(1, 1, true, User.getAnonymous(), 1, new Date(), LatLon.ZERO);
     
    8080     */
    8181    @Test
    82     public void testEnumChangesetModificationType() {
     82    void testEnumChangesetModificationType() {
    8383        TestUtils.superficialEnumCodeCoverage(ChangesetModificationType.class);
    8484    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetDiscussionCommentTest.java

    r12035 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Date;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    1515 * Unit tests for class {@link ChangesetDiscussionComment}.
    1616 */
    17 public class ChangesetDiscussionCommentTest {
     17class ChangesetDiscussionCommentTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testChangesetDiscussionComment() {
     30    void testChangesetDiscussionComment() {
    3131        Date d = new Date(1000);
    3232        User foo = User.createOsmUser(1, "foo");
     
    4141     */
    4242    @Test
    43     public void testText() {
     43    void testText() {
    4444        ChangesetDiscussionComment cdc = new ChangesetDiscussionComment(new Date(), null);
    4545        cdc.setText("foo");
  • trunk/test/unit/org/openstreetmap/josm/data/osm/ChangesetTest.java

    r16436 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88import static org.openstreetmap.josm.data.osm.Changeset.MAX_CHANGESET_TAG_LENGTH;
    99
     
    1717
    1818import org.junit.Assert;
    19 import org.junit.Rule;
    20 import org.junit.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
     20import org.junit.jupiter.api.Test;
    2121import org.openstreetmap.josm.data.Bounds;
    2222import org.openstreetmap.josm.data.coor.LatLon;
     
    2929 * Unit tests for class {@link Changeset}.
    3030 */
    31 public class ChangesetTest {
     31class ChangesetTest {
    3232
    3333    /**
    3434     * Setup test.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules();
     
    4343    @Test
    4444    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS")
    45     public void testSetKeys() {
     45    void testSetKeys() {
    4646        final Changeset cs = new Changeset();
    4747        // Cannot add null map => IllegalArgumentException
     
    8282     */
    8383    @Test
    84     public void testCompareTo() {
     84    void testCompareTo() {
    8585        Changeset cs1 = new Changeset(1);
    8686        Changeset cs2 = new Changeset(2);
     
    9494     */
    9595    @Test
    96     public void testGetBounds() {
     96    void testGetBounds() {
    9797        Changeset cs = new Changeset();
    9898        assertNull(cs.getBounds());
     
    112112     */
    113113    @Test
    114     public void testGetSetHasContent() {
     114    void testGetSetHasContent() {
    115115        Changeset cs = new Changeset();
    116116        assertNull(cs.getContent());
     
    126126     */
    127127    @Test
    128     public void testGetDisplayName() {
     128    void testGetDisplayName() {
    129129        assertEquals("Changeset 0", new Changeset().getDisplayName(DefaultNameFormatter.getInstance()));
    130130    }
     
    134134     */
    135135    @Test
    136     public void testGetName() {
     136    void testGetName() {
    137137        assertEquals("changeset 0", new Changeset().getName());
    138138    }
     
    148148     */
    149149    @Test
    150     public void testHasEqualSemanticAttributes() {
     150    void testHasEqualSemanticAttributes() {
    151151        Date today = new Date();
    152152        Changeset cs1 = new Changeset();
     
    244244     */
    245245    @Test
    246     public void testKeySet() {
     246    void testKeySet() {
    247247        Changeset cs = new Changeset();
    248248        assertTrue(cs.keySet().isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataIntegrityProblemExceptionTest.java

    r12036 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    7 import org.junit.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
    1010
     
    1414 * Unit tests for class {@link DataIntegrityProblemException}.
    1515 */
    16 public class DataIntegrityProblemExceptionTest {
     16class DataIntegrityProblemExceptionTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testDataIntegrityException() {
     29    void testDataIntegrityException() {
    3030        DataIntegrityProblemException e1 = new DataIntegrityProblemException("foo");
    3131        assertEquals("foo", e1.getMessage());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetMergerTest.java

    r16657 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNotSame;
     8import static org.junit.jupiter.api.Assertions.assertSame;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
     10import static org.junit.jupiter.api.Assertions.fail;
    1111
    1212import java.io.StringWriter;
     
    1515import java.util.Date;
    1616
    17 import org.junit.After;
    18 import org.junit.Before;
    19 import org.junit.Rule;
    20 import org.junit.Test;
     17import org.junit.jupiter.api.AfterEach;
     18import org.junit.jupiter.api.BeforeEach;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2121import org.openstreetmap.josm.data.coor.LatLon;
    2222import org.openstreetmap.josm.data.projection.ProjectionRegistry;
     
    2929 * Unit tests for class {@link DataSetMerger}.
    3030 */
    31 public class DataSetMergerTest {
     31class DataSetMergerTest {
    3232
    3333    /**
    3434     * Setup test.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules();
     
    4444     * Setup test.
    4545     */
    46     @Before
     46    @BeforeEach
    4747    public void setUp() {
    4848        my = new DataSet();
     
    6767    }
    6868
    69     @After
     69    @AfterEach
    7070    public void checkDatasets() {
    7171        runConsistencyTests(my);
     
    8080     */
    8181    @Test
    82     public void testNodeSimpleIdenticalNoConflict() {
     82    void testNodeSimpleIdenticalNoConflict() {
    8383        Node n = new Node(LatLon.ZERO);
    8484        n.setOsmId(1, 1);
     
    114114     */
    115115    @Test
    116     public void testNodeSimpleLocallyUnmodifiedNoConflict() {
     116    void testNodeSimpleLocallyUnmodifiedNoConflict() {
    117117        Node n = new Node(LatLon.ZERO);
    118118        n.setOsmId(1, 1);
     
    154154     */
    155155    @Test
    156     public void testNodeSimpleTagConflict() {
     156    void testNodeSimpleTagConflict() {
    157157        Node n = new Node(LatLon.ZERO);
    158158        n.setOsmId(1, 1);
     
    188188     */
    189189    @Test
    190     public void testNodeSimpleDeleteConflict() {
     190    void testNodeSimpleDeleteConflict() {
    191191        Node n = new Node(1, 1);
    192192        n.setCoor(LatLon.ZERO);
     
    218218     */
    219219    @Test
    220     public void testNodeSimpleDeleteConflict2() {
     220    void testNodeSimpleDeleteConflict2() {
    221221        Node n = new Node(LatLon.ZERO);
    222222        n.setOsmId(1, 1);
     
    246246     */
    247247    @Test
    248     public void testNodeSimpleDeleteConflict3() {
     248    void testNodeSimpleDeleteConflict3() {
    249249        Node n = new Node(new LatLon(1, 1));
    250250        n.setDeleted(true);
     
    269269     */
    270270    @Test
    271     public void testNodeSimpleDeleteConflict4() {
     271    void testNodeSimpleDeleteConflict4() {
    272272        Node n = new Node(new LatLon(1, 1));
    273273        n.setDeleted(true);
     
    294294     */
    295295    @Test
    296     public void testNodeSimpleNoIdSemanticallyEqual() {
     296    void testNodeSimpleNoIdSemanticallyEqual() {
    297297
    298298        User myUser = User.createOsmUser(1111, "my");
     
    334334     */
    335335    @Test
    336     public void testNodeSimpleIncompleteNode() {
     336    void testNodeSimpleIncompleteNode() {
    337337
    338338        Node n = new Node(1);
     
    364364     */
    365365    @Test
    366     public void testWaySimpleIdenticalNodesDifferentTags() {
     366    void testWaySimpleIdenticalNodesDifferentTags() {
    367367
    368368        // -- the target dataset
     
    436436     */
    437437    @Test
    438     public void testWaySimpleAdditionalNodesAndChangedNodes() {
     438    void testWaySimpleAdditionalNodesAndChangedNodes() {
    439439
    440440        // -- my data set
     
    505505     */
    506506    @Test
    507     public void testWaySimpleDifferentNodesAndMyIsModified() {
     507    void testWaySimpleDifferentNodesAndMyIsModified() {
    508508
    509509        // -- the target dataset
     
    569569     */
    570570    @Test
    571     public void testWaySimpleTheirVersionNotVisibleMyIsModified() {
     571    void testWaySimpleTheirVersionNotVisibleMyIsModified() {
    572572
    573573        Node mn1 = new Node(LatLon.ZERO);
     
    611611     */
    612612    @Test
    613     public void testWaySimpleTwoWaysWithNoIdNodesWithId() {
     613    void testWaySimpleTwoWaysWithNoIdNodesWithId() {
    614614
    615615        // -- my data set
     
    668668     */
    669669    @Test
    670     public void testWaySimpleTwoWaysWithNoIdNodesWithoutId() {
     670    void testWaySimpleTwoWaysWithNoIdNodesWithoutId() {
    671671
    672672        // -- my data set
     
    723723     */
    724724    @Test
    725     public void testWayComplexMergingADeletedNode() {
     725    void testWayComplexMergingADeletedNode() {
    726726
    727727        // -- my dataset
     
    777777     */
    778778    @Test
    779     public void testRelationComplexMergingADeletedNode() {
     779    void testRelationComplexMergingADeletedNode() {
    780780
    781781        Node mn1 = new Node(LatLon.ZERO);
     
    826826     */
    827827    @Test
    828     public void testNewIncompleteWay() {
     828    void testNewIncompleteWay() {
    829829
    830830        Node n1 = new Node(1);
     
    868868     */
    869869    @Test
    870     public void testIncompleteWayOntoCompleteWay() {
     870    void testIncompleteWayOntoCompleteWay() {
    871871
    872872        // an incomplete node
     
    923923     */
    924924    @Test
    925     public void testTwoCompleteNodesOntoAnIncompleteWay() {
     925    void testTwoCompleteNodesOntoAnIncompleteWay() {
    926926
    927927        // -- source dataset
     
    10091009     */
    10101010    @Test
    1011     public void testTicket07481ab() {
     1011    void testTicket07481ab() {
    10121012        doTestTicket7481(my, their);
    10131013    }
     
    10171017     */
    10181018    @Test
    1019     public void testTicket07481ba() {
     1019    void testTicket07481ba() {
    10201020        doTestTicket7481(their, my);
    10211021    }
     
    10251025     */
    10261026    @Test
    1027     public void testTicket12599() {
     1027    void testTicket12599() {
    10281028        // Server node: no modifications
    10291029        Node n1 = new Node(1, 1);
     
    10651065     */
    10661066    @Test
    1067     public void testTicket12616() {
     1067    void testTicket12616() {
    10681068        // Server node: no modifications
    10691069        Node n1 = new Node(1, 1);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/DataSetTest.java

    r17190 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.ArrayList;
     
    1212
    1313import org.junit.Assert;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.TestUtils;
    1717import org.openstreetmap.josm.data.Bounds;
     
    2727 * Unit tests for class {@link DataSet}.
    2828 */
    29 public class DataSetTest {
     29class DataSetTest {
    3030
    3131    /**
    3232     * Setup test.
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules test = new JOSMTestRules();
     
    4040     */
    4141    @Test
    42     public void testSearchRelations() {
     42    void testSearchRelations() {
    4343        final DataSet ds = new DataSet();
    4444        // null bbox => empty list
     
    7272     */
    7373    @Test
    74     public void testSearchPrimitives() {
     74    void testSearchPrimitives() {
    7575        final DataSet ds = new DataSet();
    7676        // null bbox => empty list
     
    9999     */
    100100    @Test
    101     public void testChangesetTags() {
     101    void testChangesetTags() {
    102102        final DataSet ds = new DataSet();
    103103        assertTrue(ds.getChangeSetTags().isEmpty());
     
    112112     */
    113113    @Test
    114     public void testAllNonDeleted() {
     114    void testAllNonDeleted() {
    115115        final DataSet ds = new DataSet();
    116116        assertTrue(ds.allNonDeletedPrimitives().isEmpty());
     
    142142     */
    143143    @Test
    144     public void testTicket14186() {
     144    void testTicket14186() {
    145145        final DataSet ds = new DataSet();
    146146        Node n1 = new Node(1);
     
    163163     */
    164164    @Test
    165     public void testTicket19438() {
     165    void testTicket19438() {
    166166        final DataSet ds = new DataSet();
    167167        Node n1 = new Node(1);
     
    184184     */
    185185    @Test
    186     public void testSelectionOrderPreserved() {
     186    void testSelectionOrderPreserved() {
    187187        final DataSet ds = new DataSet();
    188188        Node n1 = new Node(1);
     
    222222     */
    223223    @Test
    224     public void testCopyConstructor() {
     224    void testCopyConstructor() {
    225225        DataSet ds = new DataSet();
    226226        assertEqualsDataSet(ds, new DataSet(ds));
     
    249249     */
    250250    @Test
    251     public void testMergePolicies() {
     251    void testMergePolicies() {
    252252        DataSet ds1 = new DataSet();
    253253        DataSet ds2 = new DataSet();
     
    293293     */
    294294    @Test
    295     public void testEnumOrder() {
     295    void testEnumOrder() {
    296296        assertTrue(DownloadPolicy.BLOCKED.compareTo(DownloadPolicy.NORMAL) > 0);
    297297        assertTrue(UploadPolicy.BLOCKED.compareTo(UploadPolicy.NORMAL) > 0);
     
    304304     */
    305305    @Test
    306     public void testAddDataSourceListener() {
     306    void testAddDataSourceListener() {
    307307        DataSourceListener addListener = new DataSourceListener() {
    308308            @Override
     
    322322     */
    323323    @Test
    324     public void testRemoveDataSourceListener() {
     324    void testRemoveDataSourceListener() {
    325325        DataSourceListener removeListener = new DataSourceListener() {
    326326            @Override
     
    340340     */
    341341    @Test
    342     public void testCloneReadOnly() {
     342    void testCloneReadOnly() {
    343343        DataSet ds = new DataSet();
    344344        Node n1 = new Node(LatLon.SOUTH_POLE);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/FilterTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.InputStream;
     
    1515import java.util.List;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
     18import org.junit.jupiter.api.Test;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.data.coor.LatLon;
     
    3333 * Unit tests for class {@link Filter}.
    3434 */
    35 public class FilterTest {
     35class FilterTest {
    3636
    3737    /**
    3838     * Setup test.
    3939     */
    40     @Rule
     40    @RegisterExtension
    4141    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4242    public JOSMTestRules test = new JOSMTestRules();
    4343
    4444    @Test
    45     public void testBasic() throws SearchParseError {
     45    void testBasic() throws SearchParseError {
    4646        DataSet ds = new DataSet();
    4747        Node n1 = new Node(LatLon.ZERO);
     
    7171
    7272    @Test
    73     public void testFilter() throws Exception {
     73    void testFilter() throws Exception {
    7474        for (int i : new int[] {1, 2, 3, 11, 12, 13, 14, 15}) {
    7575            DataSet ds;
     
    197197     */
    198198    @Test
    199     public void testFilterPreferenceEntry() {
     199    void testFilterPreferenceEntry() {
    200200        Filter f = new Filter();
    201201        FilterPreferenceEntry fpe = f.getPreferenceEntry();
     
    243243     */
    244244    @Test
    245     public void testEqualsContract() {
     245    void testEqualsContract() {
    246246        TestUtils.assumeWorkingEqualsVerifier();
    247247        EqualsVerifier.forClass(FilterPreferenceEntry.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/osm/MultipolygonBuilderTest.java

    r15130 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertNull;
    55
    66import java.io.InputStream;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.TestUtils;
    1111import org.openstreetmap.josm.io.OsmReader;
     
    1717 * Unit tests of the {@code MultipolygonBuilder} class.
    1818 */
    19 public class MultipolygonBuilderTest {
     19class MultipolygonBuilderTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules().projection().timeout(15000);
     
    3131     */
    3232    @Test
    33     public void testTicket12376() throws Exception {
     33    void testTicket12376() throws Exception {
    3434        try (InputStream is = TestUtils.getRegressionDataStream(12376, "multipolygon_hang.osm.bz2")) {
    3535            for (Relation r : OsmReader.parseDataSet(is, null).getRelations()) {
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NodeDataTest.java

    r11324 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertNull;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.ByteArrayInputStream;
     
    1212
    1313import org.junit.Assert;
    14 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.coor.LatLon;
    1616
    1717import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1818
    19 public class NodeDataTest {
     19class NodeDataTest {
    2020
    2121    @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION")
     
    3131
    3232    @Test
    33     public void testSerializationForDragAndDrop() throws Exception {
     33    void testSerializationForDragAndDrop() throws Exception {
    3434        final NodeData data = new NodeData();
    3535        data.setCoor(new LatLon(31.14, 15.9));
     
    4646     */
    4747    @Test
    48     public void testTicket13395() throws Exception {
     48    void testTicket13395() throws Exception {
    4949        Node n = new Node(1925320646, 1);
    5050        n.setCoor(null);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NodeGraphTest.java

    r12478 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Arrays;
     
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.testutils.JOSMTestRules;
    1414
     
    1818 * Unit tests of the {@code NodeGraph} class.
    1919 */
    20 public class NodeGraphTest {
     20class NodeGraphTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3131     */
    3232    @Test
    33     public void testNodePairs() {
     33    void testNodePairs() {
    3434        assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), true).isEmpty());
    3535        assertTrue(NodeGraph.buildNodePairs(Collections.emptyList(), false).isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NodeTest.java

    r16077 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
     9import static org.junit.jupiter.api.Assertions.assertThrows;
    910
    10 import org.junit.Rule;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1213import org.openstreetmap.josm.data.Bounds;
    1314import org.openstreetmap.josm.data.DataSource;
     
    2122 * Unit tests of the {@code Node} class.
    2223 */
    23 public class NodeTest {
     24class NodeTest {
    2425
    2526    /**
    2627     * Setup test.
    2728     */
    28     @Rule
     29    @RegisterExtension
    2930    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3031    public JOSMTestRules test = new JOSMTestRules().projection();
     
    3435     */
    3536    @Test
    36     public void testTicket12060() {
     37    void testTicket12060() {
    3738        DataSet ds = new DataSet();
    3839        ds.addDataSource(new DataSource(new Bounds(LatLon.ZERO), null));
     
    5152     */
    5253    @Test
    53     public void testBBox() {
     54    void testBBox() {
    5455        DataSet ds = new DataSet();
    5556        Node n1 = new Node(1);
     
    8586     * Test that {@link Node#cloneFrom} throws IAE for invalid arguments
    8687     */
    87     @Test(expected = IllegalArgumentException.class)
    88     public void testCloneFromIAE() {
    89         new Node().cloneFrom(new Way());
     88    @Test
     89    void testCloneFromIAE() {
     90        assertThrows(IllegalArgumentException.class, () -> new Node().cloneFrom(new Way()));
    9091    }
    9192
     
    9394     * Test that {@link Node#mergeFrom} throws IAE for invalid arguments
    9495     */
    95     @Test(expected = IllegalArgumentException.class)
    96     public void testMergeFromIAE() {
    97         new Node().mergeFrom(new Way());
     96    @Test
     97    void testMergeFromIAE() {
     98        assertThrows(IllegalArgumentException.class, () -> new Node().mergeFrom(new Way()));
    9899    }
    99100
     
    101102     * Test that {@link Node#load} throws IAE for invalid arguments
    102103     */
    103     @Test(expected = IllegalArgumentException.class)
    104     public void testLoadIAE() {
    105         new Node().load(new WayData());
     104    @Test
     105    void testLoadIAE() {
     106        assertThrows(IllegalArgumentException.class, () -> new Node().load(new WayData()));
    106107    }
    107108
     
    110111     */
    111112    @Test
    112     public void testOutsideWorld() {
     113    void testOutsideWorld() {
    113114        Node n = new Node(1, 1);
    114115        n.setCoor(LatLon.ZERO);
     
    134135     */
    135136    @Test
    136     public void testDirectional() {
     137    void testDirectional() {
    137138        assertFalse(OsmUtils.createPrimitive("node oneway=yes").hasDirectionKeys());
    138139    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/NoteDataTest.java

    r14101 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010import org.openstreetmap.josm.data.notes.Note;
     
    1313 * Unit tests of the {@code NoteData} class.
    1414 */
    15 public class NoteDataTest {
     15class NoteDataTest {
    1616
    1717    /**
     
    1919     */
    2020    @Test
    21     public void testNoteData() {
     21    void testNoteData() {
    2222        NoteData empty = new NoteData();
    2323        assertEquals(0, empty.getNotes().size());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveKeyHandlingTest.java

    r11933 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1717 * {@link Node} for the tests, {@link OsmPrimitive} is abstract.
    1818 */
    19 public class OsmPrimitiveKeyHandlingTest {
     19class OsmPrimitiveKeyHandlingTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3030     */
    3131    @Test
    32     public void testEmptyNode() {
     32    void testEmptyNode() {
    3333        Node n = new Node();
    3434        testKeysSize(n, 0);
     
    4444     */
    4545    @Test
    46     public void testPut() {
     46    void testPut() {
    4747        Node n = new Node();
    4848        n.put("akey", "avalue");
     
    5656     */
    5757    @Test
    58     public void testPut2() {
     58    void testPut2() {
    5959        Node n = new Node();
    6060        n.put("key.1", "value.1");
     
    7474    @Test
    7575    @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test that equals is used and not ==")
    76     public void testRemove() {
     76    void testRemove() {
    7777        Node n = new Node();
    7878        n.put("key.1", "value.1");
     
    106106     */
    107107    @Test
    108     public void testRemoveAll() {
     108    void testRemoveAll() {
    109109        Node n = new Node();
    110110
     
    121121     */
    122122    @Test
    123     public void testHasEqualSemanticAttributes() {
     123    void testHasEqualSemanticAttributes() {
    124124        Node n1 = new Node(1);
    125125        n1.setCoor(LatLon.ZERO);
     
    139139     */
    140140    @Test
    141     public void testHasEqualSemanticAttributes2() {
     141    void testHasEqualSemanticAttributes2() {
    142142        Node n1 = new Node(1);
    143143        n1.setCoor(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTest.java

    r16913 r17275  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
     3
     4import static org.junit.jupiter.api.Assertions.assertThrows;
    35
    46import java.util.Arrays;
     
    68
    79import org.junit.Assert;
    8 import org.junit.BeforeClass;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeAll;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1113import org.openstreetmap.josm.data.coor.LatLon;
    1214import org.openstreetmap.josm.data.projection.ProjectionRegistry;
     
    1921 * Unit tests of the {@code OsmPrimitive} class.
    2022 */
    21 public class OsmPrimitiveTest {
     23class OsmPrimitiveTest {
    2224
    2325    /**
    2426     * Setup test.
    2527     */
    26     @Rule
     28    @RegisterExtension
    2729    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2830    public JOSMTestRules test = new JOSMTestRules();
     
    3840     * Setup test.
    3941     */
    40     @BeforeClass
     42    @BeforeAll
    4143    public static void setUp() {
    4244        ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
     
    4446
    4547    @Test
    46     public void testSimpleReferrersTest() {
     48    void testSimpleReferrersTest() {
    4749        Node n1 = new Node(LatLon.ZERO);
    4850        Way w1 = new Way();
     
    5456
    5557    @Test
    56     public void testAddAndRemoveReferrer() {
     58    void testAddAndRemoveReferrer() {
    5759        Node n1 = new Node(LatLon.ZERO);
    5860        Node n2 = new Node(LatLon.ZERO);
     
    7072
    7173    @Test
    72     public void testMultipleReferrers() {
     74    void testMultipleReferrers() {
    7375        Node n1 = new Node(LatLon.ZERO);
    7476        Way w1 = new Way();
     
    8688
    8789    @Test
    88     public void testRemoveMemberFromRelationReferrerTest() {
     90    void testRemoveMemberFromRelationReferrerTest() {
    8991        Node n1 = new Node(LatLon.ZERO);
    9092        Relation r1 = new Relation();
     
    98100
    99101    @Test
    100     public void testSetRelationMemberReferrerTest() {
     102    void testSetRelationMemberReferrerTest() {
    101103        Node n1 = new Node(LatLon.ZERO);
    102104        Node n2 = new Node(LatLon.ZERO);
     
    115117
    116118    @Test
    117     public void testRemovePrimitiveReferrerTest() {
     119    void testRemovePrimitiveReferrerTest() {
    118120        Node n1 = new Node(LatLon.ZERO);
    119121        Way w1 = new Way();
     
    137139
    138140    @Test
    139     public void testNodeFromMultipleDatasets() {
     141    void testNodeFromMultipleDatasets() {
    140142        // n has two referrers - w1 and w2. But only w1 is returned because it is in the same dataset as n
    141143        Node n = new Node(LatLon.ZERO);
     
    151153    }
    152154
    153     @Test(expected = DataIntegrityProblemException.class)
    154     public void testCheckMustBeInDatasate() {
     155    @Test
     156    void testCheckMustBeInDatasate() {
    155157        Node n = new Node();
    156         n.getReferrers();
     158        assertThrows(DataIntegrityProblemException.class, () -> n.getReferrers());
    157159    }
    158160}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmPrimitiveTypeTest.java

    r12027 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    89import java.util.Collection;
    910
    10 import org.junit.Rule;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1213import org.openstreetmap.josm.TestUtils;
    1314import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1819 * Unit tests of the {@code OsmPrimitiveType} class.
    1920 */
    20 public class OsmPrimitiveTypeTest {
     21class OsmPrimitiveTypeTest {
    2122
    2223    /**
    2324     * Setup test.
    2425     */
    25     @Rule
     26    @RegisterExtension
    2627    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2728    public JOSMTestRules test = new JOSMTestRules();
     
    3132     */
    3233    @Test
    33     public void testEnum() {
     34    void testEnum() {
    3435        TestUtils.superficialEnumCodeCoverage(OsmPrimitiveType.class);
    3536    }
     
    3940     */
    4041    @Test
    41     public void testGetApiName() {
     42    void testGetApiName() {
    4243        assertEquals("node", OsmPrimitiveType.NODE.getAPIName());
    4344        assertEquals("way", OsmPrimitiveType.WAY.getAPIName());
     
    4950     */
    5051    @Test
    51     public void testGetOsmClass() {
     52    void testGetOsmClass() {
    5253        assertEquals(Node.class, OsmPrimitiveType.NODE.getOsmClass());
    5354        assertEquals(Way.class, OsmPrimitiveType.WAY.getOsmClass());
     
    6162     */
    6263    @Test
    63     public void testGetDataClass() {
     64    void testGetDataClass() {
    6465        assertEquals(NodeData.class, OsmPrimitiveType.NODE.getDataClass());
    6566        assertEquals(WayData.class, OsmPrimitiveType.WAY.getDataClass());
     
    7374     */
    7475    @Test
    75     public void testFromApiTypeName() {
     76    void testFromApiTypeName() {
    7677        assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.fromApiTypeName("node"));
    7778        assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.fromApiTypeName("way"));
     
    8283     * Unit test of {@link OsmPrimitiveType#fromApiTypeName} method - error case.
    8384     */
    84     @Test(expected = IllegalArgumentException.class)
    85     public void testFromApiTypeNameError() {
    86         OsmPrimitiveType.fromApiTypeName("foo");
     85    @Test
     86    void testFromApiTypeNameError() {
     87        assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.fromApiTypeName("foo"));
    8788    }
    8889
     
    9192     */
    9293    @Test
    93     public void testFromIPrimitive() {
     94    void testFromIPrimitive() {
    9495        assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from(new Node()));
    9596        assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from(new Way()));
     
    100101     * Unit test of {@link OsmPrimitiveType#from(IPrimitive)} method - error case.
    101102     */
    102     @Test(expected = IllegalArgumentException.class)
    103     public void testFromIPrimitiveError() {
    104         OsmPrimitiveType.from((IPrimitive) null);
     103    @Test
     104    void testFromIPrimitiveError() {
     105        assertThrows(IllegalArgumentException.class, () -> OsmPrimitiveType.from((IPrimitive) null));
    105106    }
    106107
     
    109110     */
    110111    @Test
    111     public void testFromString() {
     112    void testFromString() {
    112113        assertEquals(OsmPrimitiveType.NODE, OsmPrimitiveType.from("node"));
    113114        assertEquals(OsmPrimitiveType.WAY, OsmPrimitiveType.from("WAY"));
     
    122123     */
    123124    @Test
    124     public void testDataValues() {
     125    void testDataValues() {
    125126        Collection<OsmPrimitiveType> values = OsmPrimitiveType.dataValues();
    126127        assertEquals(3, values.size());
     
    134135     */
    135136    @Test
    136     public void testNewInstance() {
     137    void testNewInstance() {
    137138        OsmPrimitive n = OsmPrimitiveType.NODE.newInstance(1, false);
    138139        OsmPrimitive w = OsmPrimitiveType.WAY.newInstance(2, false);
     
    151152     * Unit test of {@link OsmPrimitiveType#newInstance} method - error case.
    152153     */
    153     @Test(expected = AssertionError.class)
    154     public void testNewInstanceError() {
    155         OsmPrimitiveType.CLOSEDWAY.newInstance(1, false);
     154    @Test
     155    void testNewInstanceError() {
     156        assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newInstance(1, false));
    156157    }
    157158
     
    160161     */
    161162    @Test
    162     public void testNewVersionedInstance() {
     163    void testNewVersionedInstance() {
    163164        OsmPrimitive n = OsmPrimitiveType.NODE.newVersionedInstance(1, 4);
    164165        OsmPrimitive w = OsmPrimitiveType.WAY.newVersionedInstance(2, 5);
     
    181182     * Unit test of {@link OsmPrimitiveType#newVersionedInstance} method - error case.
    182183     */
    183     @Test(expected = AssertionError.class)
    184     public void testNewVersionedInstanceError() {
    185         OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0);
     184    @Test
     185    void testNewVersionedInstanceError() {
     186        assertThrows(AssertionError.class, () -> OsmPrimitiveType.CLOSEDWAY.newVersionedInstance(1, 0));
    186187    }
    187188}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/OsmUtilsTest.java

    r15951 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.util.Arrays;
    1011import java.util.stream.Collectors;
    1112
    12 import org.junit.Rule;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1415import org.openstreetmap.josm.testutils.JOSMTestRules;
    1516
     
    1920 * Unit tests for class {@link OsmUtils}.
    2021 */
    21 public class OsmUtilsTest {
     22class OsmUtilsTest {
    2223
    2324    /**
    2425     * Setup test.
    2526     */
    26     @Rule
     27    @RegisterExtension
    2728    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2829    public JOSMTestRules test = new JOSMTestRules();
     
    3233     */
    3334    @Test
    34     public void testCreatePrimitive() {
     35    void testCreatePrimitive() {
    3536        final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");
    3637        assertTrue(p instanceof Way);
     
    4445     */
    4546    @Test
    46     public void testArea() {
     47    void testArea() {
    4748        final OsmPrimitive p = OsmUtils.createPrimitive("area name=Foo railway=rail");
    4849        assertEquals(OsmPrimitiveType.WAY, p.getType());
     
    5354     * Unit test of {@link OsmUtils#createPrimitive}
    5455     */
    55     @Test(expected = IllegalArgumentException.class)
    56     public void testCreatePrimitiveFail() {
    57         OsmUtils.createPrimitive("noway name=Foo");
     56    @Test
     57    void testCreatePrimitiveFail() {
     58        assertThrows(IllegalArgumentException.class, () -> OsmUtils.createPrimitive("noway name=Foo"));
    5859    }
    5960
     
    6263     */
    6364    @Test
    64     public void testSplitMultipleValues() {
     65    void testSplitMultipleValues() {
    6566        // examples from https://wiki.openstreetmap.org/wiki/Semi-colon_value_separator
    6667        assertEquals(Arrays.asList("B500", "B550"), OsmUtils.splitMultipleValues("B500;B550").collect(Collectors.toList()));
     
    7475     */
    7576    @Test
    76     public void testTrueFalse() {
     77    void testTrueFalse() {
    7778        assertFalse(OsmUtils.isTrue(null));
    7879        assertFalse(OsmUtils.isFalse(null));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/QuadBucketsTest.java

    r16547 r17275  
    1616
    1717import org.junit.Assert;
    18 import org.junit.Rule;
    19 import org.junit.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
     19import org.junit.jupiter.api.Test;
    2020import org.openstreetmap.josm.data.coor.LatLon;
    2121import org.openstreetmap.josm.data.projection.ProjectionRegistry;
     
    3030 * Unit tests of {@link QuadBuckets}.
    3131 */
    32 public class QuadBucketsTest {
     32class QuadBucketsTest {
    3333
    3434    /**
    3535     * Setup test.
    3636     */
    37     @Rule
     37    @RegisterExtension
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3939    public JOSMTestRules test = new JOSMTestRules();
     
    8383     */
    8484    @Test
    85     public void testRemove() throws Exception {
     85    void testRemove() throws Exception {
    8686        ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
    8787        try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) {
     
    9696     */
    9797    @Test
    98     public void testMove() throws Exception {
     98    void testMove() throws Exception {
    9999        ProjectionRegistry.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
    100100        try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/restriction.osm"))) {
     
    113113     */
    114114    @Test
    115     public void testSpecialBBox() {
     115    void testSpecialBBox() {
    116116        QuadBuckets<Node> qbNodes = new QuadBuckets<>();
    117117        QuadBuckets<Way> qbWays = new QuadBuckets<>();
     
    195195     */
    196196    @Test
    197     public void testSplitsWithIncompleteData() {
     197    void testSplitsWithIncompleteData() {
    198198        DataSet ds = new DataSet();
    199199        long nodeId = 1;
  • trunk/test/unit/org/openstreetmap/josm/data/osm/RelationTest.java

    r11383 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    89import org.junit.Assert;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1112import org.openstreetmap.josm.data.coor.LatLon;
    1213import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1415import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1516
    16 public class RelationTest {
     17class RelationTest {
    1718
    1819    /**
    1920     * Setup test.
    2021     */
    21     @Rule
     22    @RegisterExtension
    2223    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2324    public JOSMTestRules test = new JOSMTestRules();
    2425
    25     @Test(expected = NullPointerException.class)
    26     public void testCreateNewRelation() {
    27         new Relation(null);
     26    @Test
     27    void testCreateNewRelation() {
     28        assertThrows(NullPointerException.class, () -> new Relation(null));
    2829    }
    2930
    3031    @Test
    31     public void testEqualSemanticsToNull() {
     32    void testEqualSemanticsToNull() {
    3233        Relation relation = new Relation();
    3334        assertFalse(relation.hasEqualTechnicalAttributes(null));
     
    3536
    3637    @Test
    37     public void testBbox() {
     38    void testBbox() {
    3839        DataSet ds = new DataSet();
    3940
     
    8889
    8990    @Test
    90     public void testBBoxNotInDataset() {
     91    void testBBoxNotInDataset() {
    9192        Node n1 = new Node(new LatLon(10, 10));
    9293        Node n2 = new Node(new LatLon(20, 20));
     
    122123     */
    123124    @Test
    124     public void testTicket12467() throws Exception {
     125    void testTicket12467() throws Exception {
    125126        Relation r = new Relation();
    126127        r.put("type", "boundary");
     
    143144     * Test that {@link Relation#cloneFrom} throws IAE for invalid arguments
    144145     */
    145     @Test(expected = IllegalArgumentException.class)
    146     public void testCloneFromIAE() {
    147         new Relation().cloneFrom(new Node());
     146    @Test
     147    void testCloneFromIAE() {
     148        assertThrows(IllegalArgumentException.class, () -> new Relation().cloneFrom(new Node()));
    148149    }
    149150
     
    151152     * Test that {@link Relation#load} throws IAE for invalid arguments
    152153     */
    153     @Test(expected = IllegalArgumentException.class)
    154     public void testLoadIAE() {
    155         new Relation().load(new NodeData());
     154    @Test
     155    void testLoadIAE() {
     156        assertThrows(IllegalArgumentException.class, () -> new Relation().load(new NodeData()));
    156157    }
    157158}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/SimplePrimitiveIdTest.java

    r13969 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
    78
    89/**
    910 * Unit tests of {@link SimplePrimitiveId} class.
    1011 */
    11 public class SimplePrimitiveIdTest {
     12class SimplePrimitiveIdTest {
    1213
    1314    /**
     
    1516     */
    1617    @Test
    17     public void testFromStringNode() {
     18    void testFromStringNode() {
    1819        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node/123"));
    1920        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("n123"));
     
    2627     */
    2728    @Test
    28     public void testFromStringWay() {
     29    void testFromStringWay() {
    2930        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way/123"));
    3031        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("w123"));
     
    3738     */
    3839    @Test
    39     public void testFromStringRelation() {
     40    void testFromStringRelation() {
    4041        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("relation/123"));
    4142        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.RELATION), SimplePrimitiveId.fromString("r123"));
     
    4748     * Unit test of {@link SimplePrimitiveId#fromString} for invalid input.
    4849     */
    49     @Test(expected = IllegalArgumentException.class)
    50     public void testFromStringBad() {
    51         SimplePrimitiveId.fromString("foobar");
     50    @Test
     51    void testFromStringBad() {
     52        assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.fromString("foobar"));
    5253    }
    5354
     
    5657     */
    5758    @Test
    58     public void testFuzzyParse() {
     59    void testFuzzyParse() {
    5960        assertEquals("[relation 123]",
    6061                SimplePrimitiveId.fuzzyParse("foo relation/123 bar").toString());
     
    6869
    6970    @Test
    70     public void testFromCopyAction() {
     71    void testFromCopyAction() {
    7172        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.NODE), SimplePrimitiveId.fromString("node 123"));
    7273        assertEquals(new SimplePrimitiveId(123, OsmPrimitiveType.WAY), SimplePrimitiveId.fromString("way 123"));
     
    7879     */
    7980    @Test
    80     public void testMultipleFromString() {
     81    void testMultipleFromString() {
    8182        assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234").toString());
    8283        assertEquals("[node 234]", SimplePrimitiveId.multipleFromString("node/234-234").toString());
     
    101102     * Unit test of {@link SimplePrimitiveId#multipleFromString} for invalid data.
    102103     */
    103     @Test(expected = IllegalArgumentException.class)
    104     public void testMultipleFromStringBad() {
    105         SimplePrimitiveId.multipleFromString("foo node123 bar");
     104    @Test
     105    void testMultipleFromStringBad() {
     106        assertThrows(IllegalArgumentException.class, () -> SimplePrimitiveId.multipleFromString("foo node123 bar"));
    106107    }
    107108}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/StorageTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests for class {@link Storage}.
    1515 */
    16 public class StorageTest {
     16class StorageTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testEqualsContract() {
     29    void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
    3131        EqualsVerifier.forClass(Storage.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/osm/TagCollectionTest.java

    r16643 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Arrays;
     
    1717import java.util.stream.Stream;
    1818
    19 import org.junit.Rule;
    20 import org.junit.Test;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2121import org.openstreetmap.josm.testutils.JOSMTestRules;
    2222
     
    2727 * @author Michael Zangl
    2828 */
    29 public class TagCollectionTest {
     29class TagCollectionTest {
    3030    private final Tag tagA = new Tag("k", "v");
    3131    private final Tag tagB = new Tag("k", "b");
     
    3939     * We need prefs for using primitives
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    5454     */
    5555    @Test
    56     public void testFromTagged() {
     56    void testFromTagged() {
    5757        TagCollection c = TagCollection.from(tagA);
    5858        assertTagCounts(c, 1, 0, 0, 0);
     
    7272     */
    7373    @Test
    74     public void testFromMapOfStringString() {
     74    void testFromMapOfStringString() {
    7575        TagCollection c = TagCollection.from(tagA.getKeys());
    7676        assertTagCounts(c, 1, 0, 0, 0);
     
    9090     */
    9191    @Test
    92     public void testUnionOfAllPrimitivesCollectionOfQextendsTagged() {
     92    void testUnionOfAllPrimitivesCollectionOfQextendsTagged() {
    9393        TagCollection c = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA));
    9494        assertEquals(1, c.getTagOccurrence(tagA));
     
    111111     */
    112112    @Test
    113     public void testTagCollection() {
     113    void testTagCollection() {
    114114        TagCollection c = new TagCollection();
    115115        assertTagCounts(c, 0, 0, 0, 0);
     
    120120     */
    121121    @Test
    122     public void testTagCollectionTagCollection() {
     122    void testTagCollectionTagCollection() {
    123123        TagCollection blueprint = TagCollection.unionOfAllPrimitives(Arrays.asList(tagA, tagC, tagC));
    124124        TagCollection c = new TagCollection(blueprint);
     
    133133     */
    134134    @Test
    135     public void testTagCollectionCollectionOfTag() {
     135    void testTagCollectionCollectionOfTag() {
    136136        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    137137        assertTagCounts(c, 1, 0, 2, 0);
     
    145145     */
    146146    @Test
    147     public void testSize() {
     147    void testSize() {
    148148        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    149149        assertEquals(2, c.size());
     
    157157     */
    158158    @Test
    159     public void testIsEmpty() {
     159    void testIsEmpty() {
    160160        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    161161        assertFalse(c.isEmpty());
     
    169169     */
    170170    @Test
    171     public void testAddTag() {
     171    void testAddTag() {
    172172        TagCollection c = new TagCollection();
    173173        assertTagCounts(c, 0, 0, 0, 0);
     
    182182
    183183    /**
    184      * Test method for {@link TagCollection#getTagOccurence(Tag)}.
    185      */
    186     @Test
    187     public void testGetTagCount() {
     184     * Test method for {@link TagCollection#getTagOccurrence}.
     185     */
     186    @Test
     187    void testGetTagCount() {
    188188        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    189189        assertEquals(2, c.getTagOccurrence(tagC));
     
    197197     */
    198198    @Test
    199     public void testAddCollectionOfTag() {
     199    void testAddCollectionOfTag() {
    200200        TagCollection c = new TagCollection();
    201201        assertTagCounts(c, 0, 0, 0, 0);
     
    214214     */
    215215    @Test
    216     public void testAddTagCollection() {
     216    void testAddTagCollection() {
    217217        TagCollection c = new TagCollection();
    218218        assertTagCounts(c, 0, 0, 0, 0);
     
    231231     */
    232232    @Test
    233     public void testRemoveTag() {
     233    void testRemoveTag() {
    234234        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    235235        assertTagCounts(c, 1, 0, 2, 0);
     
    246246     */
    247247    @Test
    248     public void testRemoveCollectionOfTag() {
     248    void testRemoveCollectionOfTag() {
    249249        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    250250        assertTagCounts(c, 1, 0, 2, 0);
     
    259259     */
    260260    @Test
    261     public void testRemoveTagCollection() {
     261    void testRemoveTagCollection() {
    262262        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagC));
    263263        assertTagCounts(c, 1, 0, 2, 0);
     
    274274     */
    275275    @Test
    276     public void testRemoveByKeyString() {
     276    void testRemoveByKeyString() {
    277277        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC));
    278278        assertTagCounts(c, 1, 2, 1, 0);
     
    287287     */
    288288    @Test
    289     public void testRemoveByKeyCollectionOfString() {
     289    void testRemoveByKeyCollectionOfString() {
    290290        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB, tagC, tagD));
    291291        assertTagCounts(c, 1, 2, 1, 1);
     
    300300     */
    301301    @Test
    302     public void testContains() {
     302    void testContains() {
    303303        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB));
    304304        assertTrue(c.contains(tagA));
     
    311311     */
    312312    @Test
    313     public void testContainsAll() {
     313    void testContainsAll() {
    314314        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagB));
    315315        assertTrue(c.containsAll(Arrays.asList(tagA, tagB)));
     
    323323     */
    324324    @Test
    325     public void testContainsAllKeys() {
     325    void testContainsAllKeys() {
    326326        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC));
    327327        assertTrue(c.containsAllKeys(Arrays.asList("k", "k2")));
     
    335335     */
    336336    @Test
    337     public void testGetNumTagsFor() {
     337    void testGetNumTagsFor() {
    338338        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC));
    339339        assertEquals(2, c.getNumTagsFor("k"));
     
    346346     */
    347347    @Test
    348     public void testHasTagsFor() {
     348    void testHasTagsFor() {
    349349        TagCollection c = new TagCollection(Arrays.asList(tagA, tagB, tagC));
    350350        assertTrue(c.hasTagsFor("k"));
     
    357357     */
    358358    @Test
    359     public void testHasValuesFor() {
     359    void testHasValuesFor() {
    360360        TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty));
    361361        assertFalse(c.hasValuesFor("k"));
     
    368368     */
    369369    @Test
    370     public void testHasUniqueNonEmptyValue() {
     370    void testHasUniqueNonEmptyValue() {
    371371        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty));
    372372        assertTrue(c.hasUniqueNonEmptyValue("k"));
     
    384384     */
    385385    @Test
    386     public void testHasEmptyValue() {
     386    void testHasEmptyValue() {
    387387        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC, tagEmpty));
    388388        assertTrue(c.hasEmptyValue("k"));
     
    395395     */
    396396    @Test
    397     public void testHasUniqueEmptyValue() {
     397    void testHasUniqueEmptyValue() {
    398398        TagCollection c = new TagCollection(Arrays.asList(tagC, tagEmpty));
    399399        assertTrue(c.hasUniqueEmptyValue("k"));
     
    411411     */
    412412    @Test
    413     public void testGetTagsForString() {
     413    void testGetTagsForString() {
    414414        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty));
    415415        TagCollection collection = d.getTagsFor("k");
     
    422422     */
    423423    @Test
    424     public void testGetTagsForCollectionOfString() {
     424    void testGetTagsForCollectionOfString() {
    425425        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagEmpty));
    426426        TagCollection collection = d.getTagsFor(Arrays.asList("k", "k2"));
     
    433433     */
    434434    @Test
    435     public void testAsSet() {
     435    void testAsSet() {
    436436        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC));
    437437        Set<Tag> set = d.asSet();
     
    446446     */
    447447    @Test
    448     public void testAsList() {
     448    void testAsList() {
    449449        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC));
    450450        List<Tag> set = d.asList();
     
    459459     */
    460460    @Test
    461     public void testIterator() {
     461    void testIterator() {
    462462        TagCollection d = new TagCollection(Arrays.asList(tagA));
    463463        Iterator<Tag> it = d.iterator();
     
    471471     */
    472472    @Test
    473     public void testGetKeys() {
     473    void testGetKeys() {
    474474        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC));
    475475        Set<String> set = d.getKeys();
     
    483483     */
    484484    @Test
    485     public void testGetKeysWithMultipleValues() {
     485    void testGetKeysWithMultipleValues() {
    486486        TagCollection d = new TagCollection(Arrays.asList(tagA, tagB, tagC, tagC));
    487487        Set<String> set = d.getKeysWithMultipleValues();
     
    494494     */
    495495    @Test
    496     public void testSetUniqueForKeyTag() {
     496    void testSetUniqueForKeyTag() {
    497497        TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC));
    498498        assertTagCounts(d, 2, 1, 2, 0);
     
    505505     */
    506506    @Test
    507     public void testSetUniqueForKeyStringString() {
     507    void testSetUniqueForKeyStringString() {
    508508        TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagC));
    509509        assertTagCounts(d, 2, 1, 2, 0);
     
    516516     */
    517517    @Test
    518     public void testGetValues() {
     518    void testGetValues() {
    519519        TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagB, tagC, tagEmpty));
    520520        Set<String> set = d.getValues();
     
    529529     */
    530530    @Test
    531     public void testGetValuesString() {
     531    void testGetValuesString() {
    532532        TagCollection d = new TagCollection(Arrays.asList(tagA, tagA, tagC, tagEmpty));
    533533        Set<String> set = d.getValues("k");
     
    541541     */
    542542    @Test
    543     public void testIsApplicableToPrimitive() {
     543    void testIsApplicableToPrimitive() {
    544544        TagCollection c = new TagCollection();
    545545        assertTrue(c.isApplicableToPrimitive());
     
    554554     */
    555555    @Test
    556     public void testApplyToTagged() {
     556    void testApplyToTagged() {
    557557        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC));
    558558        NodeData tagged = new NodeData();
     
    572572     */
    573573    @Test
    574     public void testApplyToCollectionOfQextendsTagged() {
     574    void testApplyToCollectionOfQextendsTagged() {
    575575        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC));
    576576        NodeData tagged = new NodeData();
     
    590590     */
    591591    @Test
    592     public void testReplaceTagsOfTagged() {
     592    void testReplaceTagsOfTagged() {
    593593        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC));
    594594        NodeData tagged = new NodeData();
     
    605605     */
    606606    @Test
    607     public void testReplaceTagsOfCollectionOfQextendsTagged() {
     607    void testReplaceTagsOfCollectionOfQextendsTagged() {
    608608        TagCollection c = new TagCollection(Arrays.asList(tagA, tagC));
    609609        NodeData tagged = new NodeData();
     
    623623     */
    624624    @Test
    625     public void testIntersect() {
     625    void testIntersect() {
    626626        TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty));
    627627        TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD));
     
    636636     */
    637637    @Test
    638     public void testMinus() {
     638    void testMinus() {
    639639        TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty));
    640640        TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD));
     
    649649     */
    650650    @Test
    651     public void testUnion() {
     651    void testUnion() {
    652652        TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty));
    653653        TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD));
     
    664664     */
    665665    @Test
    666     public void testEmptyTagsForKeysMissingIn() {
     666    void testEmptyTagsForKeysMissingIn() {
    667667        TagCollection c1 = new TagCollection(Arrays.asList(tagA, tagC, tagD, tagEmpty));
    668668        TagCollection c2 = new TagCollection(Arrays.asList(tagA, tagB, tagD));
     
    677677     */
    678678    @Test
    679     public void testGetJoinedValues() {
     679    void testGetJoinedValues() {
    680680        TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "a")));
    681681        assertEquals("a", c.getJoinedValues("k"));
     
    696696     */
    697697    @Test
    698     public void testGetSummedValues() {
     698    void testGetSummedValues() {
    699699        TagCollection c = new TagCollection(Arrays.asList(new Tag("k", "10"), new Tag("k", "20")));
    700700        assertEquals("30", c.getSummedValues("k"));
     
    711711     */
    712712    @Test
    713     public void testCommonToAllPrimitives() {
     713    void testCommonToAllPrimitives() {
    714714        Tagged t1 = new Node();
    715715        t1.put("k1", "10");
  • trunk/test/unit/org/openstreetmap/josm/data/osm/TagMapTest.java

    r9969 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77
    88/**
    99 * Unit tests of the {@code TagMap} class.
    1010 */
    11 public class TagMapTest {
     11class TagMapTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testToString() {
     17    void testToString() {
    1818        assertEquals("TagMap[]", new TagMap().toString());
    1919        assertEquals("TagMap[key=val]", new TagMap(new String[]{"key", "val"}).toString());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/UserTest.java

    r12750 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertSame;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertSame;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    1515 * Tests of {@link User}.
    1616 */
    17 public class UserTest {
     17class UserTest {
    1818
    1919    /**
    2020     * Setup test
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testCreateOsmUser() {
     30    void testCreateOsmUser() {
    3131        User user1 = User.createOsmUser(1, "name1");
    3232        assertEquals(1, user1.getId());
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java

    r13907 r17275  
    99
    1010import org.junit.Assert;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
    1212
    1313import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1414
    15 public class WayDataTest {
     15class WayDataTest {
    1616
    1717    @Test
    1818    @SuppressFBWarnings(value = "OBJECT_DESERIALIZATION")
    19     public void testSerializationForDragAndDrop() throws Exception {
     19    void testSerializationForDragAndDrop() throws Exception {
    2020        final WayData data = new WayData();
    2121        data.setNodeIds(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WaySegmentTest.java

    r10945 r17275  
    55
    66import org.junit.Assert;
    7 import org.junit.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1515 * Unit tests of the {@code WaySegment} class.
    1616 */
    17 public class WaySegmentTest {
     17class WaySegmentTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
    2525
    2626    @Test
    27     public void testForNodePair() throws Exception {
     27    void testForNodePair() throws Exception {
    2828        final DataSet ds = new DataSet();
    2929        final Node n1 = new Node(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WayTest.java

    r17186 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    89import java.util.Arrays;
    910import java.util.HashSet;
    1011
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1314import org.openstreetmap.josm.JOSMFixture;
    1415import org.openstreetmap.josm.data.coor.LatLon;
     
    1819 * @since 11270
    1920 */
    20 public class WayTest {
     21class WayTest {
    2122
    2223    /**
    2324     * Setup test.
    2425     */
    25     @BeforeClass
     26    @BeforeAll
    2627    public static void setUpBeforeClass() {
    2728        JOSMFixture.createUnitTestFixture().init();
     
    3233     */
    3334    @Test
    34     public void testBBox() {
     35    void testBBox() {
    3536        DataSet ds = new DataSet();
    3637        Node n1 = new Node(1);
     
    6162     */
    6263    @Test
    63     public void testRemoveNode() {
     64    void testRemoveNode() {
    6465        DataSet ds = new DataSet();
    6566        Node n1 = new Node(1);
     
    8788        way.removeNode(n1);
    8889        assertEquals(Arrays.asList(n2, n3, n4, n2), way.getNodes());
    89 
    9090    }
    9191
     
    9494     */
    9595    @Test
    96     public void testRemoveNodes() {
     96    void testRemoveNodes() {
    9797        DataSet ds = new DataSet();
    9898        Node n1 = new Node(1);
     
    123123     * Test that {@link Way#cloneFrom} throws IAE for invalid arguments
    124124     */
    125     @Test(expected = IllegalArgumentException.class)
    126     public void testCloneFromIAE() {
    127         new Way().cloneFrom(new Node());
     125    @Test
     126    void testCloneFromIAE() {
     127        assertThrows(IllegalArgumentException.class, () -> new Way().cloneFrom(new Node()));
    128128    }
    129129
     
    131131     * Test that {@link Way#load} throws IAE for invalid arguments
    132132     */
    133     @Test(expected = IllegalArgumentException.class)
    134     public void testLoadIAE() {
    135         new Way().load(new NodeData());
     133    @Test
     134    void testLoadIAE() {
     135        assertThrows(IllegalArgumentException.class, () -> new Way().load(new NodeData()));
    136136    }
    137137}
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/ChangesetIdChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link ChangesetIdChangedEvent} class.
    1414 */
    15 public class ChangesetIdChangedEventTest {
     15class ChangesetIdChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("CHANGESET_ID_CHANGED", new ChangesetIdChangedEvent(null, null, 0, 0).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link DataChangedEvent} class.
    1414 */
    15 public class DataChangedEventTest {
     15class DataChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("DATA_CHANGED", new DataChangedEvent(null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceAddedEventTest.java

    r15609 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertSame;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertSame;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Collections;
    88import java.util.stream.Stream;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.data.Bounds;
    1212import org.openstreetmap.josm.data.DataSource;
     
    1919 * @author Taylor Smock
    2020 */
    21 public class DataSourceAddedEventTest {
     21class DataSourceAddedEventTest {
    2222    /**
    2323     * Get getting the originating data source
    2424     */
    2525    @Test
    26     public void testGetDataEventSource() {
     26    void testGetDataEventSource() {
    2727        DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    2828        DataSet ds = new DataSet();
     
    3434     */
    3535    @Test
    36     public void testGetAddedSource() {
     36    void testGetAddedSource() {
    3737        DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    3838        assertTrue(
     
    4949     */
    5050    @Test
    51     public void testGetRemovedSource() {
     51    void testGetRemovedSource() {
    5252        DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    5353        assertTrue(
     
    6464     */
    6565    @Test
    66     public void testGetDataSources() {
     66    void testGetDataSources() {
    6767        DataSource fakeAdd = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    6868        DataSourceChangeEvent event = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(),
     
    7676     */
    7777    @Test
    78     public void testToString() {
     78    void testToString() {
    7979        String toString = new DataSourceAddedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString();
    8080        assertTrue(toString.contains("added"));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/DataSourceRemovedEventTest.java

    r15609 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertSame;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertSame;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Collections;
    99import java.util.stream.Stream;
    1010
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.data.Bounds;
    1313import org.openstreetmap.josm.data.DataSource;
     
    2121 */
    2222
    23 public class DataSourceRemovedEventTest {
     23class DataSourceRemovedEventTest {
    2424    /**
    2525     * Get getting the originating data source
    2626     */
    2727    @Test
    28     public void testGetDataEventSource() {
     28    void testGetDataEventSource() {
    2929        DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    3030        DataSet ds = new DataSet();
     
    3636     */
    3737    @Test
    38     public void testGetAddedSource() {
     38    void testGetAddedSource() {
    3939        DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    4040        assertTrue(
     
    5151     */
    5252    @Test
    53     public void testGetRemovedSource() {
     53    void testGetRemovedSource() {
    5454        DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    5555        assertTrue(new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).getRemoved()
     
    6666     */
    6767    @Test
    68     public void testGetDataSources() {
     68    void testGetDataSources() {
    6969        DataSource fakeRemove = new DataSource(new Bounds(0, 0, 0, 0), "fake-source");
    7070        DataSourceChangeEvent event = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(),
     
    8383     */
    8484    @Test
    85     public void testToString() {
     85    void testToString() {
    8686        String toString = new DataSourceRemovedEvent(new DataSet(), Collections.emptySet(), Stream.empty()).toString();
    8787        assertTrue(toString.contains("added"));
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/NodeMovedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link NodeMovedEvent} class.
    1414 */
    15 public class NodeMovedEventTest {
     15class NodeMovedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("NODE_MOVED", new NodeMovedEvent(null, null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitiveFlagsChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link PrimitiveFlagsChangedEvent} class.
    1414 */
    15 public class PrimitiveFlagsChangedEventTest {
     15class PrimitiveFlagsChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("PRIMITIVE_FLAGS_CHANGED", new PrimitiveFlagsChangedEvent(null, null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesAddedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Collections;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    1515 * Unit tests of {@link PrimitivesAddedEvent} class.
    1616 */
    17 public class PrimitivesAddedEventTest {
     17class PrimitivesAddedEventTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testToString() {
     30    void testToString() {
    3131        assertEquals("PRIMITIVES_ADDED", new PrimitivesAddedEvent(null, Collections.emptyList(), false).toString());
    3232    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/PrimitivesRemovedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Collections;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    1515 * Unit tests of {@link PrimitivesRemovedEvent} class.
    1616 */
    17 public class PrimitivesRemovedEventTest {
     17class PrimitivesRemovedEventTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    2828     */
    2929    @Test
    30     public void testToString() {
     30    void testToString() {
    3131        assertEquals("PRIMITIVES_REMOVED", new PrimitivesRemovedEvent(null, Collections.emptyList(), false).toString());
    3232    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/RelationMembersChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link RelationMembersChangedEvent} class.
    1414 */
    15 public class RelationMembersChangedEventTest {
     15class RelationMembersChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("RELATION_MEMBERS_CHANGED", new RelationMembersChangedEvent(null, null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/SelectionEventManagerTest.java

    r14247 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
     
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
    1414import org.openstreetmap.josm.data.osm.DataSelectionListener;
     
    2525 * @since 12048
    2626 */
    27 public class SelectionEventManagerTest {
     27class SelectionEventManagerTest {
    2828    private final class SelectionListener implements DataSelectionListener {
    2929        private Collection<? extends OsmPrimitive> newSelection;
     
    4242    /**
    4343     */
    44     @Rule
     44    @RegisterExtension
    4545    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4646    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    5050     */
    5151    @Test
    52     public void testEventPropagation() {
     52    void testEventPropagation() {
    5353        // automatically adds the layers
    5454        CommandTestDataWithRelation testData1 = new CommandTestDataWithRelation();
     
    9999        GuiHelper.runInEDTAndWait(() -> { });
    100100        for (SelectionListener listener : listeners) {
    101             assertEquals(listener.name, should, listener.newSelection);
     101            assertEquals(should, listener.newSelection, listener.name);
    102102            listener.newSelection = null;
    103103        }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/TagsChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link TagsChangedEvent} class.
    1414 */
    15 public class TagsChangedEventTest {
     15class TagsChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("TAGS_CHANGED", new TagsChangedEvent(null, null, null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/event/WayNodesChangedEventTest.java

    r11928 r17275  
    22package org.openstreetmap.josm.data.osm.event;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link WayNodesChangedEvent} class.
    1414 */
    15 public class WayNodesChangedEventTest {
     15class WayNodesChangedEventTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("WAY_NODES_CHANGED", new WayNodesChangedEvent(null, null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryNodeTest.java

    r12663 r17275  
    22package org.openstreetmap.josm.data.osm.history;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Date;
     
    99import java.util.Map;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
     
    2323 * Unit tests for class {@link HistoryNode}.
    2424 */
    25 public class HistoryNodeTest {
     25class HistoryNodeTest {
    2626
    2727    /**
    2828     * Setup test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules();
     
    4848     */
    4949    @Test
    50     public void testHistoryNode() {
     50    void testHistoryNode() {
    5151        Date d = new Date();
    5252        HistoryNode node = create(d);
     
    6565     */
    6666    @Test
    67     public void testGetType() {
     67    void testGetType() {
    6868        assertEquals(OsmPrimitiveType.NODE, create(new Date()).getType());
    6969    }
     
    7373     */
    7474    @Test
    75     public void testGetCoords() {
     75    void testGetCoords() {
    7676        Node n = new Node(new LatLon(45, 0));
    7777        n.setOsmId(1, 2);
     
    8585     */
    8686    @Test
    87     public void testGetDisplayName() {
     87    void testGetDisplayName() {
    8888        HistoryNode node = create(new Date());
    8989        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryRelationTest.java

    r12663 r17275  
    22package org.openstreetmap.josm.data.osm.history;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.Date;
     
    99import java.util.Map;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    2222 * Unit tests for class {@link HistoryRelation}.
    2323 */
    24 public class HistoryRelationTest {
     24class HistoryRelationTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules();
     
    4646     */
    4747    @Test
    48     public void testHistoryRelation() {
     48    void testHistoryRelation() {
    4949        Date d = new Date();
    5050        HistoryRelation rel = create(d);
     
    6363     */
    6464    @Test
    65     public void testGetType() {
     65    void testGetType() {
    6666        assertEquals(OsmPrimitiveType.RELATION, create(new Date()).getType());
    6767    }
     
    7171     */
    7272    @Test
    73     public void testGetDisplayName() {
     73    void testGetDisplayName() {
    7474        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
    7575        HistoryRelation rel0 = create(new Date()); // 0 member
  • trunk/test/unit/org/openstreetmap/josm/data/osm/history/HistoryWayTest.java

    r16445 r17275  
    22package org.openstreetmap.josm.data.osm.history;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.util.Date;
     
    1111import java.util.Map;
    1212
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.osm.DefaultNameFormatter;
    1616import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    2424 * Unit tests for class {@link HistoryWay}.
    2525 */
    26 public class HistoryWayTest {
     26class HistoryWayTest {
    2727
    2828    /**
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules();
     
    4848     */
    4949    @Test
    50     public void testHistoryWay() {
     50    void testHistoryWay() {
    5151        Date d = new Date();
    5252        HistoryWay way = create(d);
     
    6767     */
    6868    @Test
    69     public void testGetType() {
     69    void testGetType() {
    7070        assertEquals(OsmPrimitiveType.WAY, create(new Date()).getType());
    7171    }
    7272
    7373    @Test
    74     public void testNodeManipulation() {
     74    void testNodeManipulation() {
    7575        HistoryWay way = create(new Date());
    7676
     
    9292
    9393    @Test
    94     public void testIterating() {
     94    void testIterating() {
    9595        HistoryWay way = create(new Date());
    9696
     
    108108     */
    109109    @Test
    110     public void testGetDisplayName() {
     110    void testGetDisplayName() {
    111111        HistoryNameFormatter hnf = DefaultNameFormatter.getInstance();
    112112        HistoryWay way0 = create(new Date()); // no node
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/PushbackTokenizerTest.java

    r12656 r17275  
    22package org.openstreetmap.josm.data.osm.search;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.data.osm.search.PushbackTokenizer.Token;
     
    1313 * Unit tests for class {@link SearchCompiler}.
    1414 */
    15 public class PushbackTokenizerTest {
     15class PushbackTokenizerTest {
    1616
    1717    /**
    1818     * Setup rules.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testEnumToken() {
     28    void testEnumToken() {
    2929        TestUtils.superficialEnumCodeCoverage(Token.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchCompilerTest.java

    r17114 r17275  
    22package org.openstreetmap.josm.data.osm.search;
    33
    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;
    84import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNotNull;
    98import static org.junit.jupiter.api.Assertions.assertThrows;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
    1010
    1111import java.lang.reflect.Field;
     
    1919
    2020import org.junit.Assert;
    21 import org.junit.Rule;
    22 import org.junit.Test;
     21import org.junit.jupiter.api.Test;
     22import org.junit.jupiter.api.extension.RegisterExtension;
    2323import org.openstreetmap.josm.TestUtils;
    2424import org.openstreetmap.josm.data.coor.LatLon;
     
    5353 * Unit tests for class {@link SearchCompiler}.
    5454 */
    55 public class SearchCompilerTest {
     55class SearchCompilerTest {
    5656
    5757    /**
    5858     * We need prefs for this. We access preferences when creating OSM primitives.
    5959     */
    60     @Rule
     60    @RegisterExtension
    6161    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6262    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(30000);
     
    9595        private void match(OsmPrimitive p, boolean cond) {
    9696            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);
    9999            } 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);
    102102            }
    103103        }
     
    109109     */
    110110    @Test
    111     public void testAny() throws SearchParseError {
     111    void testAny() throws SearchParseError {
    112112        final SearchCompiler.Match c = SearchCompiler.compile("foo");
    113113        assertTrue(c.match(OsmUtils.createPrimitive("node foobar=true")));
     
    122122     */
    123123    @Test
    124     public void testEquals() throws SearchParseError {
     124    void testEquals() throws SearchParseError {
    125125        final SearchCompiler.Match c = SearchCompiler.compile("foo=bar");
    126126        assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true")));
     
    136136     */
    137137    @Test
    138     public void testRegexp() throws SearchParseError {
     138    void testRegexp() throws SearchParseError {
    139139        final SearchCompiler.Match c = SearchCompiler.compile("foo~[Bb]a[rz]");
    140140        assertFalse(c.match(OsmUtils.createPrimitive("node foobar=true")));
     
    151151     */
    152152    @Test
    153     public void testCompare() throws SearchParseError {
     153    void testCompare() throws SearchParseError {
    154154        final SearchCompiler.Match c1 = SearchCompiler.compile("start_date>1950");
    155155        assertTrue(c1.match(OsmUtils.createPrimitive("node start_date=1950-01-01")));
     
    191191     */
    192192    @Test
    193     public void testNth() throws SearchParseError {
     193    void testNth() throws SearchParseError {
    194194        final DataSet dataSet = new DataSet();
    195195        final Way way = new Way();
     
    219219     */
    220220    @Test
    221     public void testNthParseNegative() throws SearchParseError {
     221    void testNthParseNegative() throws SearchParseError {
    222222        assertEquals("Nth{nth=-1, modulo=false}", SearchCompiler.compile("nth:-1").toString());
    223223    }
     
    228228     */
    229229    @Test
    230     public void testModified() throws SearchParseError {
     230    void testModified() throws SearchParseError {
    231231        SearchContext sc = new SearchContext("modified");
    232232        // Not modified but new
    233233        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);
    236236            sc.match(p, true);
    237237        }
     
    239239        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    240240            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);
    243243            sc.match(p, true);
    244244        }
     
    246246        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    247247            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);
    250250            sc.match(p, true);
    251251        }
     
    253253        for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) {
    254254            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);
    257257            sc.match(p, false);
    258258        }
     
    264264     */
    265265    @Test
    266     public void testSelected() throws SearchParseError {
     266    void testSelected() throws SearchParseError {
    267267        SearchContext sc = new SearchContext("selected");
    268268        // Not selected
    269269        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    270             assertFalse(p.toString(), p.isSelected());
     270            assertFalse(p.isSelected(), p::toString);
    271271            sc.match(p, false);
    272272        }
     
    274274        for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) {
    275275            sc.ds.addSelected(p);
    276             assertTrue(p.toString(), p.isSelected());
     276            assertTrue(p.isSelected(), p::toString);
    277277            sc.match(p, true);
    278278        }
     
    284284     */
    285285    @Test
    286     public void testIncomplete() throws SearchParseError {
     286    void testIncomplete() throws SearchParseError {
    287287        SearchContext sc = new SearchContext("incomplete");
    288288        // Not incomplete
    289289        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    290             assertFalse(p.toString(), p.isIncomplete());
     290            assertFalse(p.isIncomplete(), p::toString);
    291291            sc.match(p, false);
    292292        }
     
    300300        sc.r2.load(rd);
    301301        for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) {
    302             assertTrue(p.toString(), p.isIncomplete());
     302            assertTrue(p.isIncomplete(), p::toString);
    303303            sc.match(p, true);
    304304        }
     
    310310     */
    311311    @Test
    312     public void testUntagged() throws SearchParseError {
     312    void testUntagged() throws SearchParseError {
    313313        SearchContext sc = new SearchContext("untagged");
    314314        // Untagged
    315315        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    316             assertFalse(p.toString(), p.isTagged());
     316            assertFalse(p.isTagged(), p::toString);
    317317            sc.match(p, true);
    318318        }
     
    320320        for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) {
    321321            p.put("foo", "bar");
    322             assertTrue(p.toString(), p.isTagged());
     322            assertTrue(p.isTagged(), p::toString);
    323323            sc.match(p, false);
    324324        }
     
    330330     */
    331331    @Test
    332     public void testClosed() throws SearchParseError {
     332    void testClosed() throws SearchParseError {
    333333        SearchContext sc = new SearchContext("closed");
    334334        // Closed
    335335        sc.w1.addNode(sc.n1);
    336336        for (Way w : new Way[]{sc.w1}) {
    337             assertTrue(w.toString(), w.isClosed());
     337            assertTrue(w.isClosed(), w::toString);
    338338            sc.match(w, true);
    339339        }
     
    349349     */
    350350    @Test
    351     public void testNew() throws SearchParseError {
     351    void testNew() throws SearchParseError {
    352352        SearchContext sc = new SearchContext("new");
    353353        // New
    354354        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.w1, sc.r1}) {
    355             assertTrue(p.toString(), p.isNew());
     355            assertTrue(p.isNew(), p::toString);
    356356            sc.match(p, true);
    357357        }
     
    359359        for (OsmPrimitive p : new OsmPrimitive[]{sc.n2, sc.w2, sc.r2}) {
    360360            p.setOsmId(2, 2);
    361             assertFalse(p.toString(), p.isNew());
     361            assertFalse(p.isNew(), p::toString);
    362362            sc.match(p, false);
    363363        }
     
    369369     */
    370370    @Test
    371     public void testTypeNode() throws SearchParseError {
     371    void testTypeNode() throws SearchParseError {
    372372        final SearchContext sc = new SearchContext("type:node");
    373373        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) {
     
    381381     */
    382382    @Test
    383     public void testTypeWay() throws SearchParseError {
     383    void testTypeWay() throws SearchParseError {
    384384        final SearchContext sc = new SearchContext("type:way");
    385385        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) {
     
    393393     */
    394394    @Test
    395     public void testTypeRelation() throws SearchParseError {
     395    void testTypeRelation() throws SearchParseError {
    396396        final SearchContext sc = new SearchContext("type:relation");
    397397        for (OsmPrimitive p : new OsmPrimitive[]{sc.n1, sc.n2, sc.w1, sc.w2, sc.r1, sc.r2}) {
     
    405405     */
    406406    @Test
    407     public void testUser() throws SearchParseError {
     407    void testUser() throws SearchParseError {
    408408        final SearchContext foobar = new SearchContext("user:foobar");
    409409        foobar.n1.setUser(User.createLocalUser("foobar"));
     
    421421     */
    422422    @Test
    423     public void testFooTypeBar() throws SearchParseError {
     423    void testFooTypeBar() throws SearchParseError {
    424424        Exception e = assertThrows(SearchParseError.class, () -> SearchCompiler.compile("foo type bar"));
    425425        assertEquals("<html>Expecting <code>:</code> after <i>type</i></html>", e.getMessage());
     
    431431     */
    432432    @Test
    433     public void testTimestamp() throws SearchParseError {
     433    void testTimestamp() throws SearchParseError {
    434434        final Node n1 = new Node();
    435435        n1.setTimestamp(DateUtils.fromString("2010-01-22"));
     
    448448     */
    449449    @Test
    450     public void testBooleanLogic() throws SearchParseError {
     450    void testBooleanLogic() throws SearchParseError {
    451451        final SearchCompiler.Match c1 = SearchCompiler.compile("foo AND bar AND baz");
    452452        assertTrue(c1.match(OsmUtils.createPrimitive("node foobar=baz")));
     
    471471     */
    472472    @Test
    473     public void testBuildSearchStringForTag() throws SearchParseError {
     473    void testBuildSearchStringForTag() throws SearchParseError {
    474474        final Tag tag1 = new Tag("foo=", "bar\"");
    475475        final Tag tag2 = new Tag("foo=", "=bar");
     
    486486    /**
    487487     * 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() {
    492491        // https://bugs.openjdk.java.net/browse/JI-9044959
    493492        SearchSetting setting = new SearchSetting();
    494493        setting.regexSearch = true;
    495494        setting.text = "[";
    496         SearchCompiler.compile(setting);
     495        assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting));
    497496    }
    498497
     
    502501     */
    503502    @Test
    504     public void testTicket14217() throws Exception {
     503    void testTicket14217() throws Exception {
    505504        assertNotNull(SearchCompiler.compile(new String(Files.readAllBytes(
    506505                Paths.get(TestUtils.getRegressionDataFile(14217, "filter.txt"))), StandardCharsets.UTF_8)));
     
    509508    /**
    510509     * 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() {
    515513        SearchSetting setting = new SearchSetting();
    516514        setting.mapCSSSearch = true;
    517515        setting.text = "w"; // partial input
    518         SearchCompiler.compile(setting);
     516        assertThrows(SearchParseError.class, () -> SearchCompiler.compile(setting));
    519517    }
    520518
     
    524522     */
    525523    @Test
    526     public void testEmptyValues15943() throws SearchParseError {
     524    void testEmptyValues15943() throws SearchParseError {
    527525        Match matcher = SearchCompiler.compile("access=");
    528526        assertTrue(matcher.match(new Tag("access", null)));
     
    536534     */
    537535    @Test
    538     public void testKeyExists15943() throws SearchParseError {
     536    void testKeyExists15943() throws SearchParseError {
    539537        Match matcher = SearchCompiler.compile("surface:");
    540538        assertTrue(matcher.match(new Tag("surface", "")));
     
    549547     */
    550548    @Test
    551     public void testEnumExactKeyValueMode() {
     549    void testEnumExactKeyValueMode() {
    552550        assertDoesNotThrow(() -> TestUtils.superficialEnumCodeCoverage(ExactKeyValue.Mode.class));
    553551    }
     
    555553    /**
    556554     * Robustness test for preset searching. Ensures that the query 'preset:' is not accepted.
    557      * @throws SearchParseError always
    558555     * @since 12464
    559556     */
    560     @Test(expected = SearchParseError.class)
    561     public void testPresetSearchMissingValue() throws SearchParseError {
     557    @Test
     558    void testPresetSearchMissingValue() {
    562559        SearchSetting settings = new SearchSetting();
    563560        settings.text = "preset:";
     
    566563        TaggingPresets.readFromPreferences();
    567564
    568         SearchCompiler.compile(settings);
     565        assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings));
    569566    }
    570567
     
    572569     * Robustness test for preset searching. Validates that it is not possible to search for
    573570     * non existing presets.
    574      * @throws SearchParseError always
    575571     * @since 12464
    576572     */
    577     @Test(expected = SearchParseError.class)
    578     public void testPresetNotExist() throws SearchParseError {
     573    @Test
     574    void testPresetNotExist() {
    579575        String testPresetName = "groupnamethatshouldnotexist/namethatshouldnotexist";
    580576        SearchSetting settings = new SearchSetting();
     
    585581        TaggingPresets.readFromPreferences();
    586582
    587         SearchCompiler.compile(settings);
     583        assertThrows(SearchParseError.class, () -> SearchCompiler.compile(settings));
    588584    }
    589585
     
    591587     * Robustness tests for preset searching. Ensures that combined preset names (having more than
    592588     * 1 word) must be enclosed with " .
    593      * @throws SearchParseError always
    594589     * @since 12464
    595590     */
    596     @Test(expected = SearchParseError.class)
    597     public void testPresetMultipleWords() throws SearchParseError {
     591    @Test
     592    void testPresetMultipleWords() {
    598593        TaggingPreset testPreset = new TaggingPreset();
    599594        testPreset.name = "Test Combined Preset Name";
     
    609604        TaggingPresets.readFromPreferences();
    610605
    611         SearchCompiler.compile(settings);
     606        assertThrows(IllegalArgumentException.class, () -> SearchCompiler.compile(settings));
    612607    }
    613608
     
    621616     */
    622617    @Test
    623     public void testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException {
     618    void testPresetLookup() throws SearchParseError, NoSuchFieldException, IllegalAccessException {
    624619        TaggingPreset testPreset = new TaggingPreset();
    625620        testPreset.name = "Test Preset Name";
     
    660655     */
    661656    @Test
    662     public void testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException {
     657    void testPresetLookupWildcard() throws SearchParseError, NoSuchFieldException, IllegalAccessException {
    663658        TaggingPresetMenu group = new TaggingPresetMenu();
    664659        group.name = "TestPresetGroup";
     
    705700     */
    706701    @Test
    707     public void testPreset() throws SearchParseError {
     702    void testPreset() throws SearchParseError {
    708703        final String presetName = "Test Preset Name";
    709704        final String presetGroupName = "Test Preset Group";
     
    744739     */
    745740    @Test
    746     public void testEqualsContract() {
     741    void testEqualsContract() {
    747742        TestUtils.assumeWorkingEqualsVerifier();
    748743        Set<Class<? extends Match>> matchers = TestUtils.getJosmSubtypes(Match.class);
     
    768763     */
    769764    @Test
    770     public void testNodeCount() throws SearchParseError {
     765    void testNodeCount() throws SearchParseError {
    771766        final SearchContext sc = new SearchContext("nodes:2");
    772767        sc.match(sc.n1, false);
     
    784779     */
    785780    @Test
    786     public void testWayCount() throws SearchParseError {
     781    void testWayCount() throws SearchParseError {
    787782        final SearchContext sc = new SearchContext("ways:2");
    788783        sc.match(sc.n1, true);
     
    800795     */
    801796    @Test
    802     public void testMemberCount() throws SearchParseError {
     797    void testMemberCount() throws SearchParseError {
    803798        final SearchContext sc = new SearchContext("members:2");
    804799        sc.match(sc.n1, false);
     
    814809     */
    815810    @Test
    816     public void testRole() throws SearchParseError {
     811    void testRole() throws SearchParseError {
    817812        final SearchContext sc = new SearchContext("role:foo");
    818813        sc.match(sc.r1, false);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/search/SearchModeTest.java

    r12659 r17275  
    22package org.openstreetmap.josm.data.osm.search;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.TestUtils;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1212 * Unit tests for class {@link SearchMode}.
    1313 */
    14 public class SearchModeTest {
     14class SearchModeTest {
    1515
    1616    /**
    1717     * Setup rules.
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2525     */
    2626    @Test
    27     public void testEnumSearchMode() {
     27    void testEnumSearchMode() {
    2828        TestUtils.superficialEnumCodeCoverage(SearchMode.class);
    2929    }
  • trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitorTest.java

    r16445 r17275  
    22package org.openstreetmap.josm.data.osm.visitor;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.Collection;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.osm.DataSet;
     
    2626 * Unit tests for class {@link MergeSourceBuildingVisitor}.
    2727 */
    28 public class MergeSourceBuildingVisitorTest {
     28class MergeSourceBuildingVisitorTest {
    2929
    3030    protected OsmPrimitive lookupByName(Collection<? extends OsmPrimitive> primitives, String name) {
     
    3939     * Setup test.
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules();
    4444
    4545    @Test
    46     public void testNodes() {
     46    void testNodes() {
    4747        DataSet source = new DataSet();
    4848        Node n1 = new Node(1);
     
    7878
    7979    @Test
    80     public void testOneWay() {
     80    void testOneWay() {
    8181        DataSet source = new DataSet();
    8282        Node n1 = new Node(1);
     
    110110
    111111    @Test
    112     public void testOneWayNodesSelectedToo() {
     112    void testOneWayNodesSelectedToo() {
    113113        DataSet source = new DataSet();
    114114        Node n1 = new Node(1);
     
    142142
    143143    @Test
    144     public void testOneWayIncomplete() {
     144    void testOneWayIncomplete() {
    145145        DataSet source = new DataSet();
    146146        Way w1 = new Way(3);
     
    160160
    161161    @Test
    162     public void testOneRelationExistingMembersSelected() {
     162    void testOneRelationExistingMembersSelected() {
    163163        DataSet source = new DataSet();
    164164        Relation r1 = new Relation(1, 1);
     
    219219
    220220    @Test
    221     public void testOneRelationExistingMembersNotSelected() {
     221    void testOneRelationExistingMembersNotSelected() {
    222222        DataSet source = new DataSet();
    223223        Relation r1 = new Relation(1, 1);
     
    278278
    279279    @Test
    280     public void testOneRelationNewMembersNotSelected() {
     280    void testOneRelationNewMembersNotSelected() {
    281281        DataSet source = new DataSet();
    282282        Relation r1 = new Relation();
     
    345345
    346346    @Test
    347     public void testOneRelationExistingRecursive() {
     347    void testOneRelationExistingRecursive() {
    348348        DataSet source = new DataSet();
    349349        Relation r1 = new Relation(1, 1);
     
    364364
    365365    @Test
    366     public void testOneRelationNewRecursive() {
     366    void testOneRelationNewRecursive() {
    367367        DataSet source = new DataSet();
    368368        Relation r1 = new Relation();
     
    384384
    385385    @Test
    386     public void testTwoRelationExistingCircular() {
     386    void testTwoRelationExistingCircular() {
    387387        DataSet source = new DataSet();
    388388        Relation r1 = new Relation(1, 1);
  • trunk/test/unit/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererTest.java

    r14694 r17275  
    22package org.openstreetmap.josm.data.osm.visitor.paint;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.StyleRecord;
     
    1717 * @since 12078
    1818 */
    19 public class StyledMapRendererTest {
     19class StyledMapRendererTest {
    2020
    2121    /**
     
    2323     */
    2424    @Test
    25     public void testFloatToFixed() {
     25    void testFloatToFixed() {
    2626        long inf = floatToFixedCheckBits(Float.POSITIVE_INFINITY, 24);
    2727        long big = floatToFixedCheckBits(Float.MAX_VALUE, 24);
     
    8585     */
    8686    @Test
    87     public void testEqualsContract() {
     87    void testEqualsContract() {
    8888        TestUtils.assumeWorkingEqualsVerifier();
    8989        EqualsVerifier.forClass(StyleRecord.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/JosmUrlsTest.java

    r14119 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.spi.preferences.Config;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link JosmUrls} class.
    1515 */
    16 public class JosmUrlsTest {
     16class JosmUrlsTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().devAPI();
     
    2727     */
    2828    @Test
    29     public void testGetBaseUserUrl() {
     29    void testGetBaseUserUrl() {
    3030        assertEquals("https://api06.dev.openstreetmap.org/user", Config.getUrls().getBaseUserUrl());
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/NamedColorPropertyTest.java

    r17119 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.awt.Color;
     
    1111import javax.swing.UIManager;
    1212
    13 import org.junit.Before;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeEach;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.Preferences;
    1717import org.openstreetmap.josm.spi.preferences.Config;
     
    2424 * @author Michael Zangl
    2525 */
    26 public class NamedColorPropertyTest {
     26class NamedColorPropertyTest {
    2727    /**
    2828     * This is a preference test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3636     * Set up test case
    3737     */
    38     @Before
     38    @BeforeEach
    3939    public void createTestProperty() {
    4040        base = new NamedColorProperty("test", Color.RED);
     
    4545     */
    4646    @Test
    47     public void testGet() {
     47    void testGet() {
    4848        assertEquals(Color.RED, base.get());
    4949
     
    6565     */
    6666    @Test
    67     public void testPut() {
     67    void testPut() {
    6868        assertEquals(Color.RED, base.get());
    6969
     
    8080     */
    8181    @Test
    82     public void testColorAlpha() {
     82    void testColorAlpha() {
    8383        assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha());
    8484        assertTrue(Preferences.main().putList("clr.general.bar", Arrays.asList("#34567812", "general", "", "bar")));
     
    9090     */
    9191    @Test
    92     public void testColorNameAlpha() {
     92    void testColorNameAlpha() {
    9393        assertEquals(0x12, new NamedColorProperty("foo", new Color(0x12345678, true)).get().getAlpha());
    9494    }
     
    9898     */
    9999    @Test
    100     public void testGetChildColor() {
     100    void testGetChildColor() {
    101101        AbstractProperty<Color> child = base.getChildColor("test2");
    102102
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/PreferencesWriterTest.java

    r12884 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
     
    1313import java.util.TreeMap;
    1414
    15 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.data.Version;
    1717import org.openstreetmap.josm.spi.preferences.Setting;
     
    2525 * Unit tests for class {@link PreferencesWriter}.
    2626 */
    27 public class PreferencesWriterTest {
     27class PreferencesWriterTest {
    2828
    2929    private static <T extends AbstractSetting<?>> T setting(T s, long time) {
     
    3737     */
    3838    @Test
    39     public void testListList() throws IOException {
     39    void testListList() throws IOException {
    4040        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    4141            long time = System.currentTimeMillis() / 1000;
     
    5656     */
    5757    @Test
    58     public void testList() throws IOException {
     58    void testList() throws IOException {
    5959        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    6060            long time = System.currentTimeMillis() / 1000;
     
    7373     */
    7474    @Test
    75     public void testMapList() throws IOException {
     75    void testMapList() throws IOException {
    7676        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    7777            long time = System.currentTimeMillis() / 1000;
     
    9494     */
    9595    @Test
    96     public void testString() throws IOException {
     96    void testString() throws IOException {
    9797        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    9898            long time = System.currentTimeMillis() / 1000;
     
    109109     */
    110110    @Test
    111     public void testWrite() throws IOException {
     111    void testWrite() throws IOException {
    112112        try (StringWriter out = new StringWriter(); PreferencesWriter w = new PreferencesWriter(new PrintWriter(out), true, true)) {
    113113            long time = System.currentTimeMillis() / 1000;
     
    132132     */
    133133    @Test
    134     public void testNullValue() throws IOException {
     134    void testNullValue() throws IOException {
    135135        long time = System.currentTimeMillis() / 1000;
    136136        // CHECKSTYLE.OFF: LineLength
  • trunk/test/unit/org/openstreetmap/josm/data/preferences/StrokePropertyTest.java

    r15775 r17275  
    22package org.openstreetmap.josm.data.preferences;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    66
    77import java.awt.BasicStroke;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.spi.preferences.Config;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * @author Michael Zangl
    1919 */
    20 public class StrokePropertyTest {
     20class StrokePropertyTest {
    2121    /**
    2222     * This is a preference test
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3030     */
    3131    @Test
    32     public void testGetValue() {
     32    void testGetValue() {
    3333        StrokeProperty property = new StrokeProperty("x", "1");
    3434
     
    7575     */
    7676    @Test
    77     public void testPutValue() {
     77    void testPutValue() {
    7878        StrokeProperty property = new StrokeProperty("x", new BasicStroke(12));
    7979        BasicStroke bs = property.get();
  • trunk/test/unit/org/openstreetmap/josm/data/projection/CustomProjectionTest.java

    r13602 r17275  
    22package org.openstreetmap.josm.data.projection;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.util.stream.Stream;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.data.coor.LatLon;
    1313import org.openstreetmap.josm.data.projection.CustomProjection.Polarity;
     
    2020 * @author Michael Zangl
    2121 */
    22 public class CustomProjectionTest {
     22class CustomProjectionTest {
    2323    /**
    2424     * Need pref to load pref.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3333     */
    3434    @Test
    35     public void testParseAngle() throws ProjectionConfigurationException {
     35    void testParseAngle() throws ProjectionConfigurationException {
    3636        assertEquals(0, CustomProjection.parseAngle("0", "xxx"), 1e-10);
    3737        assertEquals(1, CustomProjection.parseAngle("1", "xxx"), 1e-10);
     
    8686     */
    8787    @Test
    88     public void testPolarity() {
     88    void testPolarity() {
    8989        assertEquals(LatLon.NORTH_POLE, Polarity.NORTH.getLatLon());
    9090        assertEquals(LatLon.SOUTH_POLE, Polarity.SOUTH.getLatLon());
  • trunk/test/unit/org/openstreetmap/josm/data/projection/EllipsoidTest.java

    r11324 r17275  
    66
    77import org.junit.Assert;
    8 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.coor.LatLon;
    1010
     
    1212 * Unit tests for class {@link Ellipsoid}.
    1313 */
    14 public class EllipsoidTest {
     14class EllipsoidTest {
    1515
    1616    private static final double EPSILON = 1e-8;
     
    2020     */
    2121    @Test
    22     public void testLatLon2Cart2LatLon() {
     22    void testLatLon2Cart2LatLon() {
    2323        Random r = new SecureRandom();
    2424        double maxErrLat = 0, maxErrLon = 0;
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRefTest.java

    r16643 r17275  
    3434import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    3535import org.junit.Assert;
    36 import org.junit.Rule;
    37 import org.junit.Test;
     36import org.junit.jupiter.api.extension.RegisterExtension;
     37import org.junit.jupiter.api.Test;
    3838import org.openstreetmap.josm.data.Bounds;
    3939import org.openstreetmap.josm.data.coor.EastNorth;
     
    5959 * of the algorithm, given a certain definition.
    6060 */
    61 public class ProjectionRefTest {
     61class ProjectionRefTest {
    6262
    6363    private static final String CS2CS_EXE = "cs2cs";
     
    8686     * Setup test.
    8787     */
    88     @Rule
     88    @RegisterExtension
    8989    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    9090    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids().timeout(90_000);
     
    373373     */
    374374    @Test
    375     public void testProjections() throws IOException {
     375    void testProjections() throws IOException {
    376376        StringBuilder fail = new StringBuilder();
    377377        Map<String, Set<String>> failingProjs = new HashMap<>();
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionRegressionTest.java

    r16643 r17275  
    1919import java.util.stream.Collectors;
    2020
    21 import org.junit.BeforeClass;
    22 import org.junit.Test;
     21import org.junit.jupiter.api.BeforeAll;
     22import org.junit.jupiter.api.Test;
    2323import org.openstreetmap.josm.JOSMFixture;
    2424import org.openstreetmap.josm.data.Bounds;
     
    3939 * test data, by running the main method of this class and commit the new data file.
    4040 */
    41 public class ProjectionRegressionTest {
     41class ProjectionRegressionTest {
    4242
    4343    private static final String PROJECTION_DATA_FILE = "nodist/data/projection/projection-regression-test-data";
     
    136136     * Setup test.
    137137     */
    138     @BeforeClass
     138    @BeforeAll
    139139    public static void setUp() {
    140140        JOSMFixture.createUnitTestFixture().init();
     
    146146     */
    147147    @Test
    148     public void testNonRegression() throws IOException {
     148    void testNonRegression() throws IOException {
    149149        List<TestData> allData = readData();
    150150        Set<String> dataCodes = allData.stream().map(data -> data.code).collect(Collectors.toSet());
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ProjectionTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.projection;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    66import java.security.SecureRandom;
     
    1111
    1212import org.junit.Assert;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.Bounds;
    1515import org.openstreetmap.josm.data.coor.EastNorth;
     
    1919 * Unit tests for class {@link Projection}.
    2020 */
    21 public class ProjectionTest {
     21class ProjectionTest {
    2222
    2323    private static final Random rand = new SecureRandom();
     
    3030     */
    3131    @Test
    32     public void testProjections() {
     32    void testProjections() {
    3333        error = false;
    3434        text = "";
     
    120120     */
    121121    @Test
    122     public void testProjs() {
     122    void testProjs() {
    123123        error2 = false;
    124124        text2 = "";
     
    150150            Assert.fail();
    151151        }
    152         assertTrue("missing test: "+projIds, projIds.isEmpty());
     152        assertTrue(projIds.isEmpty(), "missing test: "+projIds);
    153153    }
    154154
     
    170170            EastNorth en = p.latlon2eastNorth(ll1);
    171171            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);
    173173            double dist = ll1.greatCircleDistance(ll2);
    174174            if (dist > eps) {
     
    189189     */
    190190    @Test
    191     public void testSwedishProjections() {
     191    void testSwedishProjections() {
    192192        for (int code = 3006; code <= 3018; code++) {
    193193            assertTrue(Projections.getProjectionByCode("EPSG:"+code).switchXY());
  • trunk/test/unit/org/openstreetmap/josm/data/projection/ShiftedProjectionTest.java

    r12161 r17275  
    22package org.openstreetmap.josm.data.projection;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Comparator;
     
    1111import java.util.stream.Collectors;
    1212
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.ProjectionBounds;
    1515import org.openstreetmap.josm.data.coor.EastNorth;
     
    2121 * @author Michael Zangl
    2222 */
    23 public class ShiftedProjectionTest {
     23class ShiftedProjectionTest {
    2424    private static final class ProjectingBase implements Projecting {
    2525        @Override
     
    5757     */
    5858    @Test
    59     public void testLatlon2eastNorth() {
     59    void testLatlon2eastNorth() {
    6060        Projecting base = new ProjectingBase();
    6161
     
    8181     */
    8282    @Test
    83     public void testEastNorth2latlonClamped() {
     83    void testEastNorth2latlonClamped() {
    8484        Projecting base = new ProjectingBase();
    8585
     
    105105     */
    106106    @Test
    107     public void testGetProjectingsForArea() {
     107    void testGetProjectingsForArea() {
    108108        Projecting base = new ProjectingBase();
    109109        ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7));
     
    124124     */
    125125    @Test
    126     public void testGetProjectingsForAreaMultiple() {
     126    void testGetProjectingsForAreaMultiple() {
    127127        Projecting base = new ProjectingBase();
    128128        ShiftedProjecting shifted = new ShiftedProjecting(base, new EastNorth(5, 7));
  • trunk/test/unit/org/openstreetmap/josm/data/projection/SwissGridTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.projection;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertSame;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6
     7import org.junit.jupiter.api.BeforeAll;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.data.coor.EastNorth;
    1111import org.openstreetmap.josm.data.coor.LatLon;
     
    1717 * Unit tests for the Swiss projection grid.
    1818 */
    19 public class SwissGridTest {
     19class SwissGridTest {
    2020    private static final String SWISS_EPSG_CODE = "EPSG:21781";
    2121    private final boolean debug = false;
     
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().projectionNadGrids();
     
    3131     * Setup test.
    3232     */
    33     @BeforeClass
     33    @BeforeAll
    3434    public static void setUp() {
    3535        ProjectionRegistry.setProjection(Projections.getProjectionByCode(SWISS_EPSG_CODE)); // Swiss grid
     
    7979            }
    8080        }
    81         assertSame(errs.toString(), errs.length(), 0);
     81        assertSame(errs.length(), 0, errs::toString);
    8282    }
    8383
     
    8686     */
    8787    @Test
    88     public void testProjReferenceTestAccurate() {
     88    void testProjReferenceTestAccurate() {
    8989        projReferenceTest(EPSILON_ACCURATE);
    9090    }
     
    9494     */
    9595    @Test
    96     public void testAlatlon2eastNorth() {
     96    void testAlatlon2eastNorth() {
    9797        LatLon ll = new LatLon(46.518, 6.567);
    9898        EastNorth en = ProjectionRegistry.getProjection().latlon2eastNorth(ll);
     
    100100            System.out.println(en);
    101101        }
    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");
    104104
    105105        ll = new LatLon(47.78, 8.58);
     
    108108            System.out.println(en);
    109109        }
    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");
    112112
    113113        ll = new LatLon(46.58, 10.48);
     
    116116            System.out.println(en);
    117117        }
    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");
    120120
    121121        ll = new LatLon(46.0 + 57.0 / 60 + 3.89813884505 / 3600, 7.0 + 26.0 / 60 + 19.076595154147 / 3600);
     
    124124            System.out.println(en);
    125125        }
    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");
    128128
    129129        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
     
    133133            System.out.println(en);
    134134        }
    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");
    137137    }
    138138
     
    141141     */
    142142    @Test
    143     public void testBeastNorth2latlon() {
     143    void testBeastNorth2latlon() {
    144144        EastNorth en = new EastNorth(533112.13, 152227.35);
    145145        LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     
    147147            System.out.println(ll);
    148148        }
    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");
    151151
    152152        en = new EastNorth(685542.97, 292783.21);
     
    155155            System.out.println(ll);
    156156        }
    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");
    159159
    160160        en = new EastNorth(833066.95, 163265.32);
     
    163163            System.out.println(ll);
    164164        }
    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");
    167167
    168168        en = new EastNorth(600000.0, 200000.0);
     
    171171            System.out.println(ll);
    172172        }
    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");
    175175
    176176        // http://geodesy.geo.admin.ch/reframe/lv03towgs84?easting=700000&northing=100000
     
    180180            System.out.println(ll);
    181181        }
    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");
    184184    }
    185185
     
    188188     */
    189189    @Test
    190     public void testCsendandreturn() {
     190    void testCsendandreturn() {
    191191        EastNorth en = new EastNorth(533111.69, 152227.85);
    192192        LatLon ll = ProjectionRegistry.getProjection().eastNorth2latlon(en);
     
    198198            System.out.println(en.north() - en2.north());
    199199        }
    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");
    202202
    203203        en = new EastNorth(685544.16, 292782.91);
     
    210210            System.out.println(en.north() - en2.north());
    211211        }
    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");
    214214
    215215        en = new EastNorth(833068.04, 163265.39);
     
    222222            System.out.println(en.north() - en2.north());
    223223        }
    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");
    226226
    227227        en = new EastNorth(600000.0, 200000.0);
     
    234234            System.out.println(en.north() - en2.north());
    235235        }
    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");
    238238
    239239        en = new EastNorth(700000.0, 100000.0);
     
    246246            System.out.println(en.north() - en2.north());
    247247        }
    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");
    250250    }
    251251}
  • trunk/test/unit/org/openstreetmap/josm/data/projection/proj/LonLatTest.java

    r11931 r17275  
    22package org.openstreetmap.josm.data.projection.proj;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Tests for {@link LonLat}.
    1414 */
    15 public class LonLatTest {
     15class LonLatTest {
    1616    /**
    1717     * Setup rule.
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2525     */
    2626    @Test
    27     public void testLonIsLinearToEast() {
     27    void testLonIsLinearToEast() {
    2828        assertFalse(new LonLat().lonIsLinearToEast());
    2929    }
  • trunk/test/unit/org/openstreetmap/josm/data/projection/proj/MercatorTest.java

    r11931 r17275  
    22package org.openstreetmap.josm.data.projection.proj;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Tests for {@link Mercator}.
    1414 */
    15 public class MercatorTest {
     15class MercatorTest {
    1616    /**
    1717     * Setup rule.
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2525     */
    2626    @Test
    27     public void testLonIsLinearToEast() {
     27    void testLonIsLinearToEast() {
    2828        assertTrue(new Mercator().lonIsLinearToEast());
    2929    }
  • trunk/test/unit/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriorityTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.data.tagging.ac;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.ArrayList;
     
    1212import java.util.TreeSet;
    1313
    14 import org.junit.Rule;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.TestUtils;
    1717import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2323 * Unit tests of {@link AutoCompletionPriority}.
    2424 */
    25 public class AutoCompletionPriorityTest {
     25class AutoCompletionPriorityTest {
    2626
    2727    /**
    2828     * Setup test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testGetters() {
     38    void testGetters() {
    3939        assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInStandard());
    4040        assertTrue(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET.isInDataSet());
     
    6969     */
    7070    @Test
    71     public void testOrdering() {
     71    void testOrdering() {
    7272        SortedSet<AutoCompletionPriority> set = new TreeSet<>();
    7373        set.add(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET);
     
    9696     */
    9797    @Test
    98     public void testEqualsContract() {
     98    void testEqualsContract() {
    9999        TestUtils.assumeWorkingEqualsVerifier();
    100100        EqualsVerifier.forClass(AutoCompletionPriority.class).usingGetClass()
     
    106106     */
    107107    @Test
    108     public void testToString() {
     108    void testToString() {
    109109        assertEquals("<Priority; userInput: no, inDataSet: true, inStandard: false, selected: false>",
    110110                AutoCompletionPriority.IS_IN_DATASET.toString());
     
    117117     */
    118118    @Test
    119     public void testMergeWith() {
     119    void testMergeWith() {
    120120        assertEquals(AutoCompletionPriority.IS_IN_STANDARD_AND_IN_DATASET,
    121121                AutoCompletionPriority.IS_IN_DATASET.mergeWith(AutoCompletionPriority.IS_IN_STANDARD));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/OsmValidatorTest.java

    r16447 r17275  
    22package org.openstreetmap.josm.data.validation;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertNotEquals;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotEquals;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    8 import org.junit.Before;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeEach;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.data.validation.tests.Addresses;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * Unit tests for class {@link OsmValidator}.
    1919 */
    20 public class OsmValidatorTest {
     20class OsmValidatorTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().projection();
     
    3131     * @throws Exception if an error occurs
    3232     */
    33     @Before
     33    @BeforeEach
    3434    public void setUp() throws Exception {
    3535        OsmValidator.clearIgnoredErrors();
     
    4141     */
    4242    @Test
    43     public void testUtilityClass() throws ReflectiveOperationException {
     43    void testUtilityClass() throws ReflectiveOperationException {
    4444        UtilityClassTestUtil.assertUtilityClassWellDefined(OsmValidator.class);
    4545    }
     
    4949     */
    5050    @Test
    51     public void testCleanupIgnoredErrors1() {
     51    void testCleanupIgnoredErrors1() {
    5252        OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way");
    5353        OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way");
     
    6464     */
    6565    @Test
    66     public void testCleanupIgnoredErrorsTicket17837() {
     66    void testCleanupIgnoredErrorsTicket17837() {
    6767        OsmValidator.addIgnoredError("120");
    6868        OsmValidator.addIgnoredError("3000");
     
    7777     */
    7878    @Test
    79     public void testCleanupIgnoredErrorsTicket18223() {
     79    void testCleanupIgnoredErrorsTicket18223() {
    8080        OsmValidator.addIgnoredError("1351:n_2449148994:w_236955234", "Way end node near other way");
    8181        OsmValidator.addIgnoredError("1351:n_6871910559:w_733713588", "Way end node near other way");
     
    9090     */
    9191    @Test
    92     public void testRemoveTests() {
     92    void testRemoveTests() {
    9393        org.openstreetmap.josm.data.validation.Test test = new org.openstreetmap.josm.data.validation.Test("test") {
    9494        };
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTest.java

    r12620 r17275  
    2222import static org.junit.Assert.assertNull;
    2323import static org.junit.Assert.assertTrue;
    24 import static org.junit.Assert.fail;
     24import static org.junit.jupiter.api.Assertions.fail;
    2525
    2626import java.lang.reflect.Field;
     
    2828import java.util.Locale;
    2929
    30 import org.junit.Before;
    31 import org.junit.Test;
     30import org.junit.jupiter.api.BeforeEach;
     31import org.junit.jupiter.api.Test;
    3232import org.openstreetmap.josm.data.validation.routines.DomainValidator.ArrayType;
    3333import org.openstreetmap.josm.tools.Logging;
     
    3838 * @version $Revision: 1741724 $
    3939 */
    40 public class DomainValidatorTest {
     40class DomainValidatorTest {
    4141
    4242    private DomainValidator validator;
     
    4545     * Setup test.
    4646     */
    47     @Before
     47    @BeforeEach
    4848    public void setUp() {
    4949        validator = DomainValidator.getInstance();
     
    5555     */
    5656    @Test
    57     public void testValidDomains() {
     57    void testValidDomains() {
    5858        assertTrue("apache.org should validate", validator.isValid("apache.org"));
    5959        assertTrue("www.google.com should validate", validator.isValid("www.google.com"));
     
    7575     */
    7676    @Test
    77     public void testInvalidDomains() {
     77    void testInvalidDomains() {
    7878        assertFalse("bare TLD .org shouldn't validate", validator.isValid(".org"));
    7979        assertFalse("domain name with spaces shouldn't validate", validator.isValid(" apache.org "));
     
    9494     */
    9595    @Test
    96     public void testTopLevelDomains() {
     96    void testTopLevelDomains() {
    9797        // infrastructure TLDs
    9898        assertTrue(".arpa should validate as iTLD", validator.isValidInfrastructureTld(".arpa"));
     
    121121     */
    122122    @Test
    123     public void testAllowLocal() {
     123    void testAllowLocal() {
    124124       DomainValidator noLocal = DomainValidator.getInstance(false);
    125125       DomainValidator allowLocal = DomainValidator.getInstance(true);
     
    147147     */
    148148    @Test
    149     public void testIDN() {
     149    void testIDN() {
    150150       assertTrue("b\u00fccher.ch in IDN should validate", validator.isValid("www.xn--bcher-kva.ch"));
    151151    }
     
    155155     */
    156156    @Test
    157     public void testIDNJava6OrLater() {
     157    void testIDNJava6OrLater() {
    158158        String version = System.getProperty("java.version");
    159159        if (version.compareTo("1.6") < 0) {
     
    171171     */
    172172    @Test
    173     public void testRFC2396domainlabel() { // use fixed valid TLD
     173    void testRFC2396domainlabel() { // use fixed valid TLD
    174174        assertTrue("a.ch should validate", validator.isValid("a.ch"));
    175175        assertTrue("9.ch should validate", validator.isValid("9.ch"));
     
    185185     */
    186186    @Test
    187     public void testRFC2396toplabel() {
     187    void testRFC2396toplabel() {
    188188        // These tests use non-existent TLDs so currently need to use a package protected method
    189189        assertTrue("a.c (alpha) should validate", validator.isValidDomainSyntax("a.c"));
     
    203203     */
    204204    @Test
    205     public void testDomainNoDots() {
     205    void testDomainNoDots() {
    206206        assertTrue("a (alpha) should validate", validator.isValidDomainSyntax("a"));
    207207        assertTrue("9 (alphanum) should validate", validator.isValidDomainSyntax("9"));
     
    217217     */
    218218    @Test
    219     public void testValidator297() {
     219    void testValidator297() {
    220220        assertTrue("xn--d1abbgf6aiiy.xn--p1ai should validate", validator.isValid("xn--d1abbgf6aiiy.xn--p1ai")); // This uses a valid TLD
    221221     }
     
    226226     */
    227227    @Test
    228     public void testValidator306() {
     228    void testValidator306() {
    229229        final String longString = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789A";
    230230        assertEquals(63, longString.length()); // 26 * 2 + 11
     
    251251     */
    252252    @Test
    253     public void testUnicodeToASCII() {
     253    void testUnicodeToASCII() {
    254254        String[] asciidots = {
    255255                "",
     
    289289     */
    290290    @Test
    291     public void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {
     291    void test_INFRASTRUCTURE_TLDS_sortedAndLowerCase() throws Exception {
    292292        final boolean sorted = isSortedLowerCase("INFRASTRUCTURE_TLDS");
    293293        assertTrue(sorted);
     
    299299     */
    300300    @Test
    301     public void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {
     301    void test_COUNTRY_CODE_TLDS_sortedAndLowerCase() throws Exception {
    302302        final boolean sorted = isSortedLowerCase("COUNTRY_CODE_TLDS");
    303303        assertTrue(sorted);
     
    309309     */
    310310    @Test
    311     public void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {
     311    void test_GENERIC_TLDS_sortedAndLowerCase() throws Exception {
    312312        final boolean sorted = isSortedLowerCase("GENERIC_TLDS");
    313313        assertTrue(sorted);
     
    319319     */
    320320    @Test
    321     public void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {
     321    void test_LOCAL_TLDS_sortedAndLowerCase() throws Exception {
    322322        final boolean sorted = isSortedLowerCase("LOCAL_TLDS");
    323323        assertTrue(sorted);
     
    328328     */
    329329    @Test
    330     public void testEnumIsPublic() {
     330    void testEnumIsPublic() {
    331331        assertTrue(Modifier.isPublic(DomainValidator.ArrayType.class.getModifiers()));
    332332    }
     
    336336     */
    337337    @Test
    338     public void testUpdateBaseArrays() {
     338    void testUpdateBaseArrays() {
    339339        try {
    340340            DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_RO, new String[]{"com"});
     
    371371     */
    372372    @Test
    373     public void testGetArray() {
     373    void testGetArray() {
    374374        assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_MINUS));
    375375        assertNotNull(DomainValidator.getTLDEntries(ArrayType.COUNTRY_CODE_PLUS));
     
    386386     */
    387387    @Test
    388     public void testUpdateCountryCode() {
     388    void testUpdateCountryCode() {
    389389        assertFalse(validator.isValidCountryCodeTld("com")); // cannot be valid
    390390        DomainValidator.updateTLDOverride(ArrayType.COUNTRY_CODE_PLUS, new String[]{"com"});
     
    404404     */
    405405    @Test
    406     public void testUpdateGeneric() {
     406    void testUpdateGeneric() {
    407407        assertFalse(validator.isValidGenericTld("ch")); // cannot be valid
    408408        DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"});
     
    422422     */
    423423    @Test
    424     public void testCannotUpdate() {
     424    void testCannotUpdate() {
    425425        DomainValidator.updateTLDOverride(ArrayType.GENERIC_PLUS, new String[]{"ch"}); // OK
    426426        DomainValidator dv = DomainValidator.getInstance();
     
    484484     */
    485485    @Test
    486     public void testValidatorName() {
     486    void testValidatorName() {
    487487        assertNull(DomainValidator.getInstance().getValidatorName());
    488488    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java

    r16765 r17275  
    4747import java.util.regex.Pattern;
    4848
    49 import org.junit.Rule;
    50 import org.junit.Test;
     49import org.junit.jupiter.api.extension.RegisterExtension;
     50import org.junit.jupiter.api.Test;
    5151import org.openstreetmap.josm.testutils.JOSMTestRules;
    5252import org.openstreetmap.josm.tools.Logging;
     
    5959 * @version $Revision: 1723861 $
    6060 */
    61 public class DomainValidatorTestIT {
     61class DomainValidatorTestIT {
    6262
    6363    /**
    6464     * Setup rule
    6565     */
    66     @Rule
     66    @RegisterExtension
    6767    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6868    public JOSMTestRules test = new JOSMTestRules().https();
     
    7575     */
    7676    @Test
    77     public void testIanaTldList() throws Exception {
     77    void testIanaTldList() throws Exception {
    7878        // Check the arrays first as this affects later checks
    7979        // Doing this here makes it easier when updating the lists
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/EmailValidatorTest.java

    r10378 r17275  
    2121import static org.junit.Assert.assertTrue;
    2222
    23 import org.junit.Before;
    24 import org.junit.Ignore;
    25 import org.junit.Test;
     23import org.junit.jupiter.api.BeforeEach;
     24import org.junit.jupiter.api.Disabled;
     25import org.junit.jupiter.api.Test;
    2626
    2727/**
     
    3131 * @version $Revision: 1741724 $
    3232 */
    33 public class EmailValidatorTest {
     33class EmailValidatorTest {
    3434
    3535    /**
     
    4949     * Setup
    5050     */
    51     @Before
     51    @BeforeEach
    5252    public void setUp() {
    5353        validator = EmailValidator.getInstance();
     
    5858     */
    5959    @Test
    60     public void testEmail() {
     60    void testEmail() {
    6161        assertTrue(validator.isValid("jsmith@apache.org"));
    6262        assertFalse(validator.isValid(null));
     
    6767     */
    6868    @Test
    69     public void testEmailWithNumericAddress() {
     69    void testEmailWithNumericAddress() {
    7070        assertTrue(validator.isValid("someone@[216.109.118.76]"));
    7171        assertTrue(validator.isValid("someone@yahoo.com"));
     
    7676     */
    7777    @Test
    78     public void testEmailExtension() {
     78    void testEmailExtension() {
    7979        assertTrue(validator.isValid("jsmith@apache.org"));
    8080
     
    9999     */
    100100    @Test
    101     public void testEmailWithDash() {
     101    void testEmailWithDash() {
    102102        assertTrue(validator.isValid("andy.noble@data-workshop.com"));
    103103
     
    114114     */
    115115    @Test
    116     public void testEmailWithDotEnd() {
     116    void testEmailWithDotEnd() {
    117117        assertFalse(validator.isValid("andy.noble@data-workshop.com."));
    118118    }
     
    123123     */
    124124    @Test
    125     public void testEmailWithBogusCharacter() {
     125    void testEmailWithBogusCharacter() {
    126126
    127127        assertFalse(validator.isValid("andy.noble@\u008fdata-workshop.com"));
     
    148148     */
    149149    @Test
    150     public void testVALIDATOR_315() {
     150    void testVALIDATOR_315() {
    151151        assertFalse(validator.isValid("me@at&t.net"));
    152152        assertTrue(validator.isValid("me@att.net")); // Make sure TLD is not the cause of the failure
     
    157157     */
    158158    @Test
    159     public void testVALIDATOR_278() {
     159    void testVALIDATOR_278() {
    160160        assertFalse(validator.isValid("someone@-test.com")); // hostname starts with dash/hyphen
    161161        assertFalse(validator.isValid("someone@test-.com")); // hostname ends with dash/hyphen
     
    166166     */
    167167    @Test
    168     public void testValidator235() {
     168    void testValidator235() {
    169169        String version = System.getProperty("java.version");
    170170        if (version.compareTo("1.6") < 0) {
     
    184184     */
    185185    @Test
    186     public void testEmailWithCommas() {
     186    void testEmailWithCommas() {
    187187        assertFalse(validator.isValid("joeblow@apa,che.org"));
    188188
     
    196196     */
    197197    @Test
    198     public void testEmailWithSpaces() {
     198    void testEmailWithSpaces() {
    199199        assertFalse(validator.isValid("joeblow @apache.org")); // TODO - this should be valid?
    200200
     
    215215     */
    216216    @Test
    217     public void testEmailWithControlChars() {
     217    void testEmailWithControlChars() {
    218218        for (char c = 0; c < 32; c++) {
    219219            assertFalse("Test control char " + ((int) c), validator.isValid("foo" + c + "bar@domain.com"));
     
    227227     */
    228228    @Test
    229     public void testEmailLocalhost() {
     229    void testEmailLocalhost() {
    230230       // Check the default is not to allow
    231231       EmailValidator noLocal = EmailValidator.getInstance(false);
     
    258258     */
    259259    @Test
    260     public void testEmailWithSlashes() {
     260    void testEmailWithSlashes() {
    261261       assertTrue(
    262262             "/ and ! valid in username",
     
    278278     */
    279279    @Test
    280     public void testEmailUserName() {
     280    void testEmailUserName() {
    281281
    282282        assertTrue(validator.isValid("joe1blow@apache.org"));
     
    490490     * The real solution is to fix the email parsing.
    491491     */
    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     public void 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() {
    495495        for (int index = 0; index < testEmailFromPerl.length; index++) {
    496496            String item = testEmailFromPerl[index].item;
     
    507507     */
    508508    @Test
    509     public void testValidator293() {
     509    void testValidator293() {
    510510        assertTrue(validator.isValid("abc-@abc.com"));
    511511        assertTrue(validator.isValid("abc_@abc.com"));
     
    519519     */
    520520    @Test
    521     public void testValidator365() {
     521    void testValidator365() {
    522522        assertFalse(validator.isValid(
    523523                "Loremipsumdolorsitametconsecteturadipiscingelit.Nullavitaeligulamattisrhoncusnuncegestasmattisleo."+
     
    554554     */
    555555    @Test
    556     public void testEmailAtTLD() {
     556    void testEmailAtTLD() {
    557557        EmailValidator val = EmailValidator.getInstance(false, true);
    558558        assertTrue(val.isValid("test@com"));
     
    563563     */
    564564    @Test
    565     public void testValidator359() {
     565    void testValidator359() {
    566566        EmailValidator val = EmailValidator.getInstance(false, true);
    567567        assertFalse(val.isValid("test@.com"));
     
    572572     */
    573573    @Test
    574     public void testValidator374() {
     574    void testValidator374() {
    575575        assertTrue(validator.isValid("abc@school.school"));
    576576    }
     
    580580     */
    581581    @Test
    582     public void testValidatorName() {
     582    void testValidatorName() {
    583583        assertEquals("Email validator", EmailValidator.getInstance().getValidatorName());
    584584    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/InetAddressValidatorTest.java

    r10378 r17275  
    1515 * limitations under the License.
    1616 */
    17 
    1817package org.openstreetmap.josm.data.validation.routines;
    1918
     
    2221import static org.junit.Assert.assertTrue;
    2322
    24 import org.junit.Before;
    25 import org.junit.Test;
     23import org.junit.jupiter.api.BeforeEach;
     24import org.junit.jupiter.api.Test;
    2625
    2726/**
     
    3029 * @version $Revision: 1741724 $
    3130 */
    32 public class InetAddressValidatorTest {
     31class InetAddressValidatorTest {
    3332
    3433    private InetAddressValidator validator;
     
    3736     * Setup
    3837     */
    39     @Before
     38    @BeforeEach
    4039    public void setUp() {
    4140        validator = new InetAddressValidator();
     
    4645     */
    4746    @Test
    48     public void testInetAddressesFromTheWild() {
     47    void testInetAddressesFromTheWild() {
    4948        // CHECKSTYLE.OFF: SingleSpaceSeparator
    5049        assertTrue("www.apache.org IP should be valid",   validator.isValid("140.211.11.130"));
     
    5958     */
    6059    @Test
    61     public void testVALIDATOR_335() {
     60    void testVALIDATOR_335() {
    6261        assertTrue("2001:0438:FFFE:0000:0000:0000:0000:0A35 should be valid",
    6362                validator.isValid("2001:0438:FFFE:0000:0000:0000:0000:0A35"));
     
    6867     */
    6968    @Test
    70     public void testInetAddressesByClass() {
     69    void testInetAddressesByClass() {
    7170        // CHECKSTYLE.OFF: SingleSpaceSeparator
    7271        assertTrue("class A IP should be valid",            validator.isValid("24.25.231.12"));
     
    9190     */
    9291    @Test
    93     public void testReservedInetAddresses() {
     92    void testReservedInetAddresses() {
    9493        assertTrue("localhost IP should be valid", validator.isValid("127.0.0.1"));
    9594        assertTrue("broadcast IP should be valid", validator.isValid("255.255.255.255"));
     
    10099     */
    101100    @Test
    102     public void testBrokenInetAddresses() {
     101    void testBrokenInetAddresses() {
    103102        // CHECKSTYLE.OFF: SingleSpaceSeparator
    104103        assertFalse("IP with characters should be invalid",     validator.isValid("124.14.32.abc"));
     
    119118     */
    120119    @Test
    121     public void testIPv6() {
     120    void testIPv6() {
    122121        // The original Perl script contained a lot of duplicate tests.
    123122        // I removed the duplicates I noticed, but there may be more.
     
    627626     */
    628627    @Test
    629     public void testValidatorName() {
     628    void testValidatorName() {
    630629        assertNull(new InetAddressValidator().getValidatorName());
    631630    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/RegexValidatorTest.java

    r12620 r17275  
    2121import static org.junit.Assert.assertNull;
    2222import static org.junit.Assert.assertTrue;
    23 import static org.junit.Assert.fail;
     23import static org.junit.jupiter.api.Assertions.fail;
    2424
    2525import java.util.Arrays;
    2626import java.util.regex.PatternSyntaxException;
    2727
    28 import org.junit.Test;
     28import org.junit.jupiter.api.Test;
    2929import org.openstreetmap.josm.tools.Logging;
    3030
     
    3535 * @since Validator 1.4
    3636 */
    37 public class RegexValidatorTest {
     37class RegexValidatorTest {
    3838
    3939    private static final String REGEX = "^([abc]*)(?:\\-)([DEF]*)(?:\\-)([123]*)$";
     
    5555     */
    5656    @Test
    57     public void testSingle() {
     57    void testSingle() {
    5858        RegexValidator sensitive   = new RegexValidator(REGEX);
    5959        RegexValidator insensitive = new RegexValidator(REGEX, false);
     
    8484     */
    8585    @Test
    86     public void testMultipleSensitive() {
     86    void testMultipleSensitive() {
    8787
    8888        // ------------ Set up Sensitive Validators
     
    126126     */
    127127    @Test
    128     public void testMultipleInsensitive() {
     128    void testMultipleInsensitive() {
    129129
    130130        // ------------ Set up In-sensitive Validators
     
    168168     */
    169169    @Test
    170     public void testNullValue() {
     170    void testNullValue() {
    171171        RegexValidator validator = new RegexValidator(REGEX);
    172172        assertFalse("Instance isValid()", validator.isValid(null));
     
    181181     */
    182182    @Test
    183     public void testMissingRegex() {
     183    void testMissingRegex() {
    184184
    185185        // Single Regular Expression - null
     
    238238     */
    239239    @Test
    240     public void testExceptions() {
     240    void testExceptions() {
    241241        String invalidRegex = "^([abCD12]*$";
    242242        try {
     
    252252     */
    253253    @Test
    254     public void testToString() {
     254    void testToString() {
    255255        RegexValidator single = new RegexValidator(REGEX);
    256256        assertEquals("Single", "RegexValidator{" + REGEX + "}", single.toString());
     
    264264     */
    265265    @Test
    266     public void testValidatorName() {
     266    void testValidatorName() {
    267267        assertNull(new RegexValidator(".*").getValidatorName());
    268268    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/UrlValidatorTest.java

    r11621 r17275  
    2121import static org.junit.Assert.assertTrue;
    2222
    23 import org.junit.Before;
    24 import org.junit.Test;
     23import org.junit.jupiter.api.BeforeEach;
     24import org.junit.jupiter.api.Test;
    2525
    2626/**
     
    2929 * @version $Revision: 1741724 $
    3030 */
    31 public class UrlValidatorTest {
     31class UrlValidatorTest {
    3232
    3333   private static final boolean printStatus = false;
     
    3737    * Setup
    3838    */
    39    @Before
     39   @BeforeEach
    4040   public void setUp() {
    4141      for (int index = 0; index < testPartsIndex.length - 1; index++) {
     
    140140     */
    141141    @Test
    142     public void testValidator202() {
     142    void testValidator202() {
    143143        String[] schemes = {"http", "https"};
    144144        UrlValidator urlValidator = new UrlValidator(schemes, UrlValidator.NO_FRAGMENTS);
     
    151151     */
    152152    @Test
    153     public void testValidator204() {
     153    void testValidator204() {
    154154        String[] schemes = {"http", "https"};
    155155        UrlValidator urlValidator = new UrlValidator(schemes);
     
    161161     */
    162162    @Test
    163     public void testValidator218() {
     163    void testValidator218() {
    164164        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_2_SLASHES);
    165165        assertTrue("parentheses should be valid in URLs",
     
    171171     */
    172172    @Test
    173     public void testValidator235() {
     173    void testValidator235() {
    174174        String version = System.getProperty("java.version");
    175175        if (version.compareTo("1.6") < 0) {
     
    190190     */
    191191    @Test
    192     public void testValidator248() {
     192    void testValidator248() {
    193193        RegexValidator regex = new RegexValidator(new String[] {"localhost", ".*\\.my-testing"});
    194194        UrlValidator validator = new UrlValidator(regex, 0);
     
    224224     */
    225225    @Test
    226     public void testValidator288() {
     226    void testValidator288() {
    227227        UrlValidator validator = new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS);
    228228
     
    262262     */
    263263    @Test
    264     public void testValidator276() {
     264    void testValidator276() {
    265265        // file:// isn't allowed by default
    266266        UrlValidator validator = new UrlValidator();
     
    319319     */
    320320    @Test
    321     public void testValidator309() {
     321    void testValidator309() {
    322322        UrlValidator urlValidator = new UrlValidator();
    323323        assertTrue(urlValidator.isValid("http://sample.ondemand.com/"));
     
    334334     */
    335335    @Test
    336     public void testValidator339() {
     336    void testValidator339() {
    337337        UrlValidator urlValidator = new UrlValidator();
    338338        assertTrue(urlValidator.isValid("http://www.cnn.com/WORLD/?hpt=sitenav")); // without
     
    347347     */
    348348    @Test
    349     public void testValidator339IDN() {
     349    void testValidator339IDN() {
    350350        UrlValidator urlValidator = new UrlValidator();
    351351        assertTrue(urlValidator.isValid("http://президент.рф/WORLD/?hpt=sitenav")); // without
     
    360360     */
    361361    @Test
    362     public void testValidator342() {
     362    void testValidator342() {
    363363        UrlValidator urlValidator = new UrlValidator();
    364364        assertTrue(urlValidator.isValid("http://example.rocks/"));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/AddressesTest.java

    r15745 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    77import static org.openstreetmap.josm.data.coor.LatLon.NORTH_POLE;
    88import static org.openstreetmap.josm.data.coor.LatLon.SOUTH_POLE;
     
    1111import java.util.List;
    1212
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.TestUtils;
    1616import org.openstreetmap.josm.data.coor.LatLon;
     
    2727 * JUnit Test of {@link Addresses} validation test.
    2828 */
    29 public class AddressesTest {
     29class AddressesTest {
    3030
    3131    /**
    3232     * Setup test.
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules test = new JOSMTestRules();
     
    5757     */
    5858    @Test
    59     public void testHouseNumberWithoutStreet() {
     59    void testHouseNumberWithoutStreet() {
    6060        assertNull(doTestHouseNumberWithoutStreet("", null, null));
    6161        assertNotNull(doTestHouseNumberWithoutStreet("addr:housenumber=1", null, null));
     
    9090     */
    9191    @Test
    92     public void testDuplicateHouseNumber() {
     92    void testDuplicateHouseNumber() {
    9393        String num1 = "addr:housenumber=1 addr:street=Foo ";
    9494        String num2 = "addr:housenumber=2 addr:street=Foo ";
     
    116116     */
    117117    @Test
    118     public void testMultiAddressDuplicates() {
     118    void testMultiAddressDuplicates() {
    119119        String num1 = "addr:housenumber=1,3 addr:street=Foo";
    120120        String num2 = "addr:housenumber=1 addr:street=Foo";
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CoastlinesTest.java

    r16006 r17275  
    44import java.util.stream.Collectors;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * JUnit Test of {@link Coastlines} validation test.
    1414 */
    15 public class CoastlinesTest {
     15class CoastlinesTest {
    1616
    1717    private static final Coastlines COASTLINES = new Coastlines();
     
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    3030     */
    3131    @Test
    32     public void testCoastlineFile() throws Exception {
     32    void testCoastlineFile() throws Exception {
    3333        ValidatorTestUtils.testSampleFile("nodist/data/coastlines.osm",
    3434                ds -> ds.getWays().stream().filter(
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConditionalKeysTest.java

    r15071 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Before;
    8 import org.junit.Rule;
    9 import org.junit.Test;
     7import org.junit.jupiter.api.BeforeEach;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
    1111
     
    1515 * Unit test of {@link ConditionalKeys}.
    1616 */
    17 public class ConditionalKeysTest {
     17class ConditionalKeysTest {
    1818
    1919    private final ConditionalKeys test = new ConditionalKeys();
     
    2222     * Setup test
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules rule = new JOSMTestRules().presets();
     
    3030     * @throws Exception if an error occurs
    3131     */
    32     @Before
     32    @BeforeEach
    3333    public void setUp() throws Exception {
    3434        test.initialize();
     
    3939     */
    4040    @Test
    41     public void testKeyValid() {
     41    void testKeyValid() {
    4242        assertTrue(test.isKeyValid("maxspeed:conditional"));
    4343        assertTrue(test.isKeyValid("motor_vehicle:conditional"));
     
    5555     */
    5656    @Test
    57     public void testValueValid() {
     57    void testValueValid() {
    5858        assertTrue(test.isValueValid("maxspeed:conditional", "120 @ (06:00-19:00)"));
    5959        assertFalse(test.isValueValid("maxspeed:conditional", " @ (06:00-19:00)"));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java

    r16298 r17275  
    33
    44import org.junit.Assert;
    5 import org.junit.Before;
    6 import org.junit.Test;
     5import org.junit.jupiter.api.BeforeEach;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.JOSMFixture;
    88import org.openstreetmap.josm.TestUtils;
     
    1717 * @author Taylor Smock
    1818 */
    19 public class ConnectivityRelationsTest {
     19class ConnectivityRelationsTest {
    2020    private ConnectivityRelations check;
    2121    private static final String CONNECTIVITY = "connectivity";
     
    2525     * @throws Exception if an error occurs
    2626     */
    27     @Before
     27    @BeforeEach
    2828    public void setUp() throws Exception {
    2929        JOSMFixture.createUnitTestFixture().init();
     
    4343     */
    4444    @Test
    45     public void testNoConnectivityTag() {
     45    void testNoConnectivityTag() {
    4646        Relation relation = createDefaultTestRelation();
    4747        check.visit(relation);
     
    5858     */
    5959    @Test
    60     public void testMisMatchedLanes() {
     60    void testMisMatchedLanes() {
    6161        Relation relation = createDefaultTestRelation();
    6262        check.visit(relation);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/CrossingWaysTest.java

    r15961 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.HashMap;
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.data.coor.EastNorth;
     
    2727 * Unit test of {@link CrossingWays}.
    2828 */
    29 public class CrossingWaysTest {
     29class CrossingWaysTest {
    3030
    3131    /**
    3232     * Setup test
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules rule = new JOSMTestRules().preferences();
     
    4848     */
    4949    @Test
    50     public void testGetSegments() {
     50    void testGetSegments() {
    5151        List<List<WaySegment>> list = CrossingWays.getSegments(new HashMap<>(), EastNorth.ZERO, EastNorth.ZERO);
    5252        assertEquals(1, list.size());
     
    5858     */
    5959    @Test
    60     public void testIsCoastline() {
     60    void testIsCoastline() {
    6161        assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=water")));
    6262        assertTrue(CrossingWays.isCoastline(TestUtils.newWay("natural=coastline")));
     
    6969     */
    7070    @Test
    71     public void testIsHighway() {
     71    void testIsHighway() {
    7272        assertTrue(CrossingWays.isHighway(TestUtils.newWay("highway=motorway")));
    7373        assertFalse(CrossingWays.isHighway(TestUtils.newWay("highway=rest_area")));
     
    7878     */
    7979    @Test
    80     public void testIsRailway() {
     80    void testIsRailway() {
    8181        assertTrue(CrossingWays.isRailway(TestUtils.newWay("railway=rail")));
    8282        assertFalse(CrossingWays.isRailway(TestUtils.newWay("railway=subway")));
     
    8888     */
    8989    @Test
    90     public void testIsSubwayOrTramOrRazed() {
     90    void testIsSubwayOrTramOrRazed() {
    9191        assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=subway")));
    9292        assertTrue(CrossingWays.isSubwayOrTramOrRazed(TestUtils.newWay("railway=construction construction=tram")));
     
    101101     */
    102102    @Test
    103     public void testIsProposedOrAbandoned() {
     103    void testIsProposedOrAbandoned() {
    104104        assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("highway=proposed")));
    105105        assertTrue(CrossingWays.isProposedOrAbandoned(TestUtils.newWay("railway=proposed")));
     
    112112     */
    113113    @Test
    114     public void testWays() {
     114    void testWays() {
    115115        Ways test = new CrossingWays.Ways();
    116116        // isPrimitiveUsable
     
    157157     */
    158158    @Test
    159     public void testBoundaries() {
     159    void testBoundaries() {
    160160        Boundaries test = new CrossingWays.Boundaries();
    161161        // isPrimitiveUsable
     
    171171     */
    172172    @Test
    173     public void testSelfCrossing() {
     173    void testSelfCrossing() {
    174174        SelfCrossing test = new CrossingWays.SelfCrossing();
    175175        // isPrimitiveUsable
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateNodeTest.java

    r11747 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.data.coor.LatLon;
    99import org.openstreetmap.josm.data.osm.DataSet;
     
    2020 * JUnit Test of "Duplicate node" validation test.
    2121 */
    22 public class DuplicateNodeTest {
     22class DuplicateNodeTest {
    2323
    2424    /**
    2525     * Setup test by initializing JOSM preferences and projection.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    7070     */
    7171    @Test
    72     public void testDuplicateNode() {
     72    void testDuplicateNode() {
    7373        DataSet ds = new DataSet();
    7474
     
    8888     */
    8989    @Test
    90     public void testDuplicateNodeMixed() {
     90    void testDuplicateNodeMixed() {
    9191        doTest(DuplicateNode.DUPLICATE_NODE_MIXED, new Tag("building", "foo"), new Tag("highway", "bar"));
    9292    }
     
    9696     */
    9797    @Test
    98     public void testDuplicateNodeOther() {
     98    void testDuplicateNodeOther() {
    9999        doTest(DuplicateNode.DUPLICATE_NODE_OTHER);
    100100    }
     
    104104     */
    105105    @Test
    106     public void testDuplicateNodeBuilding() {
     106    void testDuplicateNodeBuilding() {
    107107        doTest(DuplicateNode.DUPLICATE_NODE_BUILDING, new Tag("building", "foo"));
    108108    }
     
    112112     */
    113113    @Test
    114     public void testDuplicateNodeBoundary() {
     114    void testDuplicateNodeBoundary() {
    115115        doTest(DuplicateNode.DUPLICATE_NODE_BOUNDARY, new Tag("boundary", "foo"));
    116116    }
     
    120120     */
    121121    @Test
    122     public void testDuplicateNodeHighway() {
     122    void testDuplicateNodeHighway() {
    123123        doTest(DuplicateNode.DUPLICATE_NODE_HIGHWAY, new Tag("highway", "foo"));
    124124    }
     
    128128     */
    129129    @Test
    130     public void testDuplicateNodeLanduse() {
     130    void testDuplicateNodeLanduse() {
    131131        doTest(DuplicateNode.DUPLICATE_NODE_LANDUSE, new Tag("landuse", "foo"));
    132132    }
     
    136136     */
    137137    @Test
    138     public void testDuplicateNodeNatural() {
     138    void testDuplicateNodeNatural() {
    139139        doTest(DuplicateNode.DUPLICATE_NODE_NATURAL, new Tag("natural", "foo"));
    140140    }
     
    144144     */
    145145    @Test
    146     public void testDuplicateNodePower() {
     146    void testDuplicateNodePower() {
    147147        doTest(DuplicateNode.DUPLICATE_NODE_POWER, new Tag("power", "foo"));
    148148    }
     
    152152     */
    153153    @Test
    154     public void testDuplicateNodeRailway() {
     154    void testDuplicateNodeRailway() {
    155155        doTest(DuplicateNode.DUPLICATE_NODE_RAILWAY, new Tag("railway", "foo"));
    156156    }
     
    160160     */
    161161    @Test
    162     public void testDuplicateNodeWaterway() {
     162    void testDuplicateNodeWaterway() {
    163163        doTest(DuplicateNode.DUPLICATE_NODE_WATERWAY, new Tag("waterway", "foo"));
    164164    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateRelationTest.java

    r14817 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.data.coor.LatLon;
     
    2020 * JUnit Test of "Duplicate relation" validation test.
    2121 */
    22 public class DuplicateRelationTest {
     22class DuplicateRelationTest {
    2323
    2424    /**
    2525     * Setup test by initializing JOSM preferences and projection.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    7171     */
    7272    @Test
    73     public void testDuplicateRelationNoTags() {
     73    void testDuplicateRelationNoTags() {
    7474        doTest("", "",
    7575                new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true),
     
    8181     */
    8282    @Test
    83     public void testDuplicateRelationSameTags() {
     83    void testDuplicateRelationSameTags() {
    8484        doTest("type=boundary", "type=boundary",
    8585                new ExpectedResult(DuplicateRelation.DUPLICATE_RELATION, true),
     
    9191     */
    9292    @Test
    93     public void testDuplicateRelationDifferentTags() {
     93    void testDuplicateRelationDifferentTags() {
    9494        doTest("type=boundary", "type=multipolygon",
    9595                new ExpectedResult(DuplicateRelation.SAME_RELATION, false));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DuplicateWayTest.java

    r17222 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.nio.file.Files;
    99import java.nio.file.Paths;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.Command;
     
    2626 * JUnit Test of "Duplicate way" validation test.
    2727 */
    28 public class DuplicateWayTest {
     28class DuplicateWayTest {
    2929
    3030    /**
    3131     * Setup test by initializing JOSM preferences and projection.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    7676     */
    7777    @Test
    78     public void testDuplicateWayNoTags() {
     78    void testDuplicateWayNoTags() {
    7979        doTest(DuplicateWay.DUPLICATE_WAY);
    8080    }
     
    8484     */
    8585    @Test
    86     public void testDuplicateWaySameTags() {
     86    void testDuplicateWaySameTags() {
    8787        doTest(DuplicateWay.DUPLICATE_WAY, "highway=motorway");
    8888    }
     
    9292     */
    9393    @Test
    94     public void testDuplicateWayDifferentTags() {
     94    void testDuplicateWayDifferentTags() {
    9595        doTest(DuplicateWay.SAME_WAY, "highway=motorway", "highway=trunk", false);
    9696    }
     
    101101     */
    102102    @Test
    103     public void testFixError() throws Exception {
     103    void testFixError() throws Exception {
    104104        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "duplicate-ways.osm")), null);
    105105        TEST.startTest(NullProgressMonitor.INSTANCE);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/HighwaysTest.java

    r14779 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.io.InputStream;
    1010import java.util.Collection;
    1111
    12 import org.junit.Before;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.TestUtils;
     
    2424 * Unit test of {@link HighwaysTest}.
    2525 */
    26 public class HighwaysTest {
     26class HighwaysTest {
    2727
    2828    /**
    2929     * Setup test.
    3030     */
    31     @Before
     31    @BeforeEach
    3232    public void setUp() {
    3333        JOSMFixture.createUnitTestFixture().init();
     
    7777     */
    7878    @Test
    79     public void testCombinations() {
     79    void testCombinations() {
    8080        assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary_link")));
    8181        assertTrue(Highways.isHighwayLinkOkay(createTestSetting("primary", "primary")));
     
    9090     */
    9191    @Test
    92     public void testSourceMaxSpeedUnitedKingdom() {
     92    void testSourceMaxSpeedUnitedKingdom() {
    9393        Way link = createTestSetting("primary", "primary");
    9494        link.put("maxspeed", "60 mph");
     
    108108     */
    109109    @Test
    110     public void testTicket14891() throws Exception {
     110    void testTicket14891() throws Exception {
    111111        try (InputStream is = TestUtils.getRegressionDataStream(14891, "14891.osm.bz2")) {
    112112            Collection<Way> ways = OsmReader.parseDataSet(is, null).getWays();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/InternetTagsTest.java

    r14803 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88import static org.openstreetmap.josm.tools.I18n.tr;
    99
    1010import java.util.List;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.data.validation.TestError;
     
    2424 * JUnit Test of "Internet Tags" validation test.
    2525 */
    26 public class InternetTagsTest {
     26class InternetTagsTest {
    2727
    2828    private static final InternetTags TEST = new InternetTags();
     
    3131     * Setup test by initializing JOSM preferences and projection.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    3939     */
    4040    @Test
    41     public void testValidUrls() {
     41    void testValidUrls() {
    4242        testUrl("url", "www.domain.com", true);                                // No protocol
    4343        testUrl("url", "http://josm.openstreetmap.de", true);                  // Simple HTTP
     
    5757     */
    5858    @Test
    59     public void testMultipleUrls() {
     59    void testMultipleUrls() {
    6060        testUrl("url", "http://www.domain-a.com;https://www.domain-b.com", true); // multiple values
    6161    }
     
    6565     */
    6666    @Test
    67     public void testInvalidUrls() {
     67    void testInvalidUrls() {
    6868        testUrl("url", "something://www.domain.com", false);                   // invalid protocol
    6969        testUrl("url", "http://www.domain.invalidtld", false);                 // invalid TLD
     
    7474     */
    7575    @Test
    76     public void testValidEmails() {
     76    void testValidEmails() {
    7777        testEmail("email", "contact@www.domain.com", true);                    // Simple email
    7878        testEmail("contact:email", "john.doe@other-domain.org", true);         // Key with : + dash in domain
     
    8383     */
    8484    @Test
    85     public void testInvalidEmails() {
     85    void testInvalidEmails() {
    8686        testEmail("email", "contact at www.domain.com", false);                // No @
    8787        testEmail("contact:email", "john.doe@other-domain.invalidtld", false); // invalid TLD
     
    9292     */
    9393    @Test
    94     public void testInvalidSlashes() {
     94    void testInvalidSlashes() {
    9595        TestError error = testUrl("website", "http:\\\\www.sjoekurs.no", false).get(0);
    9696        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  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Before;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.BeforeEach;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.JOSMFixture;
    1010import org.openstreetmap.josm.data.osm.OsmUtils;
     
    1313 * Unit tests of {@link Lanes}.
    1414 */
    15 public class LanesTest {
     15class LanesTest {
    1616
    1717    private final Lanes lanes = new Lanes();
     
    2121     * @throws Exception if an error occurs
    2222     */
    23     @Before
     23    @BeforeEach
    2424    public void setUp() throws Exception {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testLanesCount() {
     34    void testLanesCount() {
    3535        assertEquals(0, Lanes.getLanesCount(""));
    3636        assertEquals(1, Lanes.getLanesCount("left"));
     
    4141
    4242    @Test
    43     public void test1() {
     43    void test1() {
    4444        lanes.check(OsmUtils.createPrimitive("way turn:lanes=left|right change:lanes=only_left|not_right|yes"));
    4545        assertEquals("Number of lane dependent values inconsistent", lanes.getErrors().get(0).getMessage());
     
    4747
    4848    @Test
    49     public void test2() {
     49    void test2() {
    5050        lanes.check(OsmUtils.createPrimitive("way width:lanes:forward=1|2|3 psv:lanes:forward=no|designated"));
    5151        assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage());
     
    5353
    5454    @Test
    55     public void test3() {
     55    void test3() {
    5656        lanes.check(OsmUtils.createPrimitive("way change:lanes:forward=yes|no turn:lanes:backward=left|right|left"));
    5757        assertTrue(lanes.getErrors().isEmpty());
     
    5959
    6060    @Test
    61     public void test4() {
     61    void test4() {
    6262        lanes.check(OsmUtils.createPrimitive("way turn:lanes:forward=left|right change:lanes:forward=yes|no|yes width:backward=1|2|3"));
    6363        assertEquals("Number of lane dependent values inconsistent in forward direction", lanes.getErrors().get(0).getMessage());
     
    6565
    6666    @Test
    67     public void test5() {
     67    void test5() {
    6868        lanes.check(OsmUtils.createPrimitive("way lanes:forward=5 turn:lanes:forward=left|right"));
    6969        assertEquals("Number of lanes:forward greater than *:lanes:forward", lanes.getErrors().get(0).getMessage());
     
    7171
    7272    @Test
    73     public void test6() {
     73    void test6() {
    7474        lanes.check(OsmUtils.createPrimitive("way lanes:forward=foo|bar turn:lanes:forward=foo+bar"));
    7575        assertTrue(lanes.getErrors().isEmpty());
     
    7777
    7878    @Test
    79     public void test7() {
     79    void test7() {
    8080        lanes.check(OsmUtils.createPrimitive("way lanes=3 lanes:forward=3 lanes:backward=7"));
    8181        assertEquals("Number of lanes:forward+lanes:backward greater than lanes", lanes.getErrors().get(0).getMessage());
     
    8383
    8484    @Test
    85     public void test8() {
     85    void test8() {
    8686        lanes.check(OsmUtils.createPrimitive(
    8787                "way destination:country:lanes=X|Y;Z|none destination:ref:lanes=xyz|| destination:sign:lanes=none|airport|none"));
     
    9090
    9191    @Test
    92     public void test9() {
     92    void test9() {
    9393        lanes.check(OsmUtils.createPrimitive("way highway=secondary lanes=2 source:lanes=survey"));
    9494        assertTrue(lanes.getErrors().isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/LongSegmentTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.data.coor.LatLon;
    99import org.openstreetmap.josm.data.osm.Node;
     
    1616 * JUnit Test of "Long Segment" validation test.
    1717 */
    18 public class LongSegmentTest {
     18class LongSegmentTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules();
     
    3939     */
    4040    @Test
    41     public void testLongSegment() throws Exception {
     41    void testLongSegment() throws Exception {
    4242        // Long way
    4343        Way w = new Way();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MapCSSTagCheckerTest.java

    r16360 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    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;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.io.InputStream;
     
    1616import java.util.Set;
    1717
    18 import org.junit.Before;
    19 import org.junit.Rule;
    20 import org.junit.Test;
     18import org.junit.jupiter.api.BeforeEach;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2121import org.openstreetmap.josm.TestUtils;
    2222import org.openstreetmap.josm.command.ChangePropertyCommand;
     
    5151 * JUnit Test of {@link MapCSSTagChecker}.
    5252 */
    53 public class MapCSSTagCheckerTest {
     53class MapCSSTagCheckerTest {
    5454
    5555    /**
    5656     * Setup test.
    5757     */
    58     @Rule
     58    @RegisterExtension
    5959    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6060    public JOSMTestRules test = new JOSMTestRules().projection().territories().preferences();
     
    6363     * Setup test.
    6464     */
    65     @Before
     65    @BeforeEach
    6666    public void setUp() {
    6767        MapCSSTagCheckerAsserts.clear();
     
    7272        Set<String> errors = new HashSet<>();
    7373        test.checks.putAll("test", TagCheck.readMapCSS(new StringReader(css), errors::add).parseChecks);
    74         assertTrue(errors.toString(), errors.isEmpty());
     74        assertTrue(errors.isEmpty(), errors::toString);
    7575        return test;
    7676    }
     
    8181     */
    8282    @Test
    83     public void testNaturalMarsh() throws ParseException {
     83    void testNaturalMarsh() throws ParseException {
    8484        ParseResult result = TagCheck.readMapCSS(new StringReader(
    8585                "*[natural=marsh] {\n" +
     
    122122     */
    123123    @Test
    124     public void testTicket10913() throws ParseException {
     124    void testTicket10913() throws ParseException {
    125125        final OsmPrimitive p = TestUtils.addFakeDataSet(TestUtils.newWay("highway=tertiary construction=yes"));
    126126        final TagCheck check = TagCheck.readMapCSS(new StringReader("way {" +
     
    141141     */
    142142    @Test
    143     public void testTicket9782() throws ParseException {
     143    void testTicket9782() throws ParseException {
    144144        final MapCSSTagChecker test = buildTagChecker("*[/.+_name/][!name] {" +
    145145                "throwWarning: tr(\"has {0} but not {1}\", \"{0.key}\", \"{1.key}\");}");
     
    156156     */
    157157    @Test
    158     public void testTicket10859() throws ParseException {
     158    void testTicket10859() throws ParseException {
    159159        final MapCSSTagChecker test = buildTagChecker("way[highway=footway][foot?!] {\n" +
    160160                "  throwWarning: tr(\"{0} used with {1}\", \"{0.value}\", \"{1.tag}\");}");
     
    171171     */
    172172    @Test
    173     public void testTicket13630() throws ParseException {
     173    void testTicket13630() throws ParseException {
    174174        ParseResult result = TagCheck.readMapCSS(new StringReader(
    175175                "node[crossing=zebra] {fixRemove: \"crossing=zebra\";}"));
     
    183183     */
    184184    @Test
    185     public void testPreprocessing() throws ParseException {
     185    void testPreprocessing() throws ParseException {
    186186        final MapCSSTagChecker test = buildTagChecker(
    187187                "@supports (min-josm-version: 0) { *[foo] { throwWarning: \"!\"; } }\n" +
     
    196196     */
    197197    @Test
    198     public void testInit() throws Exception {
     198    void testInit() throws Exception {
    199199        Logging.clearLastErrorAndWarnings();
    200200        MapCSSTagChecker c = new MapCSSTagChecker();
    201201        c.initialize();
    202202
    203         assertTrue("no warnings/errors are logged", Logging.getLastErrorAndWarnings().isEmpty());
     203        assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), "no warnings/errors are logged");
    204204
    205205        // to trigger MapCSSStyleIndex code
     
    214214     */
    215215    @Test
    216     public void testAssertions() throws Exception {
     216    void testAssertions() throws Exception {
    217217        MapCSSTagChecker c = new MapCSSTagChecker();
    218218        Set<String> assertionErrors = new LinkedHashSet<>();
     
    226226            Logging.error(msg);
    227227        }
    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");
    229229    }
    230230
     
    234234     */
    235235    @Test
    236     public void testAssertInsideCountry() throws ParseException {
     236    void testAssertInsideCountry() throws ParseException {
    237237        final MapCSSTagChecker test = buildTagChecker(
    238238                "node[amenity=parking][inside(\"BR\")] {\n" +
     
    249249     */
    250250    @Test
    251     public void testTicket17058() throws ParseException {
     251    void testTicket17058() throws ParseException {
    252252        final MapCSSTagChecker test = buildTagChecker(
    253253                "*[name =~ /(?i).*Straße.*/][inside(\"LI,CH\")] {\n" +
     
    264264     */
    265265    @Test
    266     public void testTicket13762() throws ParseException {
     266    void testTicket13762() throws ParseException {
    267267        final ParseResult parseResult = TagCheck.readMapCSS(new StringReader("" +
    268268                "meta[lang=de] {\n" +
     
    277277     */
    278278    @Test
    279     public void testTicket14287() throws Exception {
     279    void testTicket14287() throws Exception {
    280280        final MapCSSTagChecker test = buildTagChecker(
    281281                "node[amenity=parking] ∈ *[amenity=parking] {" +
     
    293293     */
    294294    @Test
    295     public void testTicket17053() throws ParseException {
     295    void testTicket17053() throws ParseException {
    296296        final MapCSSTagChecker test = buildTagChecker(
    297297                "way[highway=cycleway][cycleway=track] {\n" +
     
    336336     */
    337337    @Test
    338     public void testTicket12627() throws Exception {
     338    void testTicket12627() throws Exception {
    339339        doTestNaturalWood(12627, "overlapping.osm", 1, 1);
    340340    }
     
    345345     */
    346346    @Test
    347     public void testTicket14289() throws Exception {
     347    void testTicket14289() throws Exception {
    348348        doTestNaturalWood(14289, "example2.osm", 3, 3);
    349349    }
     
    354354     */
    355355    @Test
    356     public void testTicket15641() throws ParseException {
     356    void testTicket15641() throws ParseException {
    357357        assertNotNull(buildTagChecker(
    358358                "relation[type=public_transport][public_transport=stop_area_group] > way {" +
     
    366366     */
    367367    @Test
    368     public void testTicket17358() throws ParseException {
     368    void testTicket17358() throws ParseException {
    369369        final Collection<TestError> errors = buildTagChecker(
    370370                "*[/^name/=~/Test/]{" +
     
    379379     */
    380380    @Test
    381     public void testTicket17695() throws Exception {
     381    void testTicket17695() throws Exception {
    382382        final MapCSSTagChecker test = buildTagChecker(
    383383                "*[building] ∈  *[building] {" +
     
    396396     */
    397397    @Test
    398     public void testTicket13165() throws Exception {
     398    void testTicket13165() throws Exception {
    399399        final MapCSSTagChecker test = buildTagChecker(
    400400                "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {"
     
    413413     */
    414414    @Test
    415     public void testTicket13165IncompleteMP() throws Exception {
     415    void testTicket13165IncompleteMP() throws Exception {
    416416        final MapCSSTagChecker test = buildTagChecker(
    417417                "area:closed[tag(\"landuse\") = parent_tag(\"landuse\")] ⧉ area:closed[landuse] {"
     
    431431     */
    432432    @Test
    433     public void testTicket19053() throws ParseException {
     433    void testTicket19053() throws ParseException {
    434434        final MapCSSTagChecker test = buildTagChecker(
    435435                "*[ele][ele =~ /^-?[0-9]+\\.[0-9][0-9][0-9]+$/] {"
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/MultipolygonTestTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.InputStream;
    88import java.util.stream.Collectors;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.TestUtils;
    1313import org.openstreetmap.josm.data.osm.Relation;
     
    2020 * JUnit Test of Multipolygon validation test.
    2121 */
    22 public class MultipolygonTestTest {
     22class MultipolygonTestTest {
    2323
    2424
     
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main().preferences();
     
    3535     */
    3636    @Test
    37     public void testMultipolygonFile() throws Exception {
     37    void testMultipolygonFile() throws Exception {
    3838        final MultipolygonTest MULTIPOLYGON_TEST = new MultipolygonTest();
    3939        final RelationChecker RELATION_TEST = new RelationChecker();
     
    4848     */
    4949    @Test
    50     public void testTicket17768TouchingInner() throws Exception {
     50    void testTicket17768TouchingInner() throws Exception {
    5151        try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner.osm")) {
    5252            MultipolygonTest mpTest = new MultipolygonTest();
     
    6262     */
    6363    @Test
    64     public void testTicket17768TouchingInnerOuter() throws Exception {
     64    void testTicket17768TouchingInnerOuter() throws Exception {
    6565        try (InputStream is = TestUtils.getRegressionDataStream(17768, "touching-inner-outer.osm")) {
    6666            MultipolygonTest mpTest = new MultipolygonTest();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/NameMismatchTest.java

    r11131 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.List;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.osm.OsmUtils;
    1111import org.openstreetmap.josm.data.validation.TestError;
     
    1717 * JUnit Test of "Name mismatch" validation test.
    1818 */
    19 public class NameMismatchTest {
     19class NameMismatchTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testCase0() {
     38    void testCase0() {
    3939        final List<TestError> errors = test("node name:de=Europa");
    4040        assertEquals(1, errors.size());
     
    4646     */
    4747    @Test
    48     public void testCase1() {
     48    void testCase1() {
    4949        final List<TestError> errors = test("node name=Europe name:de=Europa");
    5050        assertEquals(1, errors.size());
     
    5656     */
    5757    @Test
    58     public void testCase2() {
     58    void testCase2() {
    5959        final List<TestError> errors = test("node name=Europe name:de=Europa name:en=Europe");
    6060        assertEquals(0, errors.size());
     
    6565     */
    6666    @Test
    67     public void testCase3() {
     67    void testCase3() {
    6868        List<TestError> errors;
    6969        errors = test("node \"name\"=\"Italia - Italien - Italy\"");
     
    8282     */
    8383    @Test
    84     public void testEtymologyWikidata() {
     84    void testEtymologyWikidata() {
    8585        final List<TestError> errors = test("node name=Foo name:etymology:wikidata=Bar");
    8686        assertEquals(0, errors.size());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/OpeningHourTestTest.java

    r17085 r17275  
    66import static org.hamcrest.CoreMatchers.not;
    77import 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;
     8import static org.junit.jupiter.api.Assertions.assertEquals;
     9import static org.junit.jupiter.api.Assertions.assertNotNull;
     10import static org.junit.jupiter.api.Assertions.assertTrue;
    1111
    1212import java.util.Arrays;
     
    1717import java.util.Set;
    1818
    19 import org.junit.Before;
    20 import org.junit.Rule;
    21 import org.junit.Test;
     19import org.junit.jupiter.api.BeforeEach;
     20import org.junit.jupiter.api.Test;
     21import org.junit.jupiter.api.extension.RegisterExtension;
    2222import org.openstreetmap.josm.command.ChangePropertyCommand;
    2323import org.openstreetmap.josm.data.coor.LatLon;
     
    4141 * @see OpeningHourTest
    4242 */
    43 public class OpeningHourTestTest {
     43class OpeningHourTestTest {
    4444    /**
    4545     * We need preferences for this. We check strings so we need i18n.
    4646     */
    47     @Rule
     47    @RegisterExtension
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4949    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    5555     * @throws Exception if test cannot be initialized
    5656     */
    57     @Before
     57    @BeforeEach
    5858    public void setUp() throws Exception {
    5959        openingHourTest = new OpeningHourTest();
     
    6666     */
    6767    @Test
    68     public void testCheckOpeningHourSyntax1() {
     68    void testCheckOpeningHourSyntax1() {
    6969        final String key = "opening_hours";
    7070        // frequently used tags according to https://taginfo.openstreetmap.org/keys/opening_hours#values
     
    8282     */
    8383    @Test
    84     public void testI18n() {
     84    void testI18n() {
    8585        final String key = "opening_hours";
    8686        String value = ".";
     
    100100     */
    101101    @Test
    102     public void testCheckOpeningHourSyntax2() {
     102    void testCheckOpeningHourSyntax2() {
    103103        final String key = "opening_hours";
    104104        final List<TestError> errors = checkOpeningHourSyntax(key, "Mo-Tue");
     
    113113     */
    114114    @Test
    115     public void testCheckOpeningHourSyntax3() {
     115    void testCheckOpeningHourSyntax3() {
    116116        final String key = "opening_hours";
    117117        final List<TestError> errors = checkOpeningHourSyntax(key, "Sa-Su 10.00-20.00");
     
    126126     */
    127127    @Test
    128     public void testCheckOpeningHourSyntax4() {
     128    void testCheckOpeningHourSyntax4() {
    129129        assertThat(checkOpeningHourSyntax(null, null), isEmpty());
    130130        assertThat(checkOpeningHourSyntax(null, ""), isEmpty());
     
    139139     */
    140140    @Test
    141     public void testCheckOpeningHourSyntax5() {
     141    void testCheckOpeningHourSyntax5() {
    142142        final String key = "opening_hours";
    143143        assertThat(checkOpeningHourSyntax(key, "badtext"), hasSize(1));
     
    153153     */
    154154    @Test
    155     public void testCheckOpeningHourSyntax6() {
     155    void testCheckOpeningHourSyntax6() {
    156156        final String key = "opening_hours";
    157157        assertThat(checkOpeningHourSyntax(key, "PH open \"always open on public holidays\""), isEmpty());
     
    162162     */
    163163    @Test
    164     public void testCheckOpeningHourSyntax7() {
     164    void testCheckOpeningHourSyntax7() {
    165165        final String key = "opening_hours";
    166166        assertThat(checkOpeningHourSyntax(key, "9:00-18:00"), hasSize(1));
     
    173173     */
    174174    @Test
    175     public void testCheckOpeningHourSyntaxTicket9367() {
     175    void testCheckOpeningHourSyntaxTicket9367() {
    176176        final String key = "opening_hours";
    177177        assertEquals(Severity.WARNING, checkOpeningHourSyntax(key, "Mo,Tu 04-17").get(0).getSeverity());
     
    184184     */
    185185    @Test
    186     public void testCheckServiceTimeSyntax1() {
     186    void testCheckServiceTimeSyntax1() {
    187187        final String key = "service_times";
    188188        // frequently used tags according to https://taginfo.openstreetmap.org/keys/service_times#values
     
    203203     */
    204204    @Test
    205     public void testCheckCollectionTimeSyntax1() {
     205    void testCheckCollectionTimeSyntax1() {
    206206        final String key = "collection_times";
    207207        // frequently used tags according to https://taginfo.openstreetmap.org/keys/collection_times#values
     
    221221     */
    222222    @Test
    223     public void testPresetValues() {
     223    void testPresetValues() {
    224224        final Collection<TaggingPreset> presets = TaggingPresetReader.readFromPreferences(false, false);
    225225        final Set<Tag> values = new LinkedHashSet<>();
     
    247247     */
    248248    @Test
    249     public void testTicket17932() {
     249    void testTicket17932() {
    250250        Logging.clearLastErrorAndWarnings();
    251251        assertTrue(checkOpeningHourSyntax("opening_hours", "SH off").isEmpty());
     
    261261
    262262    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");
    265265        final ChangePropertyCommand command = (ChangePropertyCommand) error.getFix();
    266266        assertEquals(1, command.getTags().size());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/PublicTransportRouteTestTest.java

    r13411 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77import java.util.List;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212import org.openstreetmap.josm.data.osm.Node;
     
    2121 * JUnit Test of "Public Transport Route" validation test.
    2222 */
    23 public class PublicTransportRouteTestTest {
     23class PublicTransportRouteTestTest {
    2424
    2525    final PublicTransportRouteTest test = new PublicTransportRouteTest();
     
    2828     * Setup test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules rules = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testVarious() {
     38    void testVarious() {
    3939        final List<Node> nodes = Arrays.asList(new Node(), new Node(), new Node(), new Node(), new Node(), new Node());
    4040        final Way w1 = TestUtils.newWay("", nodes.get(0), nodes.get(1));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/RelationCheckerTest.java

    r16703 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66import static org.openstreetmap.josm.data.osm.OsmUtils.createPrimitive;
    77
    88import java.util.List;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.data.osm.Node;
    1313import org.openstreetmap.josm.data.osm.OsmUtils;
     
    2323 * Unit tests of {@link RelationChecker} class.
    2424 */
    25 public class RelationCheckerTest {
     25class RelationCheckerTest {
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules rule = new JOSMTestRules().presets();
     
    4848
    4949    @Test
    50     public void testUnknownType() {
     50    void testUnknownType() {
    5151        Relation r = createRelation("type=foobar");
    5252        r.addMember(new RelationMember("", new Way()));
     
    5858
    5959    @Test
    60     public void testEmpty() {
     60    void testEmpty() {
    6161        List<TestError> errors = testRelation(createRelation("type=multipolygon"));
    6262        assertEquals(1, errors.size());
     
    6565
    6666    @Test
    67     public void testNormal() {
     67    void testNormal() {
    6868        Relation r = createRelation("type=multipolygon");
    6969        r.addMember(new RelationMember("outer", new Way()));
     
    7373
    7474    @Test
    75     public void testOuter2() {
     75    void testOuter2() {
    7676        Relation r = createRelation("type=multipolygon");
    7777        r.addMember(new RelationMember("outer", new Way()));
     
    8484
    8585    @Test
    86     public void testRestrictionViaMissing() {
     86    void testRestrictionViaMissing() {
    8787        Relation r = createRelation("type=restriction");
    8888        r.addMember(new RelationMember("from", new Way()));
     
    9595
    9696    @Test
    97     public void testRestrictionViaRelation() {
     97    void testRestrictionViaRelation() {
    9898        Relation r = createRelation("type=restriction");
    9999        r.addMember(new RelationMember("from", new Way()));
     
    108108
    109109    @Test
    110     public void testRestrictionTwoFrom() {
     110    void testRestrictionTwoFrom() {
    111111        Relation r = createRelation("type=restriction");
    112112        r.addMember(new RelationMember("from", new Way()));
     
    121121
    122122    @Test
    123     public void testRestrictionEmpty() {
     123    void testRestrictionEmpty() {
    124124        Relation r = createRelation("type=restriction");
    125125        r.addMember(new RelationMember("from", new Way()));
     
    134134
    135135    @Test
    136     public void testPowerMemberExpression() {
     136    void testPowerMemberExpression() {
    137137        Relation r = createRelation("type=route route=power");
    138138        r.addMember(new RelationMember("", new Way()));
     
    145145
    146146    @Test
    147     public void testBuildingMemberExpression() {
     147    void testBuildingMemberExpression() {
    148148        Relation r = createRelation("type=building");
    149149        r.addMember(new RelationMember("outline", new Way()));
     
    161161
    162162    @Test
    163     public void testHikingRouteMembers() {
     163    void testHikingRouteMembers() {
    164164        Relation r = createRelation("type=route route=hiking");
    165165        r.addMember(new RelationMember("", OsmUtils.createPrimitive("way highway=path")));
     
    176176
    177177    @Test
    178     public void testRouteMemberExpression() {
     178    void testRouteMemberExpression() {
    179179        Relation r = createRelation("type=route route=tram public_transport:version=2");
    180180        r.addMember(new RelationMember("", createPrimitive("way railway=tram")));
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java

    r16445 r17275  
    88
    99import org.junit.Assert;
    10 import org.junit.BeforeClass;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeAll;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.JOSMFixture;
    1313import org.openstreetmap.josm.data.coor.LatLon;
     
    1919 * JUnit Test of Multipolygon validation test.
    2020 */
    21 public class SelfIntersectingWayTest {
     21class SelfIntersectingWayTest {
    2222
    2323    /**
     
    2525     * @throws Exception if test cannot be initialized
    2626     */
    27     @BeforeClass
     27    @BeforeAll
    2828    public static void setUp() throws Exception {
    2929        JOSMFixture.createUnitTestFixture().init();
     
    4545     */
    4646    @Test
    47     public void testUnclosedWayNormal() {
     47    void testUnclosedWayNormal() {
    4848        List<Node> nodes = createNodes();
    4949
     
    6868     */
    6969    @Test
    70     public void testUnclosedWayFirst() {
     70    void testUnclosedWayFirst() {
    7171        List<Node> nodes = createNodes();
    7272
     
    9090     */
    9191    @Test
    92     public void testUnclosedWayFirstRepeated() {
     92    void testUnclosedWayFirstRepeated() {
    9393        List<Node> nodes = createNodes();
    9494
     
    112112     */
    113113    @Test
    114     public void testUnclosedWayLast() {
     114    void testUnclosedWayLast() {
    115115        List<Node> nodes = createNodes();
    116116
     
    134134     */
    135135    @Test
    136     public void testClosedWay() {
     136    void testClosedWay() {
    137137        List<Node> nodes = createNodes();
    138138
     
    158158     */
    159159    @Test
    160     public void testSpikeWithStartInClosedWay() {
     160    void testSpikeWithStartInClosedWay() {
    161161        List<Node> nodes = createNodes();
    162162
     
    181181     */
    182182    @Test
    183     public void testSpikeWithEndInClosedWay() {
     183    void testSpikeWithEndInClosedWay() {
    184184        List<Node> nodes = createNodes();
    185185
     
    204204     */
    205205    @Test
    206     public void testSpikeInClosedWay() {
     206    void testSpikeInClosedWay() {
    207207        List<Node> nodes = createNodes();
    208208
     
    227227     */
    228228    @Test
    229     public void testClosedWayBarbell() {
     229    void testClosedWayBarbell() {
    230230        List<Node> nodes = createNodes();
    231231
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SharpAnglesTest.java

    r15412 r17275  
    33
    44import org.junit.Assert;
    5 import org.junit.Before;
    6 import org.junit.Test;
     5import org.junit.jupiter.api.BeforeEach;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.JOSMFixture;
    88import org.openstreetmap.josm.TestUtils;
     
    1414 * JUnit Test of the Sharp Angles validation test.
    1515 */
    16 
    17 public class SharpAnglesTest {
     16class SharpAnglesTest {
    1817    private SharpAngles angles;
    1918
     
    2221     * @throws Exception if an error occurs
    2322     */
    24     @Before
     23    @BeforeEach
    2524    public void setUp() throws Exception {
    2625        JOSMFixture.createUnitTestFixture().init();
     
    3332     */
    3433    @Test
    35     public void testClosedLoopNoSharpAngles() {
     34    void testClosedLoopNoSharpAngles() {
    3635        Way way = TestUtils.newWay("highway=residential",
    3736                new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)),
     
    4645     */
    4746    @Test
    48     public void testClosedLoopSharpAngles() {
     47    void testClosedLoopSharpAngles() {
    4948        Way way = TestUtils.newWay("highway=residential",
    5049                new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)),
     
    6059     */
    6160    @Test
    62     public void testMultipleSharpAngles() {
     61    void testMultipleSharpAngles() {
    6362        Way way = TestUtils.newWay("highway=residential",
    6463                new Node(new LatLon(0.005069377713748322, -0.0014832642674429382)),
     
    7574     */
    7675    @Test
    77     public void testNoSharpAngles() {
     76    void testNoSharpAngles() {
    7877        Way way = TestUtils.newWay("highway=residential",
    7978                new Node(new LatLon(0, 0)), new Node(new LatLon(0.1, 0.1)),
     
    8887     */
    8988    @Test
    90     public void testCheckBadAnglesFromSameNodeTwice() {
     89    void testCheckBadAnglesFromSameNodeTwice() {
    9190        Way way = TestUtils.newWay("highway=service oneway=yes",
    9291                new Node(new LatLon(52.8903308, 8.4302322)),
     
    106105     */
    107106    @Test
    108     public void testIgnoredCases() {
     107    void testIgnoredCases() {
    109108        Way way = TestUtils.newWay("highway=residential",
    110109                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  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
    66
    7 import org.junit.Before;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.BeforeEach;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.JOSMFixture;
    1010
     
    1212 * Unit test of {@link SimilarNamedWays}
    1313 */
    14 public class SimilarNamedWaysTest {
     14class SimilarNamedWaysTest {
    1515
    1616    private final SimilarNamedWays test = new SimilarNamedWays();
     
    1919     * Setup test
    2020     */
    21     @Before
     21    @BeforeEach
    2222    public void setUp() {
    2323        JOSMFixture.createUnitTestFixture().init();
     
    2626    private void checkSimilarity(String message, String name1, String name2, boolean expected) {
    2727        boolean actual = test.similaryName(name1, name2);
    28         assertEquals(message, expected, actual);
     28        assertEquals(expected, actual, message);
    2929    }
    3030
     
    3333     */
    3434    @Test
    35     public void testSimilarNames() {
     35    void testSimilarNames() {
    3636        checkSimilarity("same string", "Testname", "Testname", false);
    3737        checkSimilarity("different case", "Testname", "TestName", true);
     
    8181      */
    8282     @Test
    83      public void testSimilarNamesRegression() {
     83     void testSimilarNamesRegression() {
    8484         assertFalse(test.similaryName("Unnecessary Name", "Third"));
    8585     }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TagCheckerTest.java

    r16788 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.IOException;
     
    1212
    1313import org.junit.Assert;
    14 import org.junit.Ignore;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.Disabled;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2828 * JUnit Test of {@link TagChecker}.
    2929 */
    30 public class TagCheckerTest {
     30class TagCheckerTest {
    3131
    3232    /**
    3333     * Setup test.
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules rule = new JOSMTestRules().presets();
     
    5555     */
    5656    @Test
    57     public void testMisspelledKey1() throws IOException {
     57    void testMisspelledKey1() throws IOException {
    5858        final List<TestError> errors = test(OsmUtils.createPrimitive("node Name=Main"));
    5959        assertEquals(1, errors.size());
     
    6868     */
    6969    @Test
    70     public void testMisspelledKey2() throws IOException {
     70    void testMisspelledKey2() throws IOException {
    7171        final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse;=forest"));
    7272        assertEquals(1, errors.size());
     
    8181     */
    8282    @Test
    83     public void testMisspelledKeyButAlternativeInUse() throws IOException {
     83    void testMisspelledKeyButAlternativeInUse() throws IOException {
    8484        // ticket 12329
    8585        final List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=fuel brand=bah Brand=foo"));
     
    9797     */
    9898    @Test
    99     public void testUpperCaseIgnoredKey() throws IOException {
     99    void testUpperCaseIgnoredKey() throws IOException {
    100100        // ticket 17468
    101101        final List<TestError> errors = test(OsmUtils.createPrimitive("node wheelchair:Description=bla"));
     
    113113     */
    114114    @Test
    115     public void testUpperCaseInKeyIgnoredTag() throws IOException {
     115    void testUpperCaseInKeyIgnoredTag() throws IOException {
    116116        // ticket 17468
    117117        final List<TestError> errors = test(OsmUtils.createPrimitive("node land_Area=administrative"));
     
    128128     */
    129129    @Test
    130     public void testTranslatedNameKey() throws IOException {
     130    void testTranslatedNameKey() throws IOException {
    131131        final List<TestError> errors = test(OsmUtils.createPrimitive("node namez=Baz"));
    132132        assertEquals(1, errors.size());
     
    142142     */
    143143    @Test
    144     public void testMisspelledTag() throws IOException {
     144    void testMisspelledTag() throws IOException {
    145145        final List<TestError> errors = test(OsmUtils.createPrimitive("node landuse=forrest"));
    146146        assertEquals(1, errors.size());
     
    156156     */
    157157    @Test
    158     public void testMisspelledTag2() throws IOException {
     158    void testMisspelledTag2() throws IOException {
    159159        final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=servics"));
    160160        assertEquals(1, errors.size());
     
    172172     */
    173173    @Test
    174     public void testMisspelledTag3() throws IOException {
     174    void testMisspelledTag3() throws IOException {
    175175        final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=residentail"));
    176176        assertEquals(1, errors.size());
     
    187187     */
    188188    @Test
    189     public void testShortValNotInPreset2() throws IOException {
     189    void testShortValNotInPreset2() throws IOException {
    190190        final List<TestError> errors = test(OsmUtils.createPrimitive("node shop=abs"));
    191191        assertEquals(1, errors.size());
     
    201201     */
    202202    @Test
    203     public void testIgnoredTagsNotInPresets() throws IOException {
     203    void testIgnoredTagsNotInPresets() throws IOException {
    204204        new TagChecker().initialize();
    205205        List<String> errors = TagChecker.getIgnoredTags().stream()
     
    207207                .map(Tag::toString)
    208208                .collect(Collectors.toList());
    209         assertTrue(errors.toString(), errors.isEmpty());
     209        assertTrue(errors.isEmpty(), errors::toString);
    210210    }
    211211
     
    215215     */
    216216    @Test
    217     public void testTooShortToFix() throws IOException {
     217    void testTooShortToFix() throws IOException {
    218218        final List<TestError> errors = test(OsmUtils.createPrimitive("node surface=u"));
    219219        assertEquals(1, errors.size());
     
    229229     */
    230230    @Test
    231     public void testValueDifferentCase() throws IOException {
     231    void testValueDifferentCase() throws IOException {
    232232        final List<TestError> errors = test(OsmUtils.createPrimitive("node highway=Residential"));
    233233        assertEquals(1, errors.size());
     
    244244     */
    245245    @Test
    246     public void testRegression17246() throws IOException {
     246    void testRegression17246() throws IOException {
    247247        final List<TestError> errors = test(OsmUtils.createPrimitive("node access=privat"));
    248248        assertEquals(1, errors.size());
     
    274274     */
    275275    @Test
    276     public void testContainsRemoveUnwantedNonprintingControlCharacters() {
     276    void testContainsRemoveUnwantedNonprintingControlCharacters() {
    277277        // Check empty string is handled
    278278        doTestUnwantedNonprintingControlCharacters("", Assert::assertFalse, "");
     
    311311     */
    312312    @Test
    313     public void testTicket17667() {
     313    void testTicket17667() {
    314314        assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Bus 118: Berlin, Rathaus Zehlendorf => Potsdam, Drewitz Stern-Center"));
    315315        assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Καρδίτσα → Λάρισα"));
     
    324324     */
    325325    @Test
    326     public void testTicket18322() {
     326    void testTicket18322() {
    327327        assertTrue(TagChecker.containsUnusualUnicodeCharacter("name", "D36ᴬ"));
    328328        assertFalse(TagChecker.containsUnusualUnicodeCharacter("ref", "D36ᴬ"));
     
    337337     */
    338338    @Test
    339     public void testTicket18449() {
     339    void testTicket18449() {
    340340        assertFalse(TagChecker.containsUnusualUnicodeCharacter("name", "Hökumət Evi"));
    341341    }
     
    345345     */
    346346    @Test
    347     public void testTicket18740() {
     347    void testTicket18740() {
    348348        assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:ak", "Frɛnkyeman"));
    349349        assertFalse(TagChecker.containsUnusualUnicodeCharacter("name:bm", "Esipaɲi"));
     
    356356     */
    357357    @Test
    358     public void testObjectTypeNotSupportedByPreset() throws IOException {
     358    void testObjectTypeNotSupportedByPreset() throws IOException {
    359359        List<TestError> errors = test(OsmUtils.createPrimitive("relation waterway=river"));
    360360        assertEquals(1, errors.size());
    361361        assertEquals(TagChecker.INVALID_PRESETS_TYPE, errors.get(0).getCode());
    362362        errors = test(OsmUtils.createPrimitive("relation type=waterway waterway=river"));
    363         assertTrue(errors.toString(), errors.isEmpty());
     363        assertTrue(errors.isEmpty(), errors::toString);
    364364    }
    365365
    366366    /**
    367367     * 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 {
    372373        List<TestError> errors = test(OsmUtils.createPrimitive("node amenity=restaurant cuisine=bavarian;beef_bowl"));
    373374        assertEquals(0, errors.size());
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/TurnRestrictionTestTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.testutils.JOSMTestRules;
    77
     
    1111 * JUnit Test of turn restriction validation test.
    1212 */
    13 public class TurnRestrictionTestTest {
     13class TurnRestrictionTestTest {
    1414
    1515    private static final TurnrestrictionTest TURNRESTRICTION_TEST = new TurnrestrictionTest();
     
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets().main();
     
    2828     */
    2929    @Test
    30     public void testTurnrestrictionFile() throws Exception {
     30    void testTurnrestrictionFile() throws Exception {
    3131        ValidatorTestUtils.testSampleFile("nodist/data/restriction.osm",
    3232                ds -> ds.getRelations(),
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnclosedWaysTest.java

    r16377 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.ArrayList;
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.osm.DataSet;
     
    2626 * JUnit Test of unclosed ways validation test.
    2727 */
    28 public class UnclosedWaysTest {
     28class UnclosedWaysTest {
    2929
    3030    /**
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules().projection().mapStyles().presets();
     
    5252     */
    5353    @Test
    54     public void testTicket10469() throws Exception {
     54    void testTicket10469() throws Exception {
    5555        UnclosedWays uwTest = new UnclosedWays();
    5656        uwTest.initialize();
     
    8484     */
    8585    @Test
    86     public void testWayInMultiPolygon() throws Exception {
     86    void testWayInMultiPolygon() throws Exception {
    8787        UnclosedWays uwTest = new UnclosedWays();
    8888        uwTest.initialize();
     
    108108     */
    109109    @Test
    110     public void testWayInBoundary() throws Exception {
     110    void testWayInBoundary() throws Exception {
    111111        UnclosedWays uwTest = new UnclosedWays();
    112112        uwTest.initialize();
     
    132132     */
    133133    @Test
    134     public void testAmenity() throws Exception {
     134    void testAmenity() throws Exception {
    135135        UnclosedWays uwTest = new UnclosedWays();
    136136        uwTest.initialize();
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java

    r16802 r17275  
    1212import java.nio.file.Paths;
    1313
    14 import org.junit.Before;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.JOSMFixture;
    1717import org.openstreetmap.josm.TestUtils;
     
    2626 * Unit tests of {@code UnconnectedWays} class.
    2727 */
    28 public class UnconnectedWaysTest {
     28class UnconnectedWaysTest {
    2929
    3030    private UnconnectedWays bib;
     
    3434     * @throws Exception if the test cannot be initialized
    3535     */
    36     @Before
     36    @BeforeEach
    3737    public void setUp() throws Exception {
    3838        bib = new UnconnectedWays.UnconnectedHighways();
     
    4848     */
    4949    @Test
    50     public void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {
     50    void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {
    5151        try (InputStream fis = Files.newInputStream(Paths.get("nodist/data/UnconnectedWaysTest.osm"))) {
    5252            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
     
    6767     */
    6868    @Test
    69     public void testTicket18051() throws IOException, IllegalDataException, FileNotFoundException {
     69    void testTicket18051() throws IOException, IllegalDataException, FileNotFoundException {
    7070        try (InputStream fis = TestUtils.getRegressionDataStream(18051, "modified-ways.osm.bz2")) {
    7171            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
     
    8787     */
    8888    @Test
    89     public void testTicket18106() throws IOException, IllegalDataException, FileNotFoundException {
     89    void testTicket18106() throws IOException, IllegalDataException, FileNotFoundException {
    9090        try (InputStream fis = TestUtils.getRegressionDataStream(18106, "uncon3.osm")) {
    9191            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
     
    107107     */
    108108    @Test
    109     public void testTicket18137() throws IOException, IllegalDataException, FileNotFoundException {
     109    void testTicket18137() throws IOException, IllegalDataException, FileNotFoundException {
    110110        try (InputStream fis = TestUtils.getRegressionDataStream(18137, "18137_npe.osm")) {
    111111            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
     
    127127     */
    128128    @Test
    129     public void testTicket19568() throws IOException, IllegalDataException, FileNotFoundException {
     129    void testTicket19568() throws IOException, IllegalDataException, FileNotFoundException {
    130130        try (InputStream fis = TestUtils.getRegressionDataStream(19568, "data.osm")) {
    131131            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UntaggedNodeTest.java

    r16618 r17275  
    88import java.io.InputStream;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.TestUtils;
    1313import org.openstreetmap.josm.data.osm.DataSet;
     
    2121 * Unit tests of {@code UntaggedNode} class.
    2222 */
    23 public class UntaggedNodeTest {
     23class UntaggedNodeTest {
    2424
    2525    private final UntaggedNode test = new UntaggedNode();
     
    2828     * Setup test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules rules = new JOSMTestRules();
     
    3737     */
    3838    @Test
    39     public void testTicket12436() throws Exception {
     39    void testTicket12436() throws Exception {
    4040        test.initialize();
    4141        test.startTest(null);
     
    5353     */
    5454    @Test
    55     public void testTicket12464() throws Exception {
     55    void testTicket12464() throws Exception {
    5656        test.initialize();
    5757        test.startTest(null);
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/ValidatorTestUtils.java

    r16643 r17275  
    22package org.openstreetmap.josm.data.validation.tests;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.InputStream;
     
    2727 * Utilities for validator unit tests.
    2828 */
    29 public final class ValidatorTestUtils {
     29final class ValidatorTestUtils {
    3030
    3131    private ValidatorTestUtils() {
     
    5858                    for (TestError error : errors) {
    5959                        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());
    6262                        actualCodes.add(code);
    6363                    }
    64                     assertEquals(name + " " + expectedCodes + " => " + actualCodes,
    65                             expectedCodes.size(), actualCodes.size());
     64                    assertEquals(expectedCodes.size(), actualCodes.size(),
     65                            name + " " + expectedCodes + " => " + actualCodes);
    6666                } else if (t.hasKey("name") && namePredicate != null && namePredicate.test(t.getName())) {
    6767                    fail(name + " lacks josm_error_codes tag");
  • trunk/test/unit/org/openstreetmap/josm/data/validation/util/EntitiesTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.data.validation.util;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.testutils.JOSMTestRules;
    77
     
    1212 * Unit tests for class {@link Entities}.
    1313 */
    14 public class EntitiesTest {
     14class EntitiesTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testUtilityClass() throws ReflectiveOperationException {
     28    void testUtilityClass() throws ReflectiveOperationException {
    2929        UtilityClassTestUtil.assertUtilityClassWellDefined(Entities.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/data/validation/util/MultipleNameVisitorTest.java

    r16951 r17275  
    22package org.openstreetmap.josm.data.validation.util;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.TestUtils;
    1111import org.openstreetmap.josm.data.osm.Way;
     
    1717 * Unit tests for class {@link MultipleNameVisitor}.
    1818 */
    19 public class MultipleNameVisitorTest {
     19class MultipleNameVisitorTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3030     */
    3131    @Test
    32     public void testTicket11967() {
     32    void testTicket11967() {
    3333        MultipleNameVisitor visitor = new MultipleNameVisitor();
    3434        visitor.visit(Arrays.asList(new Way(), new Way()));
     
    4040     */
    4141    @Test
    42     public void testTicket16652() {
     42    void testTicket16652() {
    4343        MultipleNameVisitor visitor = new MultipleNameVisitor();
    4444        visitor.visit(Arrays.asList(
  • trunk/test/unit/org/openstreetmap/josm/data/validation/util/ValUtilTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.data.validation.util;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.testutils.JOSMTestRules;
    77
     
    1212 * Unit tests for class {@link ValUtil}.
    1313 */
    14 public class ValUtilTest {
     14class ValUtilTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testUtilityClass() throws ReflectiveOperationException {
     28    void testUtilityClass() throws ReflectiveOperationException {
    2929        UtilityClassTestUtil.assertUtilityClassWellDefined(ValUtil.class);
    3030    }
Note: See TracChangeset for help on using the changeset viewer.