Changeset 17275 in josm for trunk/test/unit


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
Files:
538 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/CustomMatchers.java

    r16634 r17275  
    1212import org.hamcrest.Matcher;
    1313import org.hamcrest.TypeSafeMatcher;
    14 import org.junit.Ignore;
     14import org.junit.jupiter.api.Disabled;
    1515import org.openstreetmap.josm.data.Bounds;
    1616import org.openstreetmap.josm.data.coor.EastNorth;
     
    2020 * Custom matchers for unit tests.
    2121 */
    22 @Ignore("no test")
     22@Disabled("no test")
    2323public final class CustomMatchers {
    2424
  • trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java

    r15233 r17275  
    22package org.openstreetmap.josm;
    33
    4 import static org.junit.Assert.assertNull;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.io.File;
  • trunk/test/unit/org/openstreetmap/josm/TestUtils.java

    r17198 r17275  
    22package org.openstreetmap.josm;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertTrue;
    7 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
     8import static org.junit.jupiter.api.Assumptions.assumeFalse;
    89
    910import java.awt.Component;
     
    3435import java.util.stream.Stream;
    3536
    36 import org.junit.Assert;
    37 import org.junit.Assume;
     37import org.junit.jupiter.api.Assertions;
    3838import org.openstreetmap.josm.command.Command;
    3939import org.openstreetmap.josm.data.osm.DataSet;
     
    447447     * Use to assume that EqualsVerifier is working with the current JVM.
    448448     */
     449    @SuppressWarnings("null")
    449450    public static void assumeWorkingEqualsVerifier() {
    450451        if (Utils.getJavaVersion() >= 16) {
     
    457458            nl.jqno.equalsverifier.internal.lib.bytebuddy.ClassFileVersion.ofThisVm();
    458459        } catch (IllegalArgumentException e) {
    459             Assume.assumeNoException(e);
     460            assumeFalse(e != null);
    460461        }
    461462    }
     
    464465     * Use to assume that JMockit is working with the current JVM.
    465466     */
     467    @SuppressWarnings("null")
    466468    public static void assumeWorkingJMockit() {
    467469        try {
     
    471473            new JOptionPaneSimpleMocker();
    472474        } catch (UnsupportedOperationException e) {
    473             Assume.assumeNoException(e);
     475            assumeFalse(e != null);
    474476        } finally {
    475477            TestRunnerDecorator.cleanUpAllMocks();
     
    546548    /**
    547549     * Replaces {@linkplain System#lineSeparator() system dependent line separators} with {@code \n}
    548      * and calls {@link Assert#assertEquals(java.lang.Object, java.lang.Object)}.
     550     * and calls {@link Assertions#assertEquals(java.lang.Object, java.lang.Object)}.
    549551     * @param expected expected value
    550552     * @param actual the value to check against <code>expected</code>
  • trunk/test/unit/org/openstreetmap/josm/actions/AboutActionTest.java

    r14822 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 for class {@link AboutAction}.
    1414 */
    15 public final class AboutActionTest {
     15final class AboutActionTest {
    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().main();
     
    2626     */
    2727    @Test
    28     public void testBuildAboutPanel() {
     28    void testBuildAboutPanel() {
    2929        assertNotNull(new AboutAction().buildAboutPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java

    r13108 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
    7 
    8 import org.junit.Before;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     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;
     8
     9import org.junit.jupiter.api.BeforeEach;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1112import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
    1213import org.openstreetmap.josm.actions.AlignInLineAction.Line;
     
    2425 * Unit tests for class {@link AlignInLineAction}.
    2526 */
    26 public final class AlignInLineActionTest {
     27final class AlignInLineActionTest {
    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().main().projection();
     
    3940     * Setup test.
    4041     */
    41     @Before
     42    @BeforeEach
    4243    public void setUp() {
    4344        // Enable "Align in line" feature.
     
    5455     */
    5556    @Test
    56     public void testNodesOpenWay() throws InvalidSelection {
     57    void testNodesOpenWay() throws InvalidSelection {
    5758        DataSet dataSet = new DataSet();
    5859
     
    8687     */
    8788    @Test
    88     public void testNodesClosedWay() throws InvalidSelection {
     89    void testNodesClosedWay() throws InvalidSelection {
    8990        DataSet dataSet = new DataSet();
    9091
     
    119120     */
    120121    @Test
    121     public void testNodesOpenWays() throws InvalidSelection {
     122    void testNodesOpenWays() throws InvalidSelection {
    122123        DataSet dataSet = new DataSet();
    123124
     
    153154     */
    154155    @Test
    155     public void testSimpleWay() throws InvalidSelection {
     156    void testSimpleWay() throws InvalidSelection {
    156157        DataSet dataSet = new DataSet();
    157158
     
    200201    private void assertCoordEq(Node node, double x, double y) {
    201202        EastNorth coordinate = node.getEastNorth();
    202         assertEquals("Wrong x coordinate.", x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION);
    203         assertEquals("Wrong y coordinate.", y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION);
     203        assertEquals(x, coordinate.getX(), LatLon.MAX_SERVER_PRECISION, "Wrong x coordinate.");
     204        assertEquals(y, coordinate.getY(), LatLon.MAX_SERVER_PRECISION, "Wrong y coordinate.");
    204205    }
    205206
     
    209210     */
    210211    @Test
    211     public void testLineDifferentCoordinates() throws InvalidSelection {
     212    void testLineDifferentCoordinates() throws InvalidSelection {
    212213        assertNotNull(new Line(new Node(new EastNorth(0, 1)),
    213214                               new Node(new EastNorth(0, 2))));
     
    222223     * @throws InvalidSelection always
    223224     */
    224     @Test(expected = InvalidSelection.class)
    225     public void testLineSameCoordinates1() throws InvalidSelection {
    226         new Line(new Node(new EastNorth(0, 1)),
    227                  new Node(new EastNorth(0, 1)));
     225    @Test
     226    void testLineSameCoordinates1() throws InvalidSelection {
     227        assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)),
     228                 new Node(new EastNorth(0, 1))));
    228229    }
    229230
     
    232233     * @throws InvalidSelection always
    233234     */
    234     @Test(expected = InvalidSelection.class)
    235     public void testLineSameCoordinates2() throws InvalidSelection {
    236         new Line(new Node(new EastNorth(0, 1)),
    237                  new Node(new EastNorth(0+1e-175, 1+1e-175)));
     235    @Test
     236    void testLineSameCoordinates2() throws InvalidSelection {
     237        assertThrows(InvalidSelection.class, () -> new Line(new Node(new EastNorth(0, 1)),
     238                 new Node(new EastNorth(0+1e-175, 1+1e-175))));
    238239    }
    239240}
  • trunk/test/unit/org/openstreetmap/josm/actions/CombineWayActionTest.java

    r16438 r17275  
    22package org.openstreetmap.josm.actions;
    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
    77import java.io.IOException;
     
    1515import java.util.Set;
    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.osm.DataSet;
     
    3232 * Unit tests for class {@link CombineWayAction}.
    3333 */
    34 public class CombineWayActionTest {
     34class CombineWayActionTest {
    3535
    3636    /**
    3737     * Setup test.
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules();
     
    4747     */
    4848    @Test
    49     public void testTicket11957() throws IOException, IllegalDataException {
     49    void testTicket11957() throws IOException, IllegalDataException {
    5050        try (InputStream is = TestUtils.getRegressionDataStream(11957, "data.osm")) {
    5151            DataSet ds = OsmReader.parseDataSet(is, null);
     
    6868     */
    6969    @Test
    70     public void testTicket18385() throws IOException, IllegalDataException {
     70    void testTicket18385() throws IOException, IllegalDataException {
    7171        try (InputStream is = TestUtils.getRegressionDataStream(18385, "data.osm")) {
    7272            DataSet ds = OsmReader.parseDataSet(is, null);
     
    8282     */
    8383    @Test
    84     public void testTicket18387() throws IOException, IllegalDataException {
     84    void testTicket18387() throws IOException, IllegalDataException {
    8585        try (InputStream is = TestUtils.getRegressionDataStream(18387, "data.osm")) {
    8686            DataSet ds = OsmReader.parseDataSet(is, null);
     
    104104     */
    105105    @Test
    106     public void testTicket18367() throws IOException, IllegalDataException {
     106    void testTicket18367() throws IOException, IllegalDataException {
    107107        try (InputStream is = TestUtils.getRegressionDataStream(18367, "nocombine.osm")) {
    108108            DataSet ds = OsmReader.parseDataSet(is, null);
     
    125125     */
    126126    @Test
    127     public void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
     127    void testTicket18367NeedsSplit() throws IOException, IllegalDataException {
    128128        try (InputStream is = TestUtils.getRegressionDataStream(18367, "split-and-reverse.osm")) {
    129129            DataSet ds = OsmReader.parseDataSet(is, null);
     
    149149     */
    150150    @Test
    151     public void testDetectReversedWays() throws IOException, IllegalDataException {
     151    void testDetectReversedWays() throws IOException, IllegalDataException {
    152152        try (InputStream is = TestUtils.getRegressionDataStream(18367, "silent-revert.osm")) {
    153153            DataSet ds = OsmReader.parseDataSet(is, null);
     
    175175     */
    176176    @Test
    177     public void testEqualsContract() {
     177    void testEqualsContract() {
    178178        TestUtils.assumeWorkingEqualsVerifier();
    179179        EqualsVerifier.forClass(NodePair.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/actions/CopyActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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;
    8 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.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
    99
    1010import java.awt.datatransfer.Clipboard;
     
    1515import java.util.Arrays;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.osm.DataSet;
     
    3232 * Unit tests for class {@link CopyAction}.
    3333 */
    34 public class CopyActionTest {
     34class CopyActionTest {
    3535    private static final class CapturingCopyAction extends CopyAction {
    3636        private boolean warningShown;
     
    4545     * We need prefs for this.
    4646     */
    47     @Rule
     47    @RegisterExtension
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4949    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
     
    5555     */
    5656    @Test
    57     public void testWarnOnEmpty() throws UnsupportedFlavorException, IOException {
     57    void testWarnOnEmpty() throws UnsupportedFlavorException, IOException {
    5858        Clipboard clipboard = ClipboardUtils.getClipboard();
    5959        clipboard.setContents(new StringSelection("test"), null);
     
    8282     */
    8383    @Test
    84     public void testCopySinglePrimitive() throws Exception {
     84    void testCopySinglePrimitive() throws Exception {
    8585        DataSet data = new DataSet();
    8686
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateCircleActionTest.java

    r14977 r17275  
    22package org.openstreetmap.josm.actions;
    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.lang.reflect.Field;
     
    99import java.util.Collection;
    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.data.coor.EastNorth;
    1414import org.openstreetmap.josm.data.coor.LatLon;
     
    2929 * Unit tests for class {@link CreateCircleAction}.
    3030 */
    31 public final class CreateCircleActionTest {
     31final class CreateCircleActionTest {
    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().projection();
     
    4545     */
    4646    @Test
    47     public void testTicket7421case0() throws ReflectiveOperationException {
     47    void testTicket7421case0() throws ReflectiveOperationException {
    4848        DataSet dataSet = new DataSet();
    4949
     
    6565        // Expected result: Dataset contain one closed way, clockwise
    6666        Collection<Way> resultingWays = dataSet.getWays();
    67         assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
    68                    resultingWays.size(), 1);
     67        assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size()));
    6968        Way resultingWay = resultingWays.iterator().next();
    70         assertTrue("Resulting way is not closed",
    71                    resultingWay.isClosed());
    72         assertTrue("Found anti-clockwize circle while way was clockwize",
    73                    Geometry.isClockwise(resultingWay));
     69        assertTrue(resultingWay.isClosed(), "Resulting way is not closed");
     70        assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise circle while way was clockwise");
    7471    }
    7572
     
    10299     */
    103100    @Test
    104     public void testTicket7421case1() throws ReflectiveOperationException {
     101    void testTicket7421case1() throws ReflectiveOperationException {
    105102        DataSet dataSet = new DataSet();
    106103
     
    127124            // Expected result: Dataset contain one closed way, clockwise
    128125            Collection<Way> resultingWays = dataSet.getWays();
    129             assertSame(String.format("Expect one way after perform action. %d found", resultingWays.size()),
    130                        resultingWays.size(), 1);
     126            assertSame(1, resultingWays.size(), String.format("Expect one way after perform action. %d found", resultingWays.size()));
    131127            Way resultingWay = resultingWays.iterator().next();
    132             assertTrue("Resulting way is not closed",
    133                        resultingWay.isClosed());
    134             assertTrue("Found anti-clockwise way while traffic is left hand.",
    135                        Geometry.isClockwise(resultingWay));
     128            assertTrue(resultingWay.isClosed(), "Resulting way is not closed");
     129            assertTrue(Geometry.isClockwise(resultingWay), "Found anti-clockwise way while traffic is left hand.");
    136130        } finally {
    137131            // Restore left/right hand traffic database
  • trunk/test/unit/org/openstreetmap/josm/actions/CreateMultipolygonActionTest.java

    r15162 r17275  
    22package org.openstreetmap.josm.actions;
    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.nio.file.Files;
     
    1212import java.util.TreeMap;
    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.command.SequenceCommand;
     
    3737 * Unit test of {@link CreateMultipolygonAction}
    3838 */
    39 public class CreateMultipolygonActionTest {
     39class CreateMultipolygonActionTest {
    4040
    4141    /**
    4242     * Setup test.
    4343     */
    44     @Rule
     44    @RegisterExtension
    4545    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4646    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
     
    8080
    8181    @Test
    82     public void testCreate1() throws Exception {
     82    void testCreate1() throws Exception {
    8383        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    8484        Pair<SequenceCommand, Relation> mp = CreateMultipolygonAction.createMultipolygonCommand(ds.getWays(), null);
     
    8888
    8989    @Test
    90     public void testCreate2() throws Exception {
     90    void testCreate2() throws Exception {
    9191        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    9292        Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.", null, true);
     
    9595
    9696    @Test
    97     public void testUpdate1() throws Exception {
     97    void testUpdate1() throws Exception {
    9898        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    9999        Relation mp = createMultipolygon(ds.getWays(), "ref=\".*1$\"", null, true);
     
    106106
    107107    @Test
    108     public void testUpdate2() throws Exception {
     108    void testUpdate2() throws Exception {
    109109        DataSet ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm")), null);
    110110        Relation mp = createMultipolygon(ds.getWays(), "ref=1 OR ref:1.1.1", null, true);
     
    119119     */
    120120    @Test
    121     public void testTicket17767() throws Exception {
     121    void testTicket17767() throws Exception {
    122122        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17767, "upd-mp.osm"), null);
    123123        Layer layer = new OsmDataLayer(ds, null, null);
     
    141141     */
    142142    @Test
    143     public void testTicket17768() throws Exception {
     143    void testTicket17768() throws Exception {
    144144        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(17768, "dupmem.osm"), null);
    145145        Layer layer = new OsmDataLayer(ds, null, null);
  • trunk/test/unit/org/openstreetmap/josm/actions/DeleteLayerActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertNotNull;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     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.data.osm.DataSet;
    1010import org.openstreetmap.josm.gui.MainApplication;
     
    1717 * Unit tests for class {@link DeleteLayerAction}.
    1818 */
    19 public final class DeleteLayerActionTest {
     19final class DeleteLayerActionTest {
    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 testActionPerformed() {
     32    void testActionPerformed() {
    3333        DeleteLayerAction action = new DeleteLayerAction();
    3434        // No layer
  • trunk/test/unit/org/openstreetmap/josm/actions/ExitActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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.junit.contrib.java.lang.system.ExpectedSystemExit;
    99import org.openstreetmap.josm.TestUtils;
     
    2222 * Unit tests for class {@link ExitAction}.
    2323 */
    24 public final class ExitActionTest {
     24final class ExitActionTest {
    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().main();
     
    3434     * System.exit rule
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    public final ExpectedSystemExit exit = ExpectedSystemExit.none();
    3838
     
    4141     */
    4242    @Test
    43     public void testActionPerformed() {
     43    void testActionPerformed() {
    4444        TestUtils.assumeWorkingJMockit();
    4545        exit.expectSystemExitWithStatus(0);
  • trunk/test/unit/org/openstreetmap/josm/actions/ExpertToggleActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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.concurrent.atomic.AtomicBoolean;
     
    99import javax.swing.JPanel;
    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.actions.ExpertToggleAction.ExpertModeChangeListener;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * @since 11224
    2222 */
    23 public class ExpertToggleActionTest {
     23class ExpertToggleActionTest {
    2424    /**
    2525     * We need prefs to store expert mode state.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3434     */
    3535    @Test
    36     public void testVisibilitySwitcher() {
     36    void testVisibilitySwitcher() {
    3737        ExpertToggleAction.getInstance().setExpert(false);
    3838        JPanel c = new JPanel();
     
    5858     */
    5959    @Test
    60     public void testExpertModeListener() {
     60    void testExpertModeListener() {
    6161        AtomicBoolean value = new AtomicBoolean(false);
    6262        ExpertToggleAction.getInstance().setExpert(true);
  • trunk/test/unit/org/openstreetmap/josm/actions/ExtensionFileFilterTest.java

    r13352 r17275  
    22package org.openstreetmap.josm.actions;
    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;
    77import org.openstreetmap.josm.TestUtils;
    88import org.openstreetmap.josm.actions.ExtensionFileFilter.AddArchiveExtension;
     
    1313 * Unit tests for class {@link ExtensionFileFilter}.
    1414 */
    15 public class ExtensionFileFilterTest {
     15class ExtensionFileFilterTest {
    1616
    1717    private static void test(String extensions, String defaultExtension, String description, boolean addArchiveExtensionsToDescription,
     
    2828     */
    2929    @Test
    30     public void testNewFilterWithArchiveExtensions() {
     30    void testNewFilterWithArchiveExtensions() {
    3131        test("ext1", "ext1", "description", true,
    3232                "ext1,ext1.gz,ext1.bz,ext1.bz2,ext1.xz,ext1.zip",
     
    4747     */
    4848    @Test
    49     public void testEqualsContract() {
     49    void testEqualsContract() {
    5050        TestUtils.assumeWorkingEqualsVerifier();
    5151        EqualsVerifier.forClass(ExtensionFileFilter.class).usingGetClass()
     
    5757     */
    5858    @Test
    59     public void testEnumAddArchiveExtension() {
     59    void testEnumAddArchiveExtension() {
    6060        TestUtils.superficialEnumCodeCoverage(AddArchiveExtension.class);
    6161    }
  • trunk/test/unit/org/openstreetmap/josm/actions/FullscreenToggleActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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 * Test {@link FullscreenToggleAction}
    1212 */
    13 public class FullscreenToggleActionTest {
     13class FullscreenToggleActionTest {
    1414    /**
    1515     * Setup test.
    1616     */
    17     @Rule
     17    @RegisterExtension
    1818    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    1919    public JOSMTestRules test = new JOSMTestRules().main();
     
    2323     */
    2424    @Test
    25     public void testFullscreenToggleAction() {
     25    void testFullscreenToggleAction() {
    2626        FullscreenToggleAction action = new FullscreenToggleAction();
    2727        // Cannot really test it in headless mode, but at least check we can toggle the action without error
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinAreasActionTest.java

    r16438 r17275  
    22package org.openstreetmap.josm.actions;
    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;
     
    1515import java.util.Set;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.actions.search.SearchAction;
     
    4444 * Unit tests of {@link JoinAreasAction} class.
    4545 */
    46 public class JoinAreasActionTest {
     46class JoinAreasActionTest {
    4747
    4848    /**
    4949     * Setup test.
    5050     */
    51     @Rule
     51    @RegisterExtension
    5252    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5353    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
     
    5959     */
    6060    @Test
    61     public void testTicket9599() throws IOException, IllegalDataException {
     61    void testTicket9599() throws IOException, IllegalDataException {
    6262        try (InputStream is = TestUtils.getRegressionDataStream(9599, "ex5.osm")) {
    6363            DataSet ds = OsmReader.parseDataSet(is, null);
     
    8282     */
    8383    @Test
    84     public void testTicket9599Simple() throws IOException, IllegalDataException {
     84    void testTicket9599Simple() throws IOException, IllegalDataException {
    8585        try (InputStream is = TestUtils.getRegressionDataStream(9599, "three_old.osm")) {
    8686            DataSet ds = OsmReader.parseDataSet(is, null);
     
    106106     */
    107107    @Test
    108     public void testTicket10511() throws IOException, IllegalDataException {
     108    void testTicket10511() throws IOException, IllegalDataException {
    109109        try (InputStream is = TestUtils.getRegressionDataStream(10511, "10511_mini.osm")) {
    110110            DataSet ds = OsmReader.parseDataSet(is, null);
     
    128128     */
    129129    @Test
    130     public void testTicket11992() throws IOException, IllegalDataException {
     130    void testTicket11992() throws IOException, IllegalDataException {
    131131        try (InputStream is = TestUtils.getRegressionDataStream(11992, "shapes.osm")) {
    132132            DataSet ds = OsmReader.parseDataSet(is, null);
     
    154154     */
    155155    @Test
    156     public void testTicket18744() throws IOException, IllegalDataException {
     156    void testTicket18744() throws IOException, IllegalDataException {
    157157        try (InputStream is = TestUtils.getRegressionDataStream(18744, "18744-sample.osm")) {
    158158            DataSet ds = OsmReader.parseDataSet(is, null);
     
    179179    @Test
    180180    @SuppressWarnings({ "rawtypes", "unchecked" })
    181     public void testExamples() throws Exception {
     181    void testExamples() throws Exception {
    182182        DataSet dsToJoin, dsExpected;
    183183        try (InputStream is = Files.newInputStream(Paths.get("nodist/data/Join_Areas_Tests.osm"))) {
     
    199199            Collection<OsmPrimitive> primitives = tests.get(test);
    200200            for (OsmPrimitive osm : primitives) {
    201                 assertTrue(test + "; expected way, but got: " + osm, osm instanceof Way);
     201                assertTrue(osm instanceof Way, test + "; expected way, but got: " + osm);
    202202            }
    203203            new JoinAreasAction(false).join((Collection) primitives);
    204204            Collection<OsmPrimitive> joinedCol = dsToJoin.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test));
    205             assertEquals("in test " + test + ":", 1, joinedCol.size());
     205            assertEquals(1, joinedCol.size(), "in test " + test + ":");
    206206            Collection<OsmPrimitive> expectedCol = dsExpected.getPrimitives(osm -> !osm.isDeleted() && Objects.equals(osm.get("test"), test));
    207             assertEquals("in test " + test + ":", 1, expectedCol.size());
     207            assertEquals(1, expectedCol.size(), "in test " + test + ":");
    208208            OsmPrimitive osmJoined = joinedCol.iterator().next();
    209209            OsmPrimitive osmExpected = expectedCol.iterator().next();
    210             assertTrue("difference in test " + test, isSemanticallyEqual(osmExpected, osmJoined));
     210            assertTrue(isSemanticallyEqual(osmExpected, osmJoined), "difference in test " + test);
    211211        }
    212212    }
  • trunk/test/unit/org/openstreetmap/josm/actions/JoinNodeWayActionTest.java

    r16202 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 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;
    57
    68import java.awt.Rectangle;
     
    1012import java.util.stream.Collectors;
    1113
    12 import org.junit.Rule;
    13 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1416import org.openstreetmap.josm.TestUtils;
    1517import org.openstreetmap.josm.data.coor.EastNorth;
     
    3335 * Unit tests for class {@link JoinNodeWayAction}.
    3436 */
    35 public final class JoinNodeWayActionTest {
     37final class JoinNodeWayActionTest {
    3638    /**
    3739     * Setup test.
    3840     */
    39     @Rule
     41    @RegisterExtension
    4042    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4143    public JOSMTestRules test = new JOSMTestRules().projection().main().preferences();
     
    6163     */
    6264    @Test
    63     public void testTicket18189() throws Exception {
     65    void testTicket18189() throws Exception {
    6466        DataSet dataSet = new DataSet();
    6567        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    9395            action.actionPerformed(null);
    9496            // Make sure the node was only moved once
    95             assertTrue("Node n5 wasn't added to way w1.", w1.containsNode(n5));
    96             assertTrue("Node n5 wasn't added to way w2.", w2.containsNode(n5));
    97             assertTrue("Node was moved to an unexpected position", n5.getEastNorth().equalsEpsilon(expected, 1e-7));
     97            assertTrue(w1.containsNode(n5), "Node n5 wasn't added to way w1.");
     98            assertTrue(w2.containsNode(n5), "Node n5 wasn't added to way w2.");
     99            assertTrue(n5.getEastNorth().equalsEpsilon(expected, 1e-7), "Node was moved to an unexpected position");
    98100        } finally {
    99101            MainApplication.getLayerManager().removeLayer(layer);
     
    106108     */
    107109    @Test
    108     public void testTicket11508() throws Exception {
     110    void testTicket11508() throws Exception {
    109111        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(11508, "11508_example.osm"), null);
    110112        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    113115            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    114116                    .collect(Collectors.toList());
    115             assertTrue(nodesToMove.size() == 1);
     117            assertEquals(1, nodesToMove.size());
    116118            Node toMove = nodesToMove.iterator().next();
    117119            Node expected = new Node(new LatLon(47.56331849690742, 8.800789259499311));
     
    122124            action.actionPerformed(null);
    123125
    124             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    125             assertTrue("Node was not added to expected number of ways", toMove.getParentWays().size() == 2);
     126            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     127            assertEquals(2, toMove.getParentWays().size(), "Node was not added to expected number of ways");
    126128        } finally {
    127129            MainApplication.getLayerManager().removeLayer(layer);
     
    134136     */
    135137    @Test
    136     public void testTicket18189Crossing() throws Exception {
     138    void testTicket18189Crossing() throws Exception {
    137139        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "moveontocrossing.osm"), null);
    138140        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    144146            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    145147                    .collect(Collectors.toList());
    146             assertTrue(nodesToMove.size() == 1);
     148            assertEquals(1, nodesToMove.size());
    147149            Node toMove = nodesToMove.iterator().next();
    148150            ds.setSelected(toMove);
     
    159161     */
    160162    @Test
    161     public void testTicket18189ThreeWays() throws Exception {
     163    void testTicket18189ThreeWays() throws Exception {
    162164        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18189, "data.osm"), null);
    163165        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    169171            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name", "select me and press N"))
    170172                    .collect(Collectors.toList());
    171             assertTrue(nodesToMove.size() == 1);
     173            assertEquals(1, nodesToMove.size());
    172174            Node toMove = nodesToMove.iterator().next();
    173175            Node expected = new Node(new LatLon(-21.088998104148224, -50.38629102179512));
    174176            ds.setSelected(toMove);
    175177            action.actionPerformed(null);
    176             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    177             assertTrue("Node was not added to expected number of ways", toMove.getParentWays().size() == 4);
    178 
     178            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     179            assertEquals(4, toMove.getParentWays().size(), "Node was not added to expected number of ways");
    179180        } finally {
    180181            MainApplication.getLayerManager().removeLayer(layer);
     
    187188     */
    188189    @Test
    189     public void testTicket18420() throws Exception {
     190    void testTicket18420() throws Exception {
    190191        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18420, "user-sample.osm"), null);
    191192        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    193194        try {
    194195            List<Node> nodesToMove = ds.getNodes().stream().filter(n -> n.hasTag("name")).collect(Collectors.toList());
    195             assertTrue(nodesToMove.size() == 2);
     196            assertEquals(2, nodesToMove.size());
    196197            Node n = nodesToMove.iterator().next();
    197198            if (!n.hasTag("name", "select me 1st"))
     
    206207            action.setEnabled(true);
    207208            action.actionPerformed(null);
    208             assertTrue("Node was moved to an unexpected position", toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7));
    209             assertTrue("Node was moved to an unexpected position", toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7));
    210             assertTrue("Node was not added to expected number of ways", toMove1.getParentWays().size() == 2);
    211             assertTrue("Node was not added to expected number of ways", toMove2.getParentWays().size() == 2);
     209            assertTrue(toMove1.getEastNorth().equalsEpsilon(expected1.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     210            assertTrue(toMove2.getEastNorth().equalsEpsilon(expected2.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     211            assertEquals(2, toMove1.getParentWays().size(), "Node was not added to expected number of ways");
     212            assertEquals(2, toMove2.getParentWays().size(), "Node was not added to expected number of ways");
    212213        } finally {
    213214            MainApplication.getLayerManager().removeLayer(layer);
     
    220221     */
    221222    @Test
    222     public void testTicket18990() throws Exception {
     223    void testTicket18990() throws Exception {
    223224        DataSet ds = OsmReader.parseDataSet(TestUtils.getRegressionDataStream(18990, "18990-sample.osm"), null);
    224225        Layer layer = new OsmDataLayer(ds, OsmDataLayer.createNewName(), null);
     
    226227        try {
    227228            Node toMove = (Node) ds.getPrimitiveById(new SimplePrimitiveId(7018586511L, OsmPrimitiveType.NODE));
    228             assertTrue(toMove != null);
     229            assertNotNull(toMove);
    229230            Node expected = new Node(new LatLon(43.48582074476985, -96.76897750613033));
    230231
     
    234235            action.setEnabled(true);
    235236            action.actionPerformed(null);
    236             assertTrue("Node was moved to an unexpected position", toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7));
    237             assertTrue("Node was not added to expected way", toMove.getParentWays().size() == 1);
    238             assertTrue("Node was not added to expected way segment",
    239                     toMove.getParentWays().iterator().next().getNodes().indexOf(toMove) == 2);
     237            assertTrue(toMove.getEastNorth().equalsEpsilon(expected.getEastNorth(), 1e-7), "Node was moved to an unexpected position");
     238            assertEquals(1, toMove.getParentWays().size(), "Node was not added to expected way");
     239            assertEquals(2, toMove.getParentWays().iterator().next().getNodes().indexOf(toMove), "Node was not added to expected way segment");
    240240        } finally {
    241241            MainApplication.getLayerManager().removeLayer(layer);
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeLayerActionTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.actions;
    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.util.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.TestUtils;
    1616import org.openstreetmap.josm.data.osm.DataSet;
     
    3434     * Setup test.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    5858     * Setup test.
    5959     */
    60     @Before
     60    @BeforeEach
    6161    public void setUp() {
    6262        if (action == null) {
     
    7272     */
    7373    @Test
    74     public void testMergeNoSourceLayer() {
     74    void testMergeNoSourceLayer() {
    7575        assertNull(MainApplication.getLayerManager().getActiveLayer());
    7676        action.actionPerformed(null);
     
    8282     */
    8383    @Test
    84     public void testMergeNoTargetLayer() {
     84    void testMergeNoTargetLayer() {
    8585        TestUtils.assumeWorkingJMockit();
    8686        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
     
    105105     */
    106106    @Test
    107     public void testMergeTwoEmptyLayers() throws Exception {
     107    void testMergeTwoEmptyLayers() throws Exception {
    108108        TestUtils.assumeWorkingJMockit();
    109109        final MergeLayerExtendedDialogMocker edMocker = new MergeLayerExtendedDialogMocker();
  • trunk/test/unit/org/openstreetmap/josm/actions/MergeNodesActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import java.util.Arrays;
    89import java.util.Collections;
    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.coor.LatLon;
    1314import org.openstreetmap.josm.data.osm.DataSet;
     
    2122 * Unit tests for class {@link MergeNodesAction}.
    2223 */
    23 public class MergeNodesActionTest {
     24class MergeNodesActionTest {
    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();
     
    3334     * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - empty list
    3435     */
    35     @Test(expected = IllegalArgumentException.class)
    36     public void testSelectTargetLocationNodeEmpty() {
    37         MergeNodesAction.selectTargetLocationNode(Collections.emptyList());
     36    @Test
     37    void testSelectTargetLocationNodeEmpty() {
     38        assertThrows(IllegalArgumentException.class, () -> MergeNodesAction.selectTargetLocationNode(Collections.emptyList()));
    3839    }
    3940
     
    4142     * Unit test of {@link MergeNodesAction#selectTargetLocationNode} - invalid mode
    4243     */
    43     @Test(expected = IllegalStateException.class)
    44     public void testSelectTargetLocationNodeInvalidMode() {
     44    @Test
     45    void testSelectTargetLocationNodeInvalidMode() {
    4546        Config.getPref().putInt("merge-nodes.mode", -1);
    46         MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1)));
     47        assertThrows(IllegalStateException.class, () -> MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))));
    4748    }
    4849
     
    5152     */
    5253    @Test
    53     public void testSelectTargetLocationNode() {
     54    void testSelectTargetLocationNode() {
    5455        Config.getPref().putInt("merge-nodes.mode", 0);
    5556        assertEquals(1, MergeNodesAction.selectTargetLocationNode(Arrays.asList(new Node(0), new Node(1))).getId());
     
    6869     */
    6970    @Test
    70     public void testSelectTargetNode() {
     71    void testSelectTargetNode() {
    7172        assertNull(MergeNodesAction.selectTargetNode(Collections.emptyList()));
    7273        DataSet ds = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/MoveActionTest.java

    r11978 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import org.junit.Test;
     4import org.junit.jupiter.api.Test;
    55import org.openstreetmap.josm.TestUtils;
    66import org.openstreetmap.josm.actions.MoveAction.Direction;
     
    99 * Unit tests for class {@link ExtensionFileFilter}.
    1010 */
    11 public class MoveActionTest {
     11class MoveActionTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testEnumDirection() {
     17    void testEnumDirection() {
    1818        TestUtils.superficialEnumCodeCoverage(Direction.class);
    1919    }
  • trunk/test/unit/org/openstreetmap/josm/actions/OrthogonalizeActionTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.actions;
    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
    67import java.io.InputStream;
     
    1011import java.util.List;
    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;
    1516import org.openstreetmap.josm.actions.OrthogonalizeAction.Direction;
     
    3233 * Unit tests for class {@link OrthogonalizeAction}.
    3334 */
    34 public class OrthogonalizeActionTest {
     35class OrthogonalizeActionTest {
    3536
    3637    /**
    3738     * Setup test.
    3839     */
    39     @Rule
     40    @RegisterExtension
    4041    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4142    public JOSMTestRules test = new JOSMTestRules().projection();
    4243
    43     @Test(expected = OrthogonalizeAction.InvalidUserInputException.class)
    44     public void testNoSelection() throws Exception {
    45         performTest("nothing selected");
     44    @Test
     45    void testNoSelection() throws Exception {
     46        assertThrows(OrthogonalizeAction.InvalidUserInputException.class, () -> performTest("nothing selected"));
    4647    }
    4748
    4849    @Test
    49     public void testClosedWay() throws Exception {
     50    void testClosedWay() throws Exception {
    5051        final DataSet ds = performTest("name=ClosedWay");
    5152        final Way way = ds.getSelectedWays().iterator().next();
     
    5859
    5960    @Test
    60     public void testTwoWaysFormingClosedWay() throws Exception {
     61    void testTwoWaysFormingClosedWay() throws Exception {
    6162        performTest("name=TwoWaysFormingClosedWay");
    6263    }
    6364
    6465    @Test
    65     public void testTwoRingsAtOnce() throws Exception {
     66    void testTwoRingsAtOnce() throws Exception {
    6667        performTest("name=ClosedWay OR name=TwoWaysFormingClosedWay");
    6768    }
    6869
    6970    @Test
    70     public void testClosedWayWithReferenceNodes() throws Exception {
     71    void testClosedWayWithReferenceNodes() throws Exception {
    7172        final DataSet ds = performTest("name=ClosedWayWithReferenceNodes");
    7273        final Way way = ds.getSelectedWays().iterator().next();
     
    7980
    8081    @Test
    81     public void testFourNodes() throws Exception {
     82    void testFourNodes() throws Exception {
    8283        final DataSet ds = performTest(
    8384                "name=NodeToRectify-01", "name=NodeToRectify-02", "name=NodeToRectify-03", "name=NodeToRectify-04");
     
    9495     */
    9596    @Test
    96     public void testUtilityClass() throws ReflectiveOperationException {
     97    void testUtilityClass() throws ReflectiveOperationException {
    9798        UtilityClassTestUtil.assertUtilityClassWellDefined(OrthogonalizeAction.EN.class);
    9899    }
     
    122123     */
    123124    @Test
    124     public void testEnumDirection() {
     125    void testEnumDirection() {
    125126        TestUtils.superficialEnumCodeCoverage(Direction.class);
    126127    }
  • trunk/test/unit/org/openstreetmap/josm/actions/PurgeActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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.FileNotFoundException;
     
    99import java.io.InputStream;
    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.osm.DataSet;
     
    2525 * Unit tests for class {@link PurgeAction}.
    2626 */
    27 public class PurgeActionTest {
     27class PurgeActionTest {
    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().main();
     
    4141     */
    4242    @Test
    43     public void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
     43    void testCopyStringWayRelation() throws FileNotFoundException, IOException, IllegalDataException {
    4444        try (InputStream is = TestUtils.getRegressionDataStream(12038, "data.osm")) {
    4545            DataSet ds = OsmReader.parseDataSet(is, null);
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectAllActionTest.java

    r13938 r17275  
    22package org.openstreetmap.josm.actions;
    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.osm.DataSet;
    99import org.openstreetmap.josm.gui.MainApplication;
     
    1515 * Unit tests for class {@link SelectAllAction}.
    1616 */
    17 public final class SelectAllActionTest {
     17final class SelectAllActionTest {
    1818
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
     
    2828     */
    2929    @Test
    30     public void testActionPerformed() {
     30    void testActionPerformed() {
    3131        SelectByInternalPointActionTest.initDataSet();
    3232        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/SelectByInternalPointActionTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.actions;
    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
    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.data.coor.EastNorth;
    1212import org.openstreetmap.josm.data.osm.DataSet;
     
    2626 * Unit tests for class {@link SelectByInternalPointAction}.
    2727 */
    28 public final class SelectByInternalPointActionTest {
     28final class SelectByInternalPointActionTest {
    2929
    3030    /**
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules rules = new JOSMTestRules().preferences().projection().main();
     
    4040     */
    4141    @Test
    42     public void testUtilityClass() throws ReflectiveOperationException {
     42    void testUtilityClass() throws ReflectiveOperationException {
    4343        UtilityClassTestUtil.assertUtilityClassWellDefined(SelectByInternalPointAction.class);
    4444    }
     
    4848     */
    4949    @Test
    50     public void testNoDataSet() {
     50    void testNoDataSet() {
    5151        assertNull(MainApplication.getLayerManager().getEditDataSet());
    5252        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
     
    8585     */
    8686    @Test
    87     public void testGetSurroundingObjects() {
     87    void testGetSurroundingObjects() {
    8888        initDataSet();
    8989        assertEquals(0, SelectByInternalPointAction.getSurroundingObjects(null).size());
     
    9797     */
    9898    @Test
    99     public void testGetSmallestSurroundingObject() {
     99    void testGetSmallestSurroundingObject() {
    100100        initDataSet();
    101101        assertNull(SelectByInternalPointAction.getSmallestSurroundingObject(null));
     
    107107     */
    108108    @Test
    109     public void testPerformSelection() {
     109    void testPerformSelection() {
    110110        initDataSet();
    111111        DataSet ds = MainApplication.getLayerManager().getEditDataSet();
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionLoadActionTest.java

    r15070 r17275  
    22package org.openstreetmap.josm.actions;
    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.data.imagery.ImageryInfo;
    99import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    1616 * Unit tests for class {@link SessionLoadAction}.
    1717 */
    18 public class SessionLoadActionTest {
     18class SessionLoadActionTest {
    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().main().projection();
     
    2929     */
    3030    @Test
    31     public void testTicket17702() {
     31    void testTicket17702() {
    3232        assertFalse(SessionLoadAction.Loader.addLayer(new TMSLayer(new ImageryInfo(
    3333                "Bing Карта (GLOBALCITY)",
  • trunk/test/unit/org/openstreetmap/josm/actions/SessionSaveAsActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    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 * Unit tests for class {@link SessionSaveAsAction}.
    1414 */
    15 public class SessionSaveAsActionTest {
     15class SessionSaveAsActionTest {
    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 testSessionSaveAsAction() {
     28    void testSessionSaveAsAction() {
    2929        SessionSaveAsAction action = new SessionSaveAsAction();
    3030        assertFalse(action.isEnabled());
  • trunk/test/unit/org/openstreetmap/josm/actions/SimplifyWayActionTest.java

    r15432 r17275  
    22package org.openstreetmap.josm.actions;
    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
    77import java.io.IOException;
     
    1616import java.util.stream.Stream;
    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.DeleteCommand;
     
    3737 * Unit tests for class {@link SimplifyWayAction}.
    3838 */
    39 public final class SimplifyWayActionTest {
     39final class SimplifyWayActionTest {
    4040
    4141    /** Class under test. */
     
    4545     * Setup test.
    4646     */
    47     @Rule
     47    @RegisterExtension
    4848    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4949    public JOSMTestRules test = new JOSMTestRules().main();
     
    5252     * Setup test.
    5353     */
    54     @Before
     54    @BeforeEach
    5555    public void setUp() {
    5656        if (action == null) {
     
    6969     */
    7070    @Test
    71     public void testSimplify() throws Exception {
     71    void testSimplify() throws Exception {
    7272        DataSet DsSimplify = getDs("tracks");
    7373        DataSet DsExpected = getDs("tracks-simplify15");
     
    9191     */
    9292    @Test
    93     public void testSimplifyFirstNode() {
     93    void testSimplifyFirstNode() {
    9494        final DataSet ds = new DataSet();
    9595        final Node n1 = new Node(new LatLon(47.26269614984, 11.34044231149));
  • trunk/test/unit/org/openstreetmap/josm/actions/SplitWayActionTest.java

    r15728 r17275  
    22package org.openstreetmap.josm.actions;
    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.Arrays;
    88
    9 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    109import org.junit.Assert;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1312import org.openstreetmap.josm.TestUtils;
    1413import org.openstreetmap.josm.data.coor.EastNorth;
     
    2120import org.openstreetmap.josm.testutils.JOSMTestRules;
    2221
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     23
    2324/**
    2425 * Unit tests for class {@link SplitWayAction}.
    2526 */
    26 public final class SplitWayActionTest {
     27final class SplitWayActionTest {
    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().projection();
     
    4546     */
    4647    @Test
    47     public void testTicket11184() {
     48    void testTicket11184() {
    4849        Node n1 = addNode(0, 0);
    4950        Node n2 = addNode(-1, 1);
     
    6869
    6970        // Ensures 3 ways.
    70         assertSame(String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()),
    71                    dataSet.getWays().size(), 3);
     71        assertSame(3, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 3.", dataSet.getWays().size()));
    7272
    7373        // Ensures way w1 is unchanged.
    74         assertTrue("Unselected ways disappear during split action.",
    75                    dataSet.getWays().contains(w1));
    76         assertSame("Unselected way seems to have change during split action.",
    77                    w1.getNodesCount(), 3);
     74        assertTrue(dataSet.getWays().contains(w1), "Unselected ways disappear during split action.");
     75        assertSame(3, w1.getNodesCount(), "Unselected way seems to have change during split action.");
    7876        for (int i = 0; i < 3; i++) {
    79             assertSame("Node change in unselected way during split action.",
    80                        w1.getNode(i), w1NodesArray[i]);
     77            assertSame(w1.getNode(i), w1NodesArray[i], "Node change in unselected way during split action.");
    8178        }
    8279    }
     
    8885     */
    8986    @Test
    90     public void testTicket17810() {
     87    void testTicket17810() {
    9188        DataSet dataSet = new DataSet();
    9289        Way from = TestUtils.newWay("highway=residential", new Node(new LatLon(0.0, 0.0)),
     
    122119     */
    123120    @Test
    124     public void testTicket18477() {
     121    void testTicket18477() {
    125122        final Node n10 = addNode(1, 0);
    126123        final Node n21 = addNode(2, 1);
     
    133130        dataSet.setSelected(n10, n21);
    134131        SplitWayAction.runOn(dataSet);
    135         assertSame(String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()),
    136                 dataSet.getWays().size(), 4);
     132        assertSame(4, dataSet.getWays().size(), String.format("Found %d ways after split action instead of 4.", dataSet.getWays().size()));
    137133    }
    138134}
  • trunk/test/unit/org/openstreetmap/josm/actions/UnGlueActionTest.java

    r16300 r17275  
    22package org.openstreetmap.josm.actions;
    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.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.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.osm.DataSet;
     
    2121 * Unit tests for class {@link UnGlueAction}.
    2222 */
    23 public final class UnGlueActionTest {
     23final class UnGlueActionTest {
    2424
    2525    /** Class under test. */
     
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
     
    3636     * Setup test.
    3737     */
    38     @Before
     38    @BeforeEach
    3939    public void setUp() {
    4040        if (action == null) {
     
    4848     */
    4949    @Test
    50     public void testSelectionEmpty() {
     50    void testSelectionEmpty() {
    5151        DataSet ds = new DataSet();
    5252        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
     
    6666     */
    6767    @Test
    68     public void testSingleNodeNotInWay() {
     68    void testSingleNodeNotInWay() {
    6969        DataSet ds = new DataSet();
    7070        Node n = new Node(LatLon.ZERO);
     
    8787     */
    8888    @Test
    89     public void testSingleNodeInSingleWay() {
     89    void testSingleNodeInSingleWay() {
    9090        DataSet ds = new DataSet();
    9191        Node n1 = new Node(LatLon.ZERO);
     
    114114     */
    115115    @Test
    116     public void testSingleNodeInTwoWays() {
     116    void testSingleNodeInTwoWays() {
    117117        DataSet ds = new DataSet();
    118118        Node n1 = new Node(LatLon.ZERO);
  • trunk/test/unit/org/openstreetmap/josm/actions/UnJoinNodeWayActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     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.osm.DataSet;
     
    2121 * Unit tests for class {@link UnJoinNodeWayAction}.
    2222 */
    23 public final class UnJoinNodeWayActionTest {
     23final class UnJoinNodeWayActionTest {
    2424
    2525    /**
     
    4040     * Setup test.
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules();
     
    5151     */
    5252    @Test
    53     public void testTicket10396() {
     53    void testTicket10396() {
    5454        DataSet dataSet = new DataSet();
    5555        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    8383
    8484        // Ensures node n2 remove from w
    85         assertFalse("Node n2 wasn't removed from way w.", w.containsNode(n2));
     85        assertFalse(w.containsNode(n2), "Node n2 wasn't removed from way w.");
    8686    }
    8787}
  • trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayNoTagCorrectorTest.java

    r17023 r17275  
    22package org.openstreetmap.josm.actions.corrector;
    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.osm.Tag;
    99import org.openstreetmap.josm.data.osm.Tagged;
     
    1616 * Unit tests of {@link ReverseWayNoTagCorrector} class.
    1717 */
    18 public class ReverseWayNoTagCorrectorTest {
     18class ReverseWayNoTagCorrectorTest {
    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 testDirectionalTags() {
     31    void testDirectionalTags() {
    3232        assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("waterway", "drain")).size());
    3333        assertEquals(1, ReverseWayNoTagCorrector.getDirectionalTags(new Tag("man_made", "embankment")).size());
  • trunk/test/unit/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrectorTest.java

    r16771 r17275  
    88
    99import org.junit.Assert;
    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.correction.TagCorrection;
    1313import org.openstreetmap.josm.data.osm.Node;
     
    2424 * Unit tests of {@link ReverseWayTagCorrector} class.
    2525 */
    26 public class ReverseWayTagCorrectorTest {
     26class ReverseWayTagCorrectorTest {
    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();
     
    3838     */
    3939    @Test
    40     public void testUtilityClass() throws ReflectiveOperationException {
     40    void testUtilityClass() throws ReflectiveOperationException {
    4141        UtilityClassTestUtil.assertUtilityClassWellDefined(ReverseWayTagCorrector.TagSwitcher.class);
    4242    }
     
    4646     */
    4747    @Test
    48     public void testTagSwitch() {
     48    void testTagSwitch() {
    4949        // oneway
    5050        assertSwitch(new Tag("oneway", "yes"), new Tag("oneway", "-1"));
     
    121121     */
    122122    @Test
    123     public void testSwitchingWayNodes() {
     123    void testSwitchingWayNodes() {
    124124        final Map<OsmPrimitive, List<TagCorrection>> tagCorrections = getTagCorrectionsForWay("direction=forward");
    125125        Assert.assertEquals(1, tagCorrections.size());
     
    132132     */
    133133    @Test
    134     public void testNotSwitchingWayNodes() {
     134    void testNotSwitchingWayNodes() {
    135135        Assert.assertEquals(0, getTagCorrectionsForWay("direction=SSW").size());
    136136        Assert.assertEquals(0, getTagCorrectionsForWay("direction=145").size());
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78import java.util.Arrays;
    89
    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.testutils.JOSMTestRules;
    1213
     
    1617 * Unit tests for class {@link ChangesetContentDownloadTask}.
    1718 */
    18 public class ChangesetContentDownloadTaskTest {
     19class ChangesetContentDownloadTaskTest {
    1920
    2021    /**
    2122     * Setup test.
    2223     */
    23     @Rule
     24    @RegisterExtension
    2425    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2526    public JOSMTestRules test = new JOSMTestRules();
     
    2930     */
    3031    @Test
    31     public void testChangesetContentDownloadTask() {
     32    void testChangesetContentDownloadTask() {
    3233        Component parent = new Component() {
    3334            // empty component
     
    4142     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - invalid changeset id.
    4243     */
    43     @Test(expected = IllegalArgumentException.class)
    44     public void testChangesetContentDownloadTaskInvalidId() {
    45         new ChangesetContentDownloadTask(0);
     44    @Test
     45    void testChangesetContentDownloadTaskInvalidId() {
     46        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(0));
    4647    }
    4748
     
    4950     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent.
    5051     */
    51     @Test(expected = IllegalArgumentException.class)
    52     public void testChangesetContentDownloadTaskNullParent1() {
    53         new ChangesetContentDownloadTask(1);
     52    @Test
     53    void testChangesetContentDownloadTaskNullParent1() {
     54        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(1));
    5455    }
    5556
     
    5758     * Unit test of {@code ChangesetContentDownloadTask#ChangesetContentDownloadTask} - null parent.
    5859     */
    59     @Test(expected = IllegalArgumentException.class)
    60     public void testChangesetContentDownloadTaskNullParent2() {
    61         new ChangesetContentDownloadTask(Arrays.asList(1, 2));
     60    @Test
     61    void testChangesetContentDownloadTaskNullParent2() {
     62        assertThrows(IllegalArgumentException.class, () -> new ChangesetContentDownloadTask(Arrays.asList(1, 2)));
    6263    }
    6364}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTaskTest.java

    r15153 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78import java.util.Collections;
    89
    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.osm.Changeset;
    1213import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1718 * Unit tests for class {@link ChangesetHeaderDownloadTask}.
    1819 */
    19 public class ChangesetHeaderDownloadTaskTest {
     20class ChangesetHeaderDownloadTaskTest {
    2021
    2122    /**
    2223     * Setup test.
    2324     */
    24     @Rule
     25    @RegisterExtension
    2526    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2627    public JOSMTestRules test = new JOSMTestRules();
     
    3031     */
    3132    @Test
    32     public void testBuildTaskForChangesets() {
     33    void testBuildTaskForChangesets() {
    3334        Component parent = new Component() {
    3435            // empty component
     
    4243     * Unit test of {@code ChangesetHeaderDownloadTask#buildTaskForChangesets} - null parent.
    4344     */
    44     @Test(expected = NullPointerException.class)
    45     public void testBuildTaskForChangesetsNullParent() {
    46         ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1)));
     45    @Test
     46    void testBuildTaskForChangesetsNullParent() {
     47        assertThrows(NullPointerException.class,
     48                () -> ChangesetHeaderDownloadTask.buildTaskForChangesets(Collections.singleton(new Changeset(1))));
    4749    }
    4850}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    67import java.awt.Component;
    78
    8 import org.junit.Rule;
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1011import org.openstreetmap.josm.io.ChangesetQuery;
    1112import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1617 * Unit tests for class {@link ChangesetQueryTask}.
    1718 */
    18 public class ChangesetQueryTaskTest {
     19class ChangesetQueryTaskTest {
    1920
    2021    /**
    2122     * Setup test.
    2223     */
    23     @Rule
     24    @RegisterExtension
    2425    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2526    public JOSMTestRules test = new JOSMTestRules();
     
    2930     */
    3031    @Test
    31     public void testChangesetQueryTask() {
     32    void testChangesetQueryTask() {
    3233        Component parent = new Component() {
    3334            // empty component
     
    3940     * Unit test of {@code ChangesetQueryTask#ChangesetQueryTask} - null parent.
    4041     */
    41     @Test(expected = IllegalArgumentException.class)
    42     public void testChangesetQueryTaskNullParent() {
    43         new ChangesetQueryTask(new ChangesetQuery());
     42    @Test
     43    void testChangesetQueryTaskNullParent() {
     44        assertThrows(IllegalArgumentException.class, () -> new ChangesetQueryTask(new ChangesetQuery()));
    4445    }
    4546}
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTaskTest.java

    r10945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.osm.DataSet;
     
    2020 * Unit tests for class {@link DownloadReferrersTask}.
    2121 */
    22 public class DownloadReferrersTaskTest {
     22class DownloadReferrersTaskTest {
    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 testDownloadReferrersTask() {
     35    void testDownloadReferrersTask() {
    3636        DataSet ds = new DataSet();
    3737        Node n1 = (Node) OsmPrimitiveType.NODE.newInstance(-1, true);
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java

    r15216 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertNull;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    77import java.awt.geom.Area;
    88import java.util.Collections;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1212import org.openstreetmap.josm.data.Bounds;
    1313import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    1919 * Unit tests for class {@link DownloadTaskList}.
    2020 */
    21 public class DownloadTaskListTest {
     21class DownloadTaskListTest {
    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 testDownloadTaskList() {
     34    void testDownloadTaskList() {
    3535        assertTrue(new DownloadTaskList().getDownloadedPrimitives().isEmpty());
    3636    }
     
    4141     */
    4242    @Test
    43     public void testDownloadAreaEmpty() throws Exception {
     43    void testDownloadAreaEmpty() throws Exception {
    4444        DownloadTaskList list = new DownloadTaskList();
    4545        assertNull(list.download(false,
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandlerTest.java

    r16945 r17275  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    66import java.net.URL;
     
    1313import java.util.concurrent.TimeoutException;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.data.Bounds;
    1818import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     
    2525 * Unit tests for class {@link PostDownloadHandler}.
    2626 */
    27 public class PostDownloadHandlerTest {
     27class PostDownloadHandlerTest {
    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();
     
    124124     */
    125125    @Test
    126     public void testRunExceptionFuture() {
     126    void testRunExceptionFuture() {
    127127        Logging.clearLastErrorAndWarnings();
    128128        new PostDownloadHandler(null, newFuture("testRunExceptionFuture")).run();
    129         assertTrue(Logging.getLastErrorAndWarnings().toString(),
     129        assertTrue(
    130130                Logging.getLastErrorAndWarnings().stream()
    131                         .anyMatch(e -> e.endsWith("E: java.util.concurrent.ExecutionException: testRunExceptionFuture")));
     131                        .anyMatch(e -> e.endsWith("E: java.util.concurrent.ExecutionException: testRunExceptionFuture")),
     132                        Logging.getLastErrorAndWarnings().toString());
    132133    }
    133134
     
    136137     */
    137138    @Test
    138     public void testRunNoError() {
     139    void testRunNoError() {
    139140        Logging.clearLastErrorAndWarnings();
    140141        new PostDownloadHandler(newTask(Collections.emptyList()), newFuture(null)).run();
    141         assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().isEmpty());
     142        assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), Logging.getLastErrorAndWarnings().toString());
    142143    }
    143144
     
    146147     */
    147148    @Test
    148     public void testRunOneError() {
     149    void testRunOneError() {
    149150        Logging.clearLastErrorAndWarnings();
    150151        new PostDownloadHandler(newTask(Collections.singletonList(new Object())), newFuture(null)).run();
    151         assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().isEmpty());
     152        assertTrue(Logging.getLastErrorAndWarnings().isEmpty(), Logging.getLastErrorAndWarnings().toString());
    152153    }
    153154
     
    156157     */
    157158    @Test
    158     public void testRunMultipleErrors() {
     159    void testRunMultipleErrors() {
    159160        Logging.clearLastErrorAndWarnings();
    160161        new PostDownloadHandler(newTask(Arrays.asList("foo", new Exception("bar"), new Object())), newFuture(null)).run();
    161         assertTrue(Logging.getLastErrorAndWarnings().toString(),
     162        assertTrue(
    162163                Logging.getLastErrorAndWarnings().stream()
    163                         .anyMatch(e -> e.endsWith("E: java.lang.Exception: bar")));
     164                        .anyMatch(e -> e.endsWith("E: java.lang.Exception: bar")), Logging.getLastErrorAndWarnings().toString());
    164165    }
    165166}
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.osm.DataSet;
    1010import org.openstreetmap.josm.data.osm.NoteData;
     
    1919 * Unit tests for class {@link AddNoteAction}.
    2020 */
    21 public class AddNoteActionTest {
     21class AddNoteActionTest {
    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().main().projection();
     
    3232     */
    3333    @Test
    34     public void testMode() {
     34    void testMode() {
    3535        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3636        try {
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DeleteActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.actions.mapmode.DeleteAction.DeleteMode;
     
    2020 * Unit tests for class {@link DeleteAction}.
    2121 */
    22 public class DeleteActionTest {
     22class DeleteActionTest {
    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().main().projection();
     
    3333     */
    3434    @Test
    35     public void testMode() {
     35    void testMode() {
    3636        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3737        try {
     
    5252     */
    5353    @Test
    54     public void testEnumDeleteMode() {
     54    void testEnumDeleteMode() {
    5555        TestUtils.superficialEnumCodeCoverage(DeleteMode.class);
    5656    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/DrawActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.awt.event.InputEvent;
     
    1414import javax.swing.JList;
    1515
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
     17import org.junit.jupiter.api.Test;
    1818import org.openstreetmap.josm.data.UndoRedoHandler;
    1919import org.openstreetmap.josm.data.coor.EastNorth;
     
    3333 * Unit tests for class {@link DrawAction}.
    3434 */
    35 public class DrawActionTest {
     35class DrawActionTest {
    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().main().projection().timeout(20000);
     
    5151     */
    5252    @Test
    53     public void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
     53    void testTicket12011() throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException {
    5454        DataSet dataSet = new DataSet();
    5555        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode;
     
    2020 * Unit tests for class {@link ExtrudeAction}.
    2121 */
    22 public class ExtrudeActionTest {
     22class ExtrudeActionTest {
    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().main().projection();
     
    3333     */
    3434    @Test
    35     public void testMode() {
     35    void testMode() {
    3636        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3737        try {
     
    5252     */
    5353    @Test
    54     public void testEnumMode() {
     54    void testEnumMode() {
    5555        TestUtils.superficialEnumCodeCoverage(Mode.class);
    5656    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ImproveWayAccuracyActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.actions.mapmode.ImproveWayAccuracyAction.State;
     
    2020 * Unit tests for class {@link ImproveWayAccuracyAction}.
    2121 */
    22 public class ImproveWayAccuracyActionTest {
     22class ImproveWayAccuracyActionTest {
    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().main().projection();
     
    3333     */
    3434    @Test
    35     public void testMode() {
     35    void testMode() {
    3636        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3737        try {
     
    5252     */
    5353    @Test
    54     public void testEnumState() {
     54    void testEnumState() {
    5555        TestUtils.superficialEnumCodeCoverage(State.class);
    5656    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Mode;
     
    2121 * Unit tests for class {@link ParallelWayAction}.
    2222 */
    23 public class ParallelWayActionTest {
     23class ParallelWayActionTest {
    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().main().projection();
     
    3434     */
    3535    @Test
    36     public void testMode() {
     36    void testMode() {
    3737        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3838        try {
     
    5353     */
    5454    @Test
    55     public void testEnumMode() {
     55    void testEnumMode() {
    5656        TestUtils.superficialEnumCodeCoverage(Mode.class);
    5757    }
     
    6161     */
    6262    @Test
    63     public void testEnumModifier() {
     63    void testEnumModifier() {
    6464        TestUtils.superficialEnumCodeCoverage(Modifier.class);
    6565    }
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/PlayHeadDragModeTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.data.osm.DataSet;
    1010import org.openstreetmap.josm.gui.MainApplication;
     
    1919 * Unit tests for class {@link PlayHeadDragMode}.
    2020 */
    21 public class PlayHeadDragModeTest {
     21class PlayHeadDragModeTest {
    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().main().projection();
     
    3232     */
    3333    @Test
    34     public void testMode() {
     34    void testMode() {
    3535        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    3636        try {
  • trunk/test/unit/org/openstreetmap/josm/actions/mapmode/SelectActionTest.java

    r14977 r17275  
    22package org.openstreetmap.josm.actions.mapmode;
    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.awt.event.InputEvent;
     
    1212import java.util.Collection;
    1313
    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.TestUtils;
    1717import org.openstreetmap.josm.actions.mapmode.SelectAction.Mode;
     
    3434 * Unit tests for class {@link SelectAction}.
    3535 */
    36 public class SelectActionTest {
     36class SelectActionTest {
    3737
    3838    boolean nodesMerged;
     
    4949        public void mergeNodes(OsmDataLayer layer, Collection<Node> nodes,
    5050                               Node targetLocationNode) {
    51             assertSame(String.format("Should merge two nodes, %d found", nodes.size()),
    52                        nodes.size(), 2);
     51            assertSame(2, nodes.size(), String.format("Should merge two nodes, %d found", nodes.size()));
    5352            nodesMerged = true;
    5453        }
     
    5857     * Setup test.
    5958     */
    60     @Rule
     59    @RegisterExtension
    6160    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6261    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    7069    @Test
    7170    @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
    72     public void testTicket10748() throws ReflectiveOperationException {
     71    void testTicket10748() throws ReflectiveOperationException {
    7372        DataSet dataSet = new DataSet();
    7473        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    125124
    126125            // As result of test, we must find a 2 nodes way, from EN(0, 0) to EN(100, 0)
    127             assertTrue("Nodes are not merged", nodesMerged);
    128             assertSame(String.format("Expect exactly one way, found %d%n", dataSet.getWays().size()),
    129                        dataSet.getWays().size(), 1);
     126            assertTrue(nodesMerged, "Nodes are not merged");
     127            assertSame(1, dataSet.getWays().size(), String.format("Expect exactly one way, found %d%n", dataSet.getWays().size()));
    130128            Way rw = dataSet.getWays().iterator().next();
    131             assertFalse("Way shouldn't be deleted\n", rw.isDeleted());
    132             assertSame(String.format("Way shouldn't have 2 nodes, %d found%n", w.getNodesCount()),
    133                        rw.getNodesCount(), 2);
     129            assertFalse(rw.isDeleted(), "Way shouldn't be deleted\n");
     130            assertSame(2, rw.getNodesCount(), String.format("Way shouldn't have 2 nodes, %d found%n", w.getNodesCount()));
    134131            Node r1 = rw.firstNode();
    135132            Node r2 = rw.lastNode();
     
    139136                r2 = tmp;
    140137            }
    141             assertSame(String.format("East should be 0, found %f%n", r1.getEastNorth().east()),
    142                        Double.compare(r1.getEastNorth().east(), 0), 0);
    143             assertSame(String.format("East should be 100, found %f%n", r2.getEastNorth().east()),
    144                        Double.compare(r2.getEastNorth().east(), 100), 0);
     138            assertSame(0, Double.compare(r1.getEastNorth().east(), 0),
     139                    String.format("East should be 0, found %f%n", r1.getEastNorth().east()));
     140            assertSame(0, Double.compare(r2.getEastNorth().east(), 100),
     141                    String.format("East should be 100, found %f%n", r2.getEastNorth().east()));
    145142        } finally {
    146143            // Ensure we clean the place before leaving, even if test fails.
     
    153150     */
    154151    @Test
    155     public void testEnumMode() {
     152    void testEnumMode() {
    156153        TestUtils.superficialEnumCodeCoverage(Mode.class);
    157154    }
     
    161158     */
    162159    @Test
    163     public void testEnumSelectActionCursor() {
     160    void testEnumSelectActionCursor() {
    164161        TestUtils.superficialEnumCodeCoverage(SelectActionCursor.class);
    165162    }
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/FixDataHookTest.java

    r16577 r17275  
    22package org.openstreetmap.josm.actions.upload;
    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;
    1010import java.util.Collection;
    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.command.PseudoCommand;
    1515import org.openstreetmap.josm.command.SequenceCommand;
     
    2727 * Unit tests for class {@link FixDataHook}.
    2828 */
    29 public class FixDataHookTest {
     29class FixDataHookTest {
    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().main();
     
    4040     */
    4141    @Test
    42     public void testCheckUpload() {
     42    void testCheckUpload() {
    4343        // Empty data set
    4444        UndoRedoHandler.getInstance().clean();
     
    8585        assertEquals(9, prims.size());
    8686        for (OsmPrimitive o : Arrays.asList(w1, w2, w3, w4, w5, w6, w7, r1, r2)) {
    87             assertTrue(o.toString(), prims.contains(o));
     87            assertTrue(prims.contains(o), o.toString());
    8888        }
    8989        Collection<PseudoCommand> cmds = seq.getChildren();
  • trunk/test/unit/org/openstreetmap/josm/actions/upload/ValidateUploadHookTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.actions.upload;
    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.data.APIDataSet;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests for class {@link ValidateUploadHook}.
    1515 */
    16 public class ValidateUploadHookTest {
     16class ValidateUploadHookTest {
    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().fakeAPI().timeout(30000);
     
    2727     */
    2828    @Test
    29     public void testCheckUpload() {
     29    void testCheckUpload() {
    3030        assertTrue(new ValidateUploadHook().checkUpload(new APIDataSet()));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/command/AddCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.util.ArrayList;
    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;
     
    2727 * Unit tests of {@link AddCommand} class.
    2828 */
    29 public class AddCommandTest {
     29class AddCommandTest {
    3030
    3131    /**
    3232     * We need prefs for nodes.
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4040     */
    4141    @Test
    42     public void testAdd() {
     42    void testAdd() {
    4343        DataSet ds = new DataSet();
    4444        assertArrayEquals(new Object[0], ds.allPrimitives().toArray());
     
    5656     */
    5757    @Test
    58     public void testAddToLayer() {
     58    void testAddToLayer() {
    5959        DataSet ds1 = new DataSet();
    6060        DataSet ds2 = new DataSet();
     
    7171     */
    7272    @Test
    73     public void testUndo() {
     73    void testUndo() {
    7474        Node osm = new Node(LatLon.ZERO);
    7575        DataSet ds = new DataSet(osm);
     
    8686     */
    8787    @Test
    88     public void testParticipatingPrimitives() {
     88    void testParticipatingPrimitives() {
    8989        Node osm = new Node(LatLon.ZERO);
    9090
     
    9696     */
    9797    @Test
    98     public void testFillModifiedData() {
     98    void testFillModifiedData() {
    9999        Node osm = new Node(LatLon.ZERO);
    100100
     
    112112     */
    113113    @Test
    114     public void testDescription() {
     114    void testDescription() {
    115115        Node node = new Node(LatLon.ZERO);
    116116        node.put("name", "xy");
     
    131131     */
    132132    @Test
    133     public void testEqualsContract() {
     133    void testEqualsContract() {
    134134        TestUtils.assumeWorkingEqualsVerifier();
    135135        EqualsVerifier.forClass(AddCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java

    r17240 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertSame;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertSame;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.ArrayList;
     
    1212import java.util.List;
    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.data.coor.LatLon;
     
    3434 * Unit tests of {@link AddPrimitivesCommand} class.
    3535 */
    36 public class AddPrimitivesCommandTest {
     36class AddPrimitivesCommandTest {
    3737
    3838    /**
    3939     * We need prefs for nodes.
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4747     */
    4848    @Test
    49     public void testAdd() {
     49    void testAdd() {
    5050        DataSet ds = new DataSet();
    5151
     
    6161     */
    6262    @Test
    63     public void testAddSetSelection() {
     63    void testAddSetSelection() {
    6464        DataSet ds = new DataSet();
    6565
     
    7777     */
    7878    @Test
    79     public void testAddToLayer() {
     79    void testAddToLayer() {
    8080        DataSet ds1 = new DataSet();
    8181        DataSet ds2 = new DataSet();
     
    9595     */
    9696    @Test
    97     public void testAddIgnoresExisting() {
     97    void testAddIgnoresExisting() {
    9898        DataSet ds = new DataSet();
    9999
     
    114114     */
    115115    @Test
    116     public void testDescription() {
     116    void testDescription() {
    117117        DataSet ds = new DataSet();
    118118
     
    138138     */
    139139    @Test
    140     public void testUndo() {
     140    void testUndo() {
    141141        DataSet ds = new DataSet();
    142142
     
    172172     */
    173173    @Test
    174     public void testUndoIgnoresExisting() {
     174    void testUndoIgnoresExisting() {
    175175        DataSet ds = new DataSet();
    176176
     
    208208     */
    209209    @Test
    210     public void testUndoIgnoresExistingAsDeleted() {
     210    void testUndoIgnoresExistingAsDeleted() {
    211211        DataSet ds = new DataSet();
    212212
     
    243243     */
    244244    @Test
    245     public void testUndoIgnoresExistingSameUniqueIdDifferentType() {
     245    void testUndoIgnoresExistingSameUniqueIdDifferentType() {
    246246        DataSet ds = new DataSet();
    247247
     
    288288     */
    289289    @Test
    290     public void testParticipatingPrimitives() {
     290    void testParticipatingPrimitives() {
    291291        DataSet ds = new DataSet();
    292292
     
    308308     */
    309309    @Test
    310     public void testFillModifiedData() {
     310    void testFillModifiedData() {
    311311        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    312312        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    364364     */
    365365    @Test
    366     public void testEqualsContract() {
     366    void testEqualsContract() {
    367367        TestUtils.assumeWorkingEqualsVerifier();
    368368        EqualsVerifier.forClass(AddPrimitivesCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangeCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertNull;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     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.ArrayList;
     
    1112import java.util.List;
    1213
    13 import org.junit.Before;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1617import org.openstreetmap.josm.TestUtils;
    1718import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    3435 * Unit tests of {@link ChangeCommand} class.
    3536 */
    36 public class ChangeCommandTest {
     37class ChangeCommandTest {
    3738
    3839    /**
    3940     * We need prefs for nodes.
    4041     */
    41     @Rule
     42    @RegisterExtension
    4243    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4344    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4748     * Set up the test data.
    4849     */
    49     @Before
     50    @BeforeEach
    5051    public void createTestData() {
    5152        testData = new CommandTestData();
     
    5556     * Test that empty ways are prevented.
    5657     */
    57     @Test(expected = IllegalArgumentException.class)
    58     public void testPreventEmptyWays() {
     58    @Test
     59    void testPreventEmptyWays() {
    5960        Way emptyWay = new Way();
    60         new ChangeCommand(testData.existingWay, emptyWay);
     61        assertThrows(IllegalArgumentException.class, () -> new ChangeCommand(testData.existingWay, emptyWay));
    6162    }
    6263
     
    6566     */
    6667    @Test
    67     public void testChange() {
     68    void testChange() {
    6869        Node newNode = new Node(5);
    6970        newNode.setCoor(LatLon.NORTH_POLE);
     
    8889     * Test {@link ChangeCommand#executeCommand()} fails if ID is changed
    8990     */
    90     @Test(expected = DataIntegrityProblemException.class)
    91     public void testChangeIdChange() {
     91    @Test
     92    void testChangeIdChange() {
    9293        Node newNode = new Node(1);
    9394        newNode.setCoor(LatLon.NORTH_POLE);
    9495
    95         new ChangeCommand(testData.existingNode, newNode).executeCommand();
     96        assertThrows(DataIntegrityProblemException.class, () -> new ChangeCommand(testData.existingNode, newNode).executeCommand());
    9697    }
    9798
     
    100101     */
    101102    @Test
    102     public void testUndo() {
     103    void testUndo() {
    103104        Node newNode = new Node(5);
    104105        newNode.setCoor(LatLon.NORTH_POLE);
     
    121122     */
    122123    @Test
    123     public void testFillModifiedData() {
     124    void testFillModifiedData() {
    124125        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    125126        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    135136     */
    136137    @Test
    137     public void testDescription() {
     138    void testDescription() {
    138139        Node node = new Node(LatLon.ZERO);
    139140        node.put("name", "xy");
     
    154155     */
    155156    @Test
    156     public void testEqualsContract() {
     157    void testEqualsContract() {
    157158        TestUtils.assumeWorkingEqualsVerifier();
    158159        EqualsVerifier.forClass(ChangeCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangeMembersCommandTest.java

    r17199 r17275  
    22package org.openstreetmap.josm.command;
    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.Collections;
    88import java.util.List;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    2828 * Unit tests of {@link ChangeMembersCommand} class.
    2929 */
    30 public class ChangeMembersCommandTest {
     30class ChangeMembersCommandTest {
    3131
    3232    /**
    3333     * We need prefs for nodes.
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4141     * Set up the test data.
    4242     */
    43     @Before
     43    @BeforeEach
    4444    public void createTestData() {
    4545        testData = new CommandTestDataWithRelation();
     
    5050     */
    5151    @Test
    52     public void testChange() {
     52    void testChange() {
    5353        assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation));
    5454        assertEquals(2, testData.existingRelation.getMembersCount());
     
    7070     */
    7171    @Test
    72     public void testUndo() {
     72    void testUndo() {
    7373        List<RelationMember> members = testData.existingRelation.getMembers();
    7474        members.add(new RelationMember("n2", testData.existingNode2));
     
    8686     */
    8787    @Test
    88     public void testDescription() {
     88    void testDescription() {
    8989        testData.existingRelation.put("name", "xy");
    9090        List<RelationMember> members = testData.existingRelation.getMembers();
     
    9797     */
    9898    @Test
    99     public void testEqualsContract() {
     99    void testEqualsContract() {
    100100        TestUtils.assumeWorkingEqualsVerifier();
    101101        EqualsVerifier.forClass(ChangeMembersCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangeNodesCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.util.ArrayList;
     
    1213import java.util.List;
    1314
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.BeforeEach;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1718import org.openstreetmap.josm.TestUtils;
    1819import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    3334 * Unit tests of {@link ChangeNodesCommand} class.
    3435 */
    35 public class ChangeNodesCommandTest {
     36class ChangeNodesCommandTest {
    3637
    3738    /**
    3839     * We need prefs for nodes.
    3940     */
    40     @Rule
     41    @RegisterExtension
    4142    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4243    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4647     * Set up the test data.
    4748     */
    48     @Before
     49    @BeforeEach
    4950    public void createTestData() {
    5051        testData = new CommandTestData();
     
    5455     * Test that empty ways are prevented.
    5556     */
    56     @Test(expected = IllegalArgumentException.class)
    57     public void testPreventEmptyWays() {
    58         new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList());
     57    @Test
     58    void testPreventEmptyWays() {
     59        assertThrows(IllegalArgumentException.class, () -> new ChangeNodesCommand(testData.existingWay, Collections.<Node>emptyList()));
    5960    }
    6061
     
    6364     */
    6465    @Test
    65     public void testChange() {
     66    void testChange() {
    6667        List<Node> newNodes = testData.existingWay.getNodes();
    6768        Collections.reverse(newNodes);
     
    7980     */
    8081    @Test
    81     public void testUndo() {
     82    void testUndo() {
    8283        List<Node> newNodes = testData.existingWay.getNodes();
    8384        Collections.reverse(newNodes);
     
    9596     */
    9697    @Test
    97     public void testFillModifiedData() {
     98    void testFillModifiedData() {
    9899        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    99100        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    110111     */
    111112    @Test
    112     public void testDescription() {
     113    void testDescription() {
    113114        Node node = new Node(LatLon.ZERO);
    114115        node.put("name", "xy");
     
    125126     */
    126127    @Test
    127     public void testEqualsContract() {
     128    void testEqualsContract() {
    128129        TestUtils.assumeWorkingEqualsVerifier();
    129130        EqualsVerifier.forClass(ChangeNodesCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertNull;
    8 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.util.ArrayList;
     
    1414import java.util.List;
    1515
    16 import org.junit.Before;
    17 import org.junit.Rule;
    18 import org.junit.Test;
     16import org.junit.jupiter.api.BeforeEach;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    3636 * Unit tests of {@link ChangePropertyCommand} class.
    3737 */
    38 public class ChangePropertyCommandTest {
     38class ChangePropertyCommandTest {
    3939
    4040    /**
    4141     * We need prefs for nodes.
    4242     */
    43     @Rule
     43    @RegisterExtension
    4444    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4545    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4949     * Set up the test data.
    5050     */
    51     @Before
     51    @BeforeEach
    5252    public void createTestData() {
    5353        testData = new CommandTestData();
     
    5858     */
    5959    @Test
    60     public void testShortConstructor() {
     60    void testShortConstructor() {
    6161        ChangePropertyCommand command = new ChangePropertyCommand(Arrays.asList(testData.existingNode), "a", "b");
    6262        assertEquals("b", command.getTags().get("a"));
     
    7474     */
    7575    @Test
    76     public void testUpdateSingleProperty() {
     76    void testUpdateSingleProperty() {
    7777        Node node1 = testData.createNode(14);
    7878        Node node2 = testData.createNode(15);
     
    9393     */
    9494    @Test
    95     public void testRemoveProperty() {
     95    void testRemoveProperty() {
    9696        Node node1 = testData.createNode(14);
    9797        Node node2 = testData.createNode(15);
     
    112112     */
    113113    @Test
    114     public void testUpdateMultipleProperties() {
     114    void testUpdateMultipleProperties() {
    115115        Node node1 = testData.createNode(14);
    116116        Node node2 = testData.createNode(15);
     
    139139     */
    140140    @Test
    141     public void testUpdateIgnoresExistingProperty() {
     141    void testUpdateIgnoresExistingProperty() {
    142142        Node node1 = testData.createNode(14);
    143143        Node node2 = testData.createNode(15);
     
    159159     */
    160160    @Test
    161     public void testFillModifiedData() {
     161    void testFillModifiedData() {
    162162        Node node1 = testData.createNode(14);
    163163        Node node2 = testData.createNode(15);
     
    188188     */
    189189    @Test
    190     public void testDescription() {
     190    void testDescription() {
    191191        Node node1 = testData.createNode(14);
    192192        Node node2 = testData.createNode(15);
     
    252252     */
    253253    @Test
    254     public void testChildren() {
     254    void testChildren() {
    255255        Node node1 = testData.createNode(15);
    256256        Node node2 = testData.createNode(16);
     
    278278     */
    279279    @Test
    280     public void testEqualsContract() {
     280    void testEqualsContract() {
    281281        TestUtils.assumeWorkingEqualsVerifier();
    282282        EqualsVerifier.forClass(ChangePropertyCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangePropertyKeyCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    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;
     
    1111import java.util.Collection;
    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.TestUtils;
    1717import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    3030 * Unit tests of {@link ChangePropertyKeyCommand} class.
    3131 */
    32 public class ChangePropertyKeyCommandTest {
     32class ChangePropertyKeyCommandTest {
    3333
    3434    /**
    3535     * We need prefs for nodes.
    3636     */
    37     @Rule
     37    @RegisterExtension
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3939    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4343     * Set up the test data.
    4444     */
    45     @Before
     45    @BeforeEach
    4646    public void createTestData() {
    4747        testData = new CommandTestData();
     
    5252     */
    5353    @Test
    54     public void testChangeKeySingle() {
     54    void testChangeKeySingle() {
    5555        assertTrue(new ChangePropertyKeyCommand(testData.existingNode, "existing", "newKey").executeCommand());
    5656
     
    6464     */
    6565    @Test
    66     public void testChangeKey() {
     66    void testChangeKey() {
    6767        assertTrue(new ChangePropertyKeyCommand(Arrays.asList(testData.existingNode, testData.existingWay), "existing",
    6868                "newKey").executeCommand());
     
    8080     */
    8181    @Test
    82     public void testChangeKeyIgnored() {
     82    void testChangeKeyIgnored() {
    8383        Node node1 = testData.createNode(15);
    8484        node1.removeAll();
     
    109109     */
    110110    @Test
    111     public void testDescription() {
     111    void testDescription() {
    112112        Node node1 = testData.createNode(15);
    113113        node1.put("name", "xy");
     
    123123     */
    124124    @Test
    125     public void testChildren() {
     125    void testChildren() {
    126126        Node node1 = testData.createNode(15);
    127127        Node node2 = testData.createNode(16);
     
    149149     */
    150150    @Test
    151     public void testEqualsContract() {
     151    void testEqualsContract() {
    152152        TestUtils.assumeWorkingEqualsVerifier();
    153153        EqualsVerifier.forClass(ChangePropertyKeyCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertNull;
    8 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.util.ArrayList;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.TestUtils;
    1616import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    2929 * Unit tests of {@link ChangeRelationMemberRoleCommand} class.
    3030 */
    31 public class ChangeRelationMemberRoleCommandTest {
     31class ChangeRelationMemberRoleCommandTest {
    3232
    3333    /**
    3434     * We need prefs for nodes.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4242     * Set up the test data.
    4343     */
    44     @Before
     44    @BeforeEach
    4545    public void createTestData() {
    4646        testData = new CommandTestDataWithRelation();
     
    5151     */
    5252    @Test
    53     public void testRoleChanged() {
     53    void testRoleChanged() {
    5454        assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").executeCommand());
    5555        assertEquals("newRole", testData.existingRelation.getMember(0).getRole());
     
    6767     */
    6868    @Test
    69     public void testWrongIndex() {
     69    void testWrongIndex() {
    7070        // should be ignored
    7171        ChangeRelationMemberRoleCommand command1 = new ChangeRelationMemberRoleCommand(testData.existingRelation, -1, "newRole");
     
    8585     */
    8686    @Test
    87     public void testSameRole() {
     87    void testSameRole() {
    8888        // should be ignored
    8989        assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "node").executeCommand());
     
    9595     */
    9696    @Test
    97     public void testUndo() {
     97    void testUndo() {
    9898        ChangeRelationMemberRoleCommand command = new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole");
    9999        command.executeCommand();
     
    114114     */
    115115    @Test
    116     public void testFillModifiedData() {
     116    void testFillModifiedData() {
    117117        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    118118        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    128128     */
    129129    @Test
    130     public void testDescription() {
     130    void testDescription() {
    131131        testData.existingRelation.put("name", "xy");
    132132        assertTrue(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getDescriptionText()
     
    138138     */
    139139    @Test
    140     public void testChildren() {
     140    void testChildren() {
    141141        assertNull(new ChangeRelationMemberRoleCommand(testData.existingRelation, 0, "newRole").getChildren());
    142142    }
     
    146146     */
    147147    @Test
    148     public void testEqualsContract() {
     148    void testEqualsContract() {
    149149        TestUtils.assumeWorkingEqualsVerifier();
    150150        EqualsVerifier.forClass(ChangeRelationMemberRoleCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/CommandTest.java

    r13079 r17275  
    44import java.util.Arrays;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.data.coor.LatLon;
     
    3030     * We need prefs for nodes / data sets.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    3838     */
    3939    @Test
    40     public void testEqualsContract() {
     40    void testEqualsContract() {
    4141        TestUtils.assumeWorkingEqualsVerifier();
    4242        EqualsVerifier.forClass(Command.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/DeleteCommandTest.java

    r13616 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.util.ArrayList;
     
    1314import java.util.NoSuchElementException;
    1415
    15 import org.junit.Before;
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.BeforeEach;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1819import org.openstreetmap.josm.TestUtils;
    1920import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    3536 * Unit tests of {@link DeleteCommand} class.
    3637 */
    37 public class DeleteCommandTest {
     38class DeleteCommandTest {
    3839
    3940    /**
    4041     * We need prefs for nodes.
    4142     */
    42     @Rule
     43    @RegisterExtension
    4344    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4445    public JOSMTestRules test = new JOSMTestRules().preferences().i18n();
     
    4849     * Set up the test data.
    4950     */
    50     @Before
     51    @BeforeEach
    5152    public void createTestData() {
    5253        testData = new CommandTestDataWithRelation();
     
    5758     */
    5859    @Test
    59     public void testSimpleDelete() {
     60    void testSimpleDelete() {
    6061        Node node = testData.createNode(15);
    6162        assertTrue(testData.layer.data.allPrimitives().contains(node));
     
    7273     */
    7374    @Test
    74     public void testDeleteIgnoresReferences() {
     75    void testDeleteIgnoresReferences() {
    7576        assertTrue(testData.existingNode.getReferrers().contains(testData.existingRelation));
    7677        new DeleteCommand(testData.existingRelation).executeCommand();
     
    9293     * A delete should delete all objects with references to the deleted one
    9394     */
    94     @Test(expected = IllegalArgumentException.class)
    95     public void testDeleteFailsOnDelted() {
     95    @Test
     96    void testDeleteFailsOnDeleted() {
    9697        new DeleteCommand(testData.existingRelation).executeCommand();
    9798
    98         new DeleteCommand(testData.existingRelation).executeCommand();
     99        assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(testData.existingRelation).executeCommand());
    99100    }
    100101
     
    103104     */
    104105    @Test
    105     public void testReferredDelete() {
     106    void testReferredDelete() {
    106107        DeleteCommand.deleteWithReferences(Arrays.asList(testData.existingNode), true).executeCommand();
    107108
     
    115116     */
    116117    @Test
    117     public void testDeleteNodesInWay() {
     118    void testDeleteNodesInWay() {
    118119        testData.existingNode.removeAll();
    119120        // That untagged node should be deleted.
     
    152153     * Test that {@link DeleteCommand} checks for non-null.
    153154     */
    154     @Test(expected = IllegalArgumentException.class)
    155     public void testConsistency() {
    156         new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null));
     155    @Test
     156    void testConsistency() {
     157        assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay, null)));
    157158    }
    158159
     
    160161     * Test that {@link DeleteCommand} checks for the dataset
    161162     */
    162     @Test(expected = IllegalArgumentException.class)
    163     public void testConsistencyDataset() {
     163    @Test
     164    void testConsistencyDataset() {
    164165        testData.layer.getDataSet().removePrimitive(testData.existingNode);
    165         new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay));
     166        assertThrows(IllegalArgumentException.class, () -> new DeleteCommand(Arrays.asList(testData.existingNode, testData.existingWay)));
    166167    }
    167168
     
    169170     * Test that {@link DeleteCommand} checks for non-empty list
    170171     */
    171     @Test(expected = NoSuchElementException.class)
    172     public void testConsistencyNonEmpty() {
    173         new DeleteCommand(Arrays.<OsmPrimitive>asList());
     172    @Test
     173    void testConsistencyNonEmpty() {
     174        assertThrows(NoSuchElementException.class, () -> new DeleteCommand(Arrays.<OsmPrimitive>asList()));
    174175    }
    175176
     
    177178     * Test that {@link DeleteCommand} checks for non-null list
    178179     */
    179     @Test(expected = NullPointerException.class)
    180     public void testConsistencyNonNull() {
    181         new DeleteCommand((Collection<OsmPrimitive>) null);
     180    @Test
     181    void testConsistencyNonNull() {
     182        assertThrows(NullPointerException.class, () -> new DeleteCommand((Collection<OsmPrimitive>) null));
    182183    }
    183184
     
    186187     */
    187188    @Test
    188     public void testUndo() {
     189    void testUndo() {
    189190        DeleteCommand command = new DeleteCommand(
    190191                Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay));
     
    211212     */
    212213    @Test
    213     public void testDeleteWaySegment() {
     214    void testDeleteWaySegment() {
    214215        Way way1 = testData.createWay(100, testData.createNode(101), testData.createNode(102));
    215216        WaySegment ws = new WaySegment(way1, 0);
     
    225226     */
    226227    @Test
    227     public void testDeleteWaySegmentEndOfWay() {
     228    void testDeleteWaySegmentEndOfWay() {
    228229        Way way = testData.createWay(200, testData.createNode(201), testData.createNode(202), testData.createNode(203),
    229230                testData.createNode(204));
     
    243244     */
    244245    @Test
    245     public void testDeleteWaySegmentStartOfWay() {
     246    void testDeleteWaySegmentStartOfWay() {
    246247        Way way = testData.createWay(100, testData.createNode(101), testData.createNode(102), testData.createNode(103),
    247248                testData.createNode(104));
     
    261262     */
    262263    @Test
    263     public void testDeleteWaySegmentSplit() {
     264    void testDeleteWaySegmentSplit() {
    264265        Node node103 = testData.createNode(103);
    265266        Node node104 = testData.createNode(104);
     
    285286     */
    286287    @Test
    287     public void testDeleteWaySegmentCycle() {
     288    void testDeleteWaySegmentCycle() {
    288289        Node n = testData.createNode(101);
    289290        Way way = testData.createWay(100, n, testData.createNode(102), testData.createNode(103),
     
    304305     */
    305306    @Test
    306     public void testGetChildren() {
     307    void testGetChildren() {
    307308        testData.existingNode.put("name", "xy");
    308309        Collection<PseudoCommand> children = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingNode2))
     
    319320     */
    320321    @Test
    321     public void testFillModifiedData() {
     322    void testFillModifiedData() {
    322323        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    323324        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    334335     */
    335336    @Test
    336     public void testGetParticipatingPrimitives() {
     337    void testGetParticipatingPrimitives() {
    337338        DeleteCommand command = new DeleteCommand(Arrays.<OsmPrimitive>asList(testData.existingNode));
    338339        assertArrayEquals(new Object[] {testData.existingNode }, command.getParticipatingPrimitives().toArray());
     
    348349     */
    349350    @Test
    350     public void testDescription() {
     351    void testDescription() {
    351352        Node node = testData.createNode(100);
    352353        node.put("name", "xy");
     
    378379     */
    379380    @Test
    380     public void testEqualsContract() {
     381    void testEqualsContract() {
    381382        TestUtils.assumeWorkingEqualsVerifier();
    382383        EqualsVerifier.forClass(DeleteCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/MoveCommandTest.java

    r16968 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.ArrayList;
     
    1212import java.util.Set;
    1313
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    3434 * Unit tests of {@link MoveCommand} class.
    3535 */
    36 public class MoveCommandTest {
     36class MoveCommandTest {
    3737    /**
    3838     * We need prefs for nodes.
    3939     */
    40     @Rule
     40    @RegisterExtension
    4141    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4242    public JOSMTestRules test = new JOSMTestRules().preferences().i18n().projection();
     
    4646     * Set up the test data.
    4747     */
    48     @Before
     48    @BeforeEach
    4949    public void createTestData() {
    5050        testData = new CommandTestDataWithRelation();
     
    5555     */
    5656    @Test
    57     public void testConstructors() {
     57    void testConstructors() {
    5858        EastNorth offset = new EastNorth(1, 2);
    5959        LatLon destLatLon = ProjectionRegistry.getProjection().eastNorth2latlon(offset);
     
    7575        assertEquals(nodes, new ArrayList<>(Collections.<OsmPrimitive>singleton(testData.existingNode)));
    7676
    77         assertEquals("east", 1, moveCommand.getOffset().east(), 0.0001);
    78         assertEquals("north", 2, moveCommand.getOffset().north(), 0.0001);
    79         assertEquals("distance", 2.236068, moveCommand.getDistance(n -> true), 0.0001);
     77        assertEquals(1, moveCommand.getOffset().east(), 0.0001, "east");
     78        assertEquals(2, moveCommand.getOffset().north(), 0.0001, "north");
     79        assertEquals(2.236068, moveCommand.getDistance(n -> true), 0.0001, "distance");
    8080    }
    8181
     
    8484     */
    8585    @Test
    86     public void testSingleMove() {
     86    void testSingleMove() {
    8787        MoveCommand command = new MoveCommand(testData.existingNode, 1, 2);
    8888        testData.existingNode.setEastNorth(new EastNorth(3, 7));
    8989        command.executeCommand();
    90         assertEquals("east", 4, testData.existingNode.getEastNorth().east(), 0.0001);
    91         assertEquals("north", 9, testData.existingNode.getEastNorth().north(), 0.0001);
    92         assertEquals("distance", 2.236068, command.getDistance(n -> true), 0.0001);
     90        assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east");
     91        assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north");
     92        assertEquals(2.236068, command.getDistance(n -> true), 0.0001, "distance");
    9393    }
    9494
     
    9797     */
    9898    @Test
    99     public void testMultipleMove() {
     99    void testMultipleMove() {
    100100        MoveCommand command = new MoveCommand(
    101101                Arrays.asList(testData.existingNode, testData.existingNode2, testData.existingWay),
     
    106106        command.executeCommand();
    107107
    108         assertEquals("east", 4, testData.existingNode.getEastNorth().east(), 0.0001);
    109         assertEquals("north", 9, testData.existingNode.getEastNorth().north(), 0.0001);
    110         assertEquals("east", 5, testData.existingNode2.getEastNorth().east(), 0.0001);
    111         assertEquals("north", 9, testData.existingNode2.getEastNorth().north(), 0.0001);
     108        assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east");
     109        assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north");
     110        assertEquals(5, testData.existingNode2.getEastNorth().east(), 0.0001, "east");
     111        assertEquals(9, testData.existingNode2.getEastNorth().north(), 0.0001, "north");
    112112    }
    113113
     
    116116     */
    117117    @Test
    118     public void testMoveAgain() {
     118    void testMoveAgain() {
    119119        MoveCommand command = new MoveCommand(testData.existingNode, 1, 2);
    120         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    121         assertEquals("north", 2, command.getOffset().north(), 0.0001);
     120        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     121        assertEquals(2, command.getOffset().north(), 0.0001, "north");
    122122
    123123        command.moveAgain(1, 2);
    124         assertEquals("east", 2, command.getOffset().east(), 0.0001);
    125         assertEquals("north", 4, command.getOffset().north(), 0.0001);
     124        assertEquals(2, command.getOffset().east(), 0.0001, "east");
     125        assertEquals(4, command.getOffset().north(), 0.0001, "north");
    126126
    127127        command.moveAgain(-9, -3);
    128         assertEquals("east", -7, command.getOffset().east(), 0.0001);
    129         assertEquals("north", 1, command.getOffset().north(), 0.0001);
     128        assertEquals(-7, command.getOffset().east(), 0.0001, "east");
     129        assertEquals(1, command.getOffset().north(), 0.0001, "north");
    130130
    131131        command.moveAgainTo(1, 2);
    132         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    133         assertEquals("north", 2, command.getOffset().north(), 0.0001);
     132        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     133        assertEquals(2, command.getOffset().north(), 0.0001, "north");
    134134    }
    135135
     
    138138     */
    139139    @Test
    140     public void testCheckpoint() {
     140    void testCheckpoint() {
    141141        MoveCommand command = new MoveCommand(testData.existingNode, 2, 4);
    142         assertEquals("east", 2, command.getOffset().east(), 0.0001);
    143         assertEquals("north", 4, command.getOffset().north(), 0.0001);
     142        assertEquals(2, command.getOffset().east(), 0.0001, "east");
     143        assertEquals(4, command.getOffset().north(), 0.0001, "north");
    144144
    145145        command.saveCheckpoint();
    146146        command.moveAgain(3, 7);
    147         assertEquals("east", 5, command.getOffset().east(), 0.0001);
    148         assertEquals("north", 11, command.getOffset().north(), 0.0001);
     147        assertEquals(5, command.getOffset().east(), 0.0001, "east");
     148        assertEquals(11, command.getOffset().north(), 0.0001, "north");
    149149
    150150        command.resetToCheckpoint();
    151         assertEquals("east", 2, command.getOffset().east(), 0.0001);
    152         assertEquals("north", 4, command.getOffset().north(), 0.0001);
     151        assertEquals(2, command.getOffset().east(), 0.0001, "east");
     152        assertEquals(4, command.getOffset().north(), 0.0001, "north");
    153153    }
    154154
     
    157157     */
    158158    @Test
    159     public void testStartPoint() {
     159    void testStartPoint() {
    160160        EastNorth start = new EastNorth(10, 20);
    161161        MoveCommand command = new MoveCommand(testData.existingNode, start, start.add(1, 2));
    162         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    163         assertEquals("north", 2, command.getOffset().north(), 0.0001);
     162        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     163        assertEquals(2, command.getOffset().north(), 0.0001, "north");
    164164
    165165        command.applyVectorTo(start.add(3, 4));
    166         assertEquals("east", 3, command.getOffset().east(), 0.0001);
    167         assertEquals("north", 4, command.getOffset().north(), 0.0001);
     166        assertEquals(3, command.getOffset().east(), 0.0001, "east");
     167        assertEquals(4, command.getOffset().north(), 0.0001, "north");
    168168
    169169        // set to 100, 200
    170170        command.changeStartPoint(new EastNorth(103, 204));
    171171        command.applyVectorTo(new EastNorth(101, 202));
    172         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    173         assertEquals("north", 2, command.getOffset().north(), 0.0001);
     172        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     173        assertEquals(2, command.getOffset().north(), 0.0001, "north");
    174174    }
    175175
     
    178178     */
    179179    @Test
    180     public void testNoStartPoint() {
     180    void testNoStartPoint() {
    181181        MoveCommand command = new MoveCommand(testData.existingNode, 1, 0);
    182182        // ignored
    183183        command.applyVectorTo(new EastNorth(3, 4));
    184         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    185         assertEquals("north", 0, command.getOffset().north(), 0.0001);
     184        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     185        assertEquals(0, command.getOffset().north(), 0.0001, "north");
    186186
    187187        // set to 100, 200
     
    189189        // works
    190190        command.applyVectorTo(new EastNorth(101, 202));
    191         assertEquals("east", 1, command.getOffset().east(), 0.0001);
    192         assertEquals("north", 2, command.getOffset().north(), 0.0001);
     191        assertEquals(1, command.getOffset().east(), 0.0001, "east");
     192        assertEquals(2, command.getOffset().north(), 0.0001, "north");
    193193    }
    194194
     
    197197     */
    198198    @Test
    199     public void testUndo() {
     199    void testUndo() {
    200200        testData.existingNode.setEastNorth(new EastNorth(3, 7));
    201201        MoveCommand command = new MoveCommand(testData.existingNode, 1, 2);
    202202        command.executeCommand();
    203         assertEquals("east", 4, testData.existingNode.getEastNorth().east(), 0.0001);
    204         assertEquals("north", 9, testData.existingNode.getEastNorth().north(), 0.0001);
     203        assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east");
     204        assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north");
    205205
    206206        command.undoCommand();
    207         assertEquals("east", 3, testData.existingNode.getEastNorth().east(), 0.0001);
    208         assertEquals("north", 7, testData.existingNode.getEastNorth().north(), 0.0001);
    209 
    210         command.executeCommand();
    211         assertEquals("east", 4, testData.existingNode.getEastNorth().east(), 0.0001);
    212         assertEquals("north", 9, testData.existingNode.getEastNorth().north(), 0.0001);
     207        assertEquals(3, testData.existingNode.getEastNorth().east(), 0.0001, "east");
     208        assertEquals(7, testData.existingNode.getEastNorth().north(), 0.0001, "north");
     209
     210        command.executeCommand();
     211        assertEquals(4, testData.existingNode.getEastNorth().east(), 0.0001, "east");
     212        assertEquals(9, testData.existingNode.getEastNorth().north(), 0.0001, "north");
    213213    }
    214214
     
    217217     */
    218218    @Test
    219     public void testFillModifiedData() {
     219    void testFillModifiedData() {
    220220        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    221221        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    232232     */
    233233    @Test
    234     public void testGetParticipatingPrimitives() {
     234    void testGetParticipatingPrimitives() {
    235235        MoveCommand command = new MoveCommand(Arrays.<OsmPrimitive>asList(testData.existingNode), 1, 2);
    236236        command.executeCommand();
     
    248248     */
    249249    @Test
    250     public void testDescription() {
     250    void testDescription() {
    251251        Node node = TestUtils.addFakeDataSet(new Node(LatLon.ZERO));
    252252        node.put("name", "xy");
     
    261261     */
    262262    @Test
    263     public void testEqualsContract() {
     263    void testEqualsContract() {
    264264        TestUtils.assumeWorkingEqualsVerifier();
    265265        EqualsVerifier.forClass(MoveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/PurgeCommandTest.java

    r13616 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    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;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     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;
    1010
    1111import java.util.ArrayList;
     
    1313import java.util.List;
    1414
    15 import org.junit.Before;
    16 import org.junit.Rule;
    17 import org.junit.Test;
     15import org.junit.jupiter.api.BeforeEach;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    3737 * Unit tests of {@link PurgeCommand} class.
    3838 */
    39 public class PurgeCommandTest {
     39class PurgeCommandTest {
    4040    /**
    4141     * We need prefs for nodes.
    4242     */
    43     @Rule
     43    @RegisterExtension
    4444    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4545    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4949     * Set up the test data.
    5050     */
    51     @Before
     51    @BeforeEach
    5252    public void createTestData() {
    5353        testData = new CommandTestDataWithRelation();
     
    5858     */
    5959    @Test
    60     public void testExecute() {
     60    void testExecute() {
    6161        Relation relationParent = testData.createRelation(100, new RelationMember("child", testData.existingRelation));
    6262        Relation relationParent2 = testData.createRelation(101, new RelationMember("child", testData.existingRelation));
     
    8383     */
    8484    @Test
    85     public void testUndo() {
     85    void testUndo() {
    8686        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(),
    8787                Arrays.<OsmPrimitive>asList(testData.existingNode, testData.existingWay),
     
    104104     */
    105105    @Test
    106     public void testFillModifiedData() {
     106    void testFillModifiedData() {
    107107        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    108108        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    121121     */
    122122    @Test
    123     public void testGetParticipatingPrimitives() {
     123    void testGetParticipatingPrimitives() {
    124124        PurgeCommand command = new PurgeCommand(testData.layer.getDataSet(), Arrays.<OsmPrimitive>asList(testData.existingNode),
    125125                Arrays.<OsmPrimitive>asList(testData.existingRelation));
     
    131131     */
    132132    @Test
    133     public void testDescription() {
     133    void testDescription() {
    134134        List<OsmPrimitive> shortList = Arrays.<OsmPrimitive>asList(testData.existingWay);
    135135        assertTrue(new PurgeCommand(testData.layer.getDataSet(), shortList, Arrays.<OsmPrimitive>asList()).getDescriptionText()
     
    145145     */
    146146    @Test
    147     public void testEqualsContract() {
     147    void testEqualsContract() {
    148148        TestUtils.assumeWorkingEqualsVerifier();
    149149        EqualsVerifier.forClass(PurgeCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/RemoveNodesCommandTest.java

    r15013 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.ArrayList;
    99import java.util.Collections;
    1010
    11 import org.junit.Before;
    12 import org.junit.Rule;
    13 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeEach;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    2828 * Unit tests of {@link RemoveNodesCommand} class.
    2929 */
    30 public class RemoveNodesCommandTest {
     30class RemoveNodesCommandTest {
    3131
    3232    /**
    3333     * We need prefs for nodes.
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4141     * Set up the test data.
    4242     */
    43     @Before
     43    @BeforeEach
    4444    public void createTestData() {
    4545        testData = new CommandTestDataWithRelation();
     
    5050     */
    5151    @Test
    52     public void testExecute() {
     52    void testExecute() {
    5353        RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay,
    5454                Collections.singleton(testData.existingNode));
     
    6565     */
    6666    @Test
    67     public void testUndo() {
     67    void testUndo() {
    6868        RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay,
    6969                Collections.singleton(testData.existingNode));
     
    8787     */
    8888    @Test
    89     public void testFillModifiedData() {
     89    void testFillModifiedData() {
    9090        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    9191        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    103103     */
    104104    @Test
    105     public void testGetParticipatingPrimitives() {
     105    void testGetParticipatingPrimitives() {
    106106        RemoveNodesCommand command = new RemoveNodesCommand(testData.existingWay,
    107107                Collections.singleton(testData.existingNode));
     
    114114     */
    115115    @Test
    116     public void testDescription() {
     116    void testDescription() {
    117117        assertTrue(new RemoveNodesCommand(testData.existingWay, Collections.singleton(testData.existingNode))
    118118                .getDescriptionText().matches("Removed nodes from .*"));
     
    123123     */
    124124    @Test
    125     public void testEqualsContract() {
     125    void testEqualsContract() {
    126126        TestUtils.assumeWorkingEqualsVerifier();
    127127        EqualsVerifier.forClass(RemoveNodesCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/RotateCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    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.util.ArrayList;
    88import java.util.Arrays;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2929 * Unit tests of {@link RotateCommand} class.
    3030 */
    31 public class RotateCommandTest {
     31class RotateCommandTest {
    3232
    3333    /**
    3434     * We need prefs for nodes.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    4242     * Set up the test data.
    4343     */
    44     @Before
     44    @BeforeEach
    4545    public void createTestData() {
    4646        testData = new CommandTestData();
     
    5151     */
    5252    @Test
    53     public void testRotate() {
     53    void testRotate() {
    5454        // pivot needs to be at 0,0
    5555        Node n1 = new Node(new EastNorth(10, 10));
     
    7171     */
    7272    @Test
    73     public void testUndo() {
     73    void testUndo() {
    7474        Node n1 = new Node(new EastNorth(10, 10));
    7575        Node n2 = new Node(new EastNorth(-1, 0));
     
    9696     */
    9797    @Test
    98     public void testFillModifiedData() {
     98    void testFillModifiedData() {
    9999        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    100100        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    113113     */
    114114    @Test
    115     public void testGetParticipatingPrimitives() {
     115    void testGetParticipatingPrimitives() {
    116116        RotateCommand command = new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
    117117        command.executeCommand();
     
    123123     */
    124124    @Test
    125     public void testDescription() {
     125    void testDescription() {
    126126        assertEquals("Rotate 1 node",
    127127                new RotateCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
     
    136136     */
    137137    @Test
    138     public void testEqualsContract() {
     138    void testEqualsContract() {
    139139        TestUtils.assumeWorkingEqualsVerifier();
    140140        EqualsVerifier.forClass(RotateCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/ScaleCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    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.util.ArrayList;
    88import java.util.Arrays;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2929 * Unit tests of {@link ScaleCommand} class.
    3030 */
    31 public class ScaleCommandTest {
     31class ScaleCommandTest {
    3232
    3333    /**
    3434     * We need prefs for nodes.
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    4242     * Set up the test data.
    4343     */
    44     @Before
     44    @BeforeEach
    4545    public void createTestData() {
    4646        testData = new CommandTestData();
     
    5151     */
    5252    @Test
    53     public void testScale() {
     53    void testScale() {
    5454        // pivot needs to be at 0,0
    5555        Node n1 = new Node(new EastNorth(10, 10));
     
    7171     */
    7272    @Test
    73     public void testUndo() {
     73    void testUndo() {
    7474        Node n1 = new Node(new EastNorth(10, 10));
    7575        Node n2 = new Node(new EastNorth(-1, 0));
     
    9696     */
    9797    @Test
    98     public void testFillModifiedData() {
     98    void testFillModifiedData() {
    9999        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    100100        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    113113     */
    114114    @Test
    115     public void testGetParticipatingPrimitives() {
     115    void testGetParticipatingPrimitives() {
    116116        ScaleCommand command = new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0));
    117117        command.executeCommand();
     
    123123     */
    124124    @Test
    125     public void testDescription() {
     125    void testDescription() {
    126126        assertEquals("Scale 1 node",
    127127                new ScaleCommand(Arrays.asList(testData.existingNode), new EastNorth(0, 0))
     
    136136     */
    137137    @Test
    138     public void testEqualsContract() {
     138    void testEqualsContract() {
    139139        TestUtils.assumeWorkingEqualsVerifier();
    140140        EqualsVerifier.forClass(ScaleCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/SelectCommandTest.java

    r15324 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     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.ArrayList;
     
    1011import java.util.List;
    1112
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeEach;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1516import org.openstreetmap.josm.TestUtils;
    1617import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    2829 * Unit tests of {@link SelectCommand} class.
    2930 */
    30 public class SelectCommandTest {
     31class SelectCommandTest {
    3132
    3233    /**
    3334     * We need prefs for nodes.
    3435     */
    35     @Rule
     36    @RegisterExtension
    3637    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3738    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4142     * Set up the test data.
    4243     */
    43     @Before
     44    @BeforeEach
    4445    public void createTestData() {
    4546        testData = new CommandTestDataWithRelation();
     
    5051     */
    5152    @Test
    52     public void testExecute() {
     53    void testExecute() {
    5354        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay));
    5455
     
    6667     */
    6768    @Test
    68     public void testExecuteAfterModify() {
     69    void testExecuteAfterModify() {
    6970        List<OsmPrimitive> list = new ArrayList<>(Arrays.asList(testData.existingNode, testData.existingWay));
    7071        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), list);
     
    8485     */
    8586    @Test
    86     public void testUndo() {
     87    void testUndo() {
    8788        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode, testData.existingWay));
    8889        testData.layer.getDataSet().setSelected(Arrays.asList(testData.existingNode2));
     
    107108     */
    108109    @Test
    109     public void testFillModifiedData() {
     110    void testFillModifiedData() {
    110111        ArrayList<OsmPrimitive> modified = new ArrayList<>();
    111112        ArrayList<OsmPrimitive> deleted = new ArrayList<>();
     
    123124     */
    124125    @Test
    125     public void testGetParticipatingPrimitives() {
     126    void testGetParticipatingPrimitives() {
    126127        SelectCommand command = new SelectCommand(testData.layer.getDataSet(), Arrays.asList(testData.existingNode));
    127128        command.executeCommand();
     
    133134     */
    134135    @Test
    135     public void testDescription() {
     136    void testDescription() {
    136137        DataSet ds = testData.layer.getDataSet();
    137138        assertTrue(new SelectCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode))
     
    149150     */
    150151    @Test
    151     public void testEqualsContract() {
     152    void testEqualsContract() {
    152153        TestUtils.assumeWorkingEqualsVerifier();
    153154        EqualsVerifier.forClass(SelectCommand.class).usingGetClass()
     
    165166     * Unit test of {@link SelectCommand#SelectCommand}.
    166167     */
    167     @Test(expected = IllegalArgumentException.class)
    168     public void testConstructorIAE() {
    169         new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null}));
     168    @Test
     169    void testConstructorIAE() {
     170        assertThrows(IllegalArgumentException.class, () -> new SelectCommand(new DataSet(), Arrays.asList(new OsmPrimitive[] {null})));
    170171    }
    171172}
  • trunk/test/unit/org/openstreetmap/josm/command/SequenceCommandTest.java

    r17087 r17275  
    22package org.openstreetmap.josm.command;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertNotSame;
    8 import static org.junit.Assert.assertNull;
    9 import static org.junit.Assert.assertSame;
    10 import static org.junit.Assert.assertTrue;
    11 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertNotSame;
     8import static org.junit.jupiter.api.Assertions.assertNull;
     9import static org.junit.jupiter.api.Assertions.assertSame;
    1210import static org.junit.jupiter.api.Assertions.assertThrows;
     11import static org.junit.jupiter.api.Assertions.assertTrue;
     12import static org.junit.jupiter.api.Assertions.fail;
    1313
    1414import java.io.PrintWriter;
     
    1919import java.util.Collections;
    2020
    21 import org.junit.Before;
    22 import org.junit.Rule;
    23 import org.junit.Test;
     21import org.junit.jupiter.api.BeforeEach;
     22import org.junit.jupiter.api.Test;
     23import org.junit.jupiter.api.extension.RegisterExtension;
    2424import org.openstreetmap.josm.TestUtils;
    2525import org.openstreetmap.josm.command.CommandTest.CommandTestDataWithRelation;
     
    3939 * Unit tests of {@link SequenceCommand} class.
    4040 */
    41 public class SequenceCommandTest {
     41class SequenceCommandTest {
    4242
    4343    /**
    4444     * We need prefs for nodes.
    4545     */
    46     @Rule
     46    @RegisterExtension
    4747    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4848    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    5252     * Set up the test data.
    5353     */
    54     @Before
     54    @BeforeEach
    5555    public void createTestData() {
    5656        testData = new CommandTestDataWithRelation();
     
    6161     */
    6262    @Test
    63     public void testExecute() {
     63    void testExecute() {
    6464        DataSet ds = new DataSet();
    6565        final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
     
    8383     */
    8484    @Test
    85     public void testUndo() {
     85    void testUndo() {
    8686        DataSet ds = new DataSet();
    8787        final TestCommand command2 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode2));
     
    112112     */
    113113    @Test
    114     public void testExecuteRollback() {
     114    void testExecuteRollback() {
    115115        DataSet ds = new DataSet();
    116116        TestCommand command1 = new TestCommand(ds, null);
     
    129129     */
    130130    @Test
    131     public void testContinueOnErrors() {
     131    void testContinueOnErrors() {
    132132        DataSet ds = new DataSet();
    133133        TestCommand command1 = new TestCommand(ds, null);
     
    148148     */
    149149    @Test
    150     public void testGetLastCommand() {
     150    void testGetLastCommand() {
    151151        DataSet ds = new DataSet();
    152152        final TestCommand command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
     
    161161     */
    162162    @Test
    163     public void testFillModifiedData() {
     163    void testFillModifiedData() {
    164164        DataSet ds = new DataSet();
    165165        Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
     
    194194     */
    195195    @Test
    196     public void testGetParticipatingPrimitives() {
     196    void testGetParticipatingPrimitives() {
    197197        DataSet ds = new DataSet();
    198198        Command command1 = new TestCommand(ds, Arrays.<OsmPrimitive>asList(testData.existingNode));
     
    211211     */
    212212    @Test
    213     public void testDescription() {
     213    void testDescription() {
    214214        assertTrue(new SequenceCommand(new DataSet(), "test", Collections.emptyList(), false).getDescriptionText().matches("Sequence: test"));
    215215    }
     
    219219     */
    220220    @Test
    221     public void testEqualsContract() {
     221    void testEqualsContract() {
    222222        DataSet ds = new DataSet();
    223223        TestUtils.assumeWorkingEqualsVerifier();
     
    263263        @Override
    264264        public boolean executeCommand() {
    265             assertFalse("Cannot execute twice", executed);
     265            assertFalse(executed, "Cannot execute twice");
    266266            executed = true;
    267267            return true;
     
    270270        @Override
    271271        public void undoCommand() {
    272             assertTrue("Cannot undo without execute", executed);
     272            assertTrue(executed, "Cannot undo without execute");
    273273            executed = false;
    274274        }
     
    295295        @Override
    296296        public void undoCommand() {
    297             assertTrue("Cannot undo without execute", executed);
     297            assertTrue(executed, "Cannot undo without execute");
    298298            executed = false;
    299299        }
     
    309309     */
    310310    @Test
    311     public void testWrapIfNeeded() {
     311    void testWrapIfNeeded() {
    312312        DataSet ds = new DataSet();
    313313        TestCommand command1 = new TestCommand(ds, Collections.<OsmPrimitive>singletonList(testData.existingNode));
     
    322322     */
    323323    @Test
    324     public void testCreateReportedException() {
     324    void testCreateReportedException() {
    325325        DataSet ds = new DataSet();
    326326        Command c1 = new TestCommand(ds, Collections.emptyList()) {
  • trunk/test/unit/org/openstreetmap/josm/command/SplitWayCommandTest.java

    r16782 r17275  
    22package org.openstreetmap.josm.command;
    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;
     
    1414import java.util.Optional;
    1515
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.command.SplitWayCommand.Strategy;
     
    3636 * Unit tests for class {@link SplitWayCommand}.
    3737 */
    38 public final class SplitWayCommandTest {
     38final class SplitWayCommandTest {
    3939
    4040    /**
    4141     * Setup test.
    4242     */
    43     @Rule
     43    @RegisterExtension
    4444    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4545    public JOSMTestRules test = new JOSMTestRules().main().projection().preferences();
     
    4949     */
    5050    @Test
    51     public void testFindVias() {
     51    void testFindVias() {
    5252        // empty relation
    5353        assertTrue(SplitWayCommand.findVias(new Relation(), null).isEmpty());
     
    8181     */
    8282    @Test
    83     public void testRouteRelation() {
     83    void testRouteRelation() {
    8484        doTestRouteRelation(false, 0);
    8585        doTestRouteRelation(false, 1);
     
    149149
    150150    @Test
    151     public void testOneMemberOrderedRelationShowsWarningTest() {
     151    void testOneMemberOrderedRelationShowsWarningTest() {
    152152        final DataSet dataSet = new DataSet();
    153153
     
    188188
    189189    @Test
    190     public void testDoIncompleteMembersOrderedRelationCorrectOrderTest() {
     190    void testDoIncompleteMembersOrderedRelationCorrectOrderTest() {
    191191        for (int i = 0; i < 2; i++) {
    192192            // All these permutations should result in a split that keeps the new parts in order.
     
    244244
    245245    static void assertFirstLastNodeIs(Way way, Node node) {
    246         assertTrue("First/last node of " + way + " should be " + node, node.equals(way.firstNode()) || node.equals(way.lastNode()));
     246        assertTrue(node.equals(way.firstNode()) || node.equals(way.lastNode()),
     247                "First/last node of " + way + " should be " + node);
    247248    }
    248249
     
    253254        Node last2 = two.lastNode();
    254255
    255         assertTrue("Ways expected to be connected at their ends.",
    256                 first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2);
     256        assertTrue(first1 == first2 || first1 == last2 || last1 == first2 || last1 == last2,
     257                "Ways expected to be connected at their ends.");
    257258    }
    258259
     
    263264     */
    264265    @Test
    265     public void testTicket18596() throws IOException, IllegalDataException {
     266    void testTicket18596() throws IOException, IllegalDataException {
    266267        try (InputStream is = TestUtils.getRegressionDataStream(18596, "data.osm")) {
    267268            DataSet ds = OsmReader.parseDataSet(is, null);
     
    280281            Relation relation = (Relation) ds.getPrimitiveById(8888, OsmPrimitiveType.RELATION);
    281282
    282             assertEquals(relation.getMembersCount(), 8);
     283            assertEquals(8, relation.getMembersCount());
    283284
    284285            // Before the patch introduced in #18596, these asserts would fail. The two parts of
     
    299300     */
    300301    @Test
    301     public void testTicket17400() throws IOException, IllegalDataException {
     302    void testTicket17400() throws IOException, IllegalDataException {
    302303        try (InputStream is = TestUtils.getRegressionDataStream(17400, "data.osm")) {
    303304            DataSet ds = OsmReader.parseDataSet(is, null);
     
    323324
    324325            // One more than the original 161.
    325             assertEquals(relation.getMembersCount(), 162);
     326            assertEquals(162, relation.getMembersCount());
    326327
    327328            // Before the patch introduced in #18596, these asserts would fail. The new parts of
     
    347348     */
    348349    @Test
    349     public void testTicket18863() throws IOException, IllegalDataException {
     350    void testTicket18863() throws IOException, IllegalDataException {
    350351        try (InputStream is = TestUtils.getRegressionDataStream(18863, "data.osm.bz2")) {
    351352            DataSet ds = OsmReader.parseDataSet(is, null);
     
    375376     */
    376377    @Test
    377     public void testTicket19432() throws IOException, IllegalDataException {
     378    void testTicket19432() throws IOException, IllegalDataException {
    378379        try (InputStream is = TestUtils.getRegressionDataStream(19432, "josm_split_way_exception_example.osm.bz2")) {
    379380            DataSet ds = OsmReader.parseDataSet(is, null);
  • trunk/test/unit/org/openstreetmap/josm/command/TransformNodesCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command;
    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;
     
    1818 * Unit tests of {@link TransformNodesCommand} class.
    1919 */
    20 public class TransformNodesCommandTest {
     20class TransformNodesCommandTest {
    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 testEqualsContract() {
     33    void testEqualsContract() {
    3434        TestUtils.assumeWorkingEqualsVerifier();
    3535        EqualsVerifier.forClass(TransformNodesCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictAddCommandTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.command.conflict;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     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.TestUtils;
    1212import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2626 * Unit tests of {@link ConflictAddCommand} class.
    2727 */
    28 public class ConflictAddCommandTest {
     28class ConflictAddCommandTest {
    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();
     
    3939     * Setup test.
    4040     */
    41     @Before
     41    @BeforeEach
    4242    public void setUp() {
    4343        testData = new CommandTestData();
     
    4848     */
    4949    @Test
    50     public void testExecuteUndoCommand() {
     50    void testExecuteUndoCommand() {
    5151        DataSet ds = testData.layer.getDataSet();
    5252        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
     
    6464     */
    6565    @Test
    66     public void testGetDescriptionIcon() {
     66    void testGetDescriptionIcon() {
    6767        Conflict<Node> conflict = new Conflict<>(testData.existingNode, testData.existingNode2);
    6868        assertNotNull(new ConflictAddCommand(testData.layer.getDataSet(), conflict).getDescriptionIcon());
     
    7373     */
    7474    @Test
    75     public void testEqualsContract() {
     75    void testEqualsContract() {
    7676        TestUtils.assumeWorkingEqualsVerifier();
    7777        EqualsVerifier.forClass(ConflictAddCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ConflictResolveCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    1919 * Unit tests of {@link ConflictResolveCommand} class.
    2020 */
    21 public class ConflictResolveCommandTest {
     21class ConflictResolveCommandTest {
    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(ConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/CoordinateConflictResolveCommandTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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
    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.TestUtils;
    1212import org.openstreetmap.josm.command.CommandTest.CommandTestData;
     
    2828 * Unit tests of {@link CoordinateConflictResolveCommand} class.
    2929 */
    30 public class CoordinateConflictResolveCommandTest {
     30class CoordinateConflictResolveCommandTest {
    3131
    3232    private CommandTestData testData;
     
    3535     * Setup test.
    3636     */
    37     @Rule
     37    @RegisterExtension
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3939    public JOSMTestRules test = new JOSMTestRules();
     
    4242     * Setup test.
    4343     */
    44     @Before
     44    @BeforeEach
    4545    public void setUp() {
    4646        testData = new CommandTestData();
     
    5555     */
    5656    @Test
    57     public void testExecuteKeepMineUndoCommand() {
     57    void testExecuteKeepMineUndoCommand() {
    5858        Conflict<Node> conflict = createConflict();
    5959        CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_MINE);
     
    6868     */
    6969    @Test
    70     public void testExecuteKeepTheirUndoCommand() {
     70    void testExecuteKeepTheirUndoCommand() {
    7171        Conflict<Node> conflict = createConflict();
    7272        CoordinateConflictResolveCommand cmd = new CoordinateConflictResolveCommand(conflict, MergeDecisionType.KEEP_THEIR);
     
    8181     */
    8282    @Test
    83     public void testGetDescriptionIcon() {
     83    void testGetDescriptionIcon() {
    8484        Conflict<Node> conflict = createConflict();
    8585        assertNotNull(new CoordinateConflictResolveCommand(conflict, null).getDescriptionIcon());
     
    9090     */
    9191    @Test
    92     public void testEqualsContract() {
     92    void testEqualsContract() {
    9393        TestUtils.assumeWorkingEqualsVerifier();
    9494        EqualsVerifier.forClass(CoordinateConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/DeletedStateConflictResolveCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link DeletedStateConflictResolveCommand} class.
    2121 */
    22 public class DeletedStateConflictResolveCommandTest {
     22class DeletedStateConflictResolveCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(DeletedStateConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/ModifiedConflictResolveCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link ModifiedConflictResolveCommand} class.
    2121 */
    22 public class ModifiedConflictResolveCommandTest {
     22class ModifiedConflictResolveCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(ModifiedConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/RelationMemberConflictResolverCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link RelationMemberConflictResolverCommand} class.
    2121 */
    22 public class RelationMemberConflictResolverCommandTest {
     22class RelationMemberConflictResolverCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(RelationMemberConflictResolverCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/TagConflictResolveCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link TagConflictResolveCommand} class.
    2121 */
    22 public class TagConflictResolveCommandTest {
     22class TagConflictResolveCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(TagConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/VersionConflictResolveCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link VersionConflictResolveCommand} class.
    2121 */
    22 public class VersionConflictResolveCommandTest {
     22class VersionConflictResolveCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(VersionConflictResolveCommand.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/command/conflict/WayNodesConflictResolverCommandTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.command.conflict;
    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.conflict.Conflict;
     
    2020 * Unit tests of {@link WayNodesConflictResolverCommand} class.
    2121 */
    22 public class WayNodesConflictResolverCommandTest {
     22class WayNodesConflictResolverCommandTest {
    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 testEqualsContract() {
     35    void testEqualsContract() {
    3636        TestUtils.assumeWorkingEqualsVerifier();
    3737        EqualsVerifier.forClass(WayNodesConflictResolverCommand.class).usingGetClass()
  • 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    }
  • trunk/test/unit/org/openstreetmap/josm/gui/ConditionalOptionPaneUtilTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui;
    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 of {@link ConditionalOptionPaneUtil} class.
    1313 */
    14 public class ConditionalOptionPaneUtilTest {
     14class ConditionalOptionPaneUtilTest {
    1515
    1616    /**
    1717     * Setup rule
    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(ConditionalOptionPaneUtil.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/ExceptionDialogUtilTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui;
    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 of {@link ExceptionDialogUtil} class.
    1313 */
    14 public class ExceptionDialogUtilTest {
     14class ExceptionDialogUtilTest {
    1515
    1616    /**
    1717     * Setup rule
    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(ExceptionDialogUtil.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r16874 r17275  
    22package org.openstreetmap.josm.gui;
    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;
    99import static org.junit.Assume.assumeFalse;
    1010
     
    2727import javax.swing.UIManager;
    2828
    29 import org.junit.Rule;
    30 import org.junit.Test;
     29import org.junit.jupiter.api.Test;
     30import org.junit.jupiter.api.extension.RegisterExtension;
    3131import org.openstreetmap.josm.TestUtils;
    3232import org.openstreetmap.josm.actions.JosmAction;
     
    5858     * Setup test.
    5959     */
    60     @Rule
     60    @RegisterExtension
    6161    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6262    public JOSMTestRules test = new JOSMTestRules().main().projection().https().devAPI().timeout(20000);
     
    133133     */
    134134    @Test
    135     public void testShowVersion() throws Exception {
     135    void testShowVersion() throws Exception {
    136136        testShow("--version", Version.getInstance().getAgentString());
    137137    }
     
    142142     */
    143143    @Test
    144     public void testShowHelp() throws Exception {
     144    void testShowHelp() throws Exception {
    145145        testShow("--help", MainApplication.getHelp().trim());
    146146    }
     
    150150     */
    151151    @Test
    152     public void testParamType() {
     152    void testParamType() {
    153153        assertEquals(DownloadParamType.bounds, DownloadParamType.paramType("48.000,16.000,48.001,16.001"));
    154154        assertEquals(DownloadParamType.fileName, DownloadParamType.paramType("data.osm"));
     
    164164     */
    165165    @Test
    166     public void testUpdateAndLoadPlugins() throws PluginListParseException {
     166    void testUpdateAndLoadPlugins() throws PluginListParseException {
    167167        final String old = System.getProperty("josm.plugins");
    168168        try {
     
    196196     */
    197197    @Test
    198     public void testSetupUIManager() {
     198    void testSetupUIManager() {
    199199        assumeFalse(PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR")));
    200200        MainApplication.setupUIManager();
     
    212212     */
    213213    @Test
    214     public void testPostConstructorProcessCmdLineEmpty() {
     214    void testPostConstructorProcessCmdLineEmpty() {
    215215        // Check the method accepts no arguments
    216216        MainApplication.postConstructorProcessCmdLine(new ProgramArguments(new String[0]));
     
    245245     */
    246246    @Test
    247     public void testPostConstructorProcessCmdLineBounds() {
     247    void testPostConstructorProcessCmdLineBounds() {
    248248        doTestPostConstructorProcessCmdLine(
    249249                "-47.20,-126.75,-47.10,-126.65",
     
    256256     */
    257257    @Test
    258     public void testPostConstructorProcessCmdLineHttpUrl() {
     258    void testPostConstructorProcessCmdLineHttpUrl() {
    259259        doTestPostConstructorProcessCmdLine(
    260260                "https://api06.dev.openstreetmap.org/api/0.6/map?bbox=-126.75,-47.20,-126.65,-47.10",
     
    267267     */
    268268    @Test
    269     public void testPostConstructorProcessCmdLineFileUrl() throws MalformedURLException {
     269    void testPostConstructorProcessCmdLineFileUrl() throws MalformedURLException {
    270270        doTestPostConstructorProcessCmdLine(
    271271                Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toUri().toURL().toExternalForm(),
     
    278278     */
    279279    @Test
    280     public void testPostConstructorProcessCmdLineFilename() throws MalformedURLException {
     280    void testPostConstructorProcessCmdLineFilename() throws MalformedURLException {
    281281        doTestPostConstructorProcessCmdLine(
    282282                Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toFile().getAbsolutePath(),
     
    288288     */
    289289    @Test
    290     public void testGetRegisteredActionShortcut() {
     290    void testGetRegisteredActionShortcut() {
    291291        Shortcut noKeystroke = Shortcut.registerShortcut("no", "keystroke", 0, 0);
    292292        assertNull(noKeystroke.getKeyStroke());
     
    303303     */
    304304    @Test
    305     public void testMapFrameListener() {
     305    void testMapFrameListener() {
    306306        MapFrameListener listener = (o, n) -> { };
    307307        assertTrue(MainApplication.addMapFrameListener(listener));
     
    315315     */
    316316    @Test
    317     public void testEnumDownloadParamType() {
     317    void testEnumDownloadParamType() {
    318318        TestUtils.superficialEnumCodeCoverage(DownloadParamType.class);
    319319    }
  • trunk/test/unit/org/openstreetmap/josm/gui/MapScalerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    77
    88import java.awt.Color;
    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 {@link MapScaler} class.
    2222 */
    23 public class MapScalerTest {
     23class MapScalerTest {
    2424
    2525    /**
    2626     * Setup tests
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    3434     */
    3535    @Test
    36     public void testMapScaler() {
     36    void testMapScaler() {
    3737        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3838        assertEquals(Color.WHITE, MapScaler.getColor());
  • trunk/test/unit/org/openstreetmap/josm/gui/MapStatusTest.java

    r14604 r17275  
    22package org.openstreetmap.josm.gui;
    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 * Test {@link MapStatus}
    1414 */
    15 public class MapStatusTest {
     15class MapStatusTest {
    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(MapStatus.StatusTextHistory.class)
  • trunk/test/unit/org/openstreetmap/josm/gui/MapViewStateTest.java

    r14120 r17275  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.awt.geom.AffineTransform;
     
    99import java.util.function.Function;
    1010
    11 import org.junit.Before;
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.coor.EastNorth;
     
    2323 * @author Michael Zangl
    2424 */
    25 public class MapViewStateTest {
     25class MapViewStateTest {
    2626
    2727    private static final int WIDTH = 301;
     
    3232     * Setup test.
    3333     */
    34     @BeforeClass
     34    @BeforeAll
    3535    public static void setUpBeforeClass() {
    3636        JOSMFixture.createUnitTestFixture().init();
     
    4040     * Create the default state.
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        state = MapViewState.createDefaultState(WIDTH, HEIGHT);
     
    5656
    5757        center = getter.apply(newState);
    58         assertEquals("east", 3, center.getEastNorth().east(), 0.01);
    59         assertEquals("north", 4, center.getEastNorth().north(), 0.01);
     58        assertEquals(3, center.getEastNorth().east(), 0.01, "east");
     59        assertEquals(4, center.getEastNorth().north(), 0.01, "north");
    6060    }
    6161
     
    6464     */
    6565    @Test
    66     public void testGetCenter() {
     66    void testGetCenter() {
    6767        doTestGetCenter(s -> s.getCenter(), t -> t / 2d);
    6868    }
    6969
    7070    private static void assertHasViewCoords(double x, double y, MapViewPoint center) {
    71         assertEquals("x", x, center.getInViewX(), 0.01);
    72         assertEquals("y", y, center.getInViewY(), 0.01);
    73         assertEquals("x", x, center.getInView().getX(), 0.01);
    74         assertEquals("y", y, center.getInView().getY(), 0.01);
     71        assertEquals(x, center.getInViewX(), 0.01, "x");
     72        assertEquals(y, center.getInViewY(), 0.01, "y");
     73        assertEquals(x, center.getInView().getX(), 0.01, "x");
     74        assertEquals(y, center.getInView().getY(), 0.01, "y");
    7575    }
    7676
     
    7979     */
    8080    @Test
    81     public void testGetForView() {
     81    void testGetForView() {
    8282        MapViewPoint corner = state.getForView(0, 0);
    8383        assertHasViewCoords(0, 0, corner);
     
    9797     */
    9898    @Test
    99     public void testGetViewSize() {
     99    void testGetViewSize() {
    100100        assertEquals(WIDTH, state.getViewWidth(), 0.01);
    101101        assertEquals(HEIGHT, state.getViewHeight(), 0.01);
     
    106106     */
    107107    @Test
    108     public void testPointConversions() {
     108    void testPointConversions() {
    109109        MapViewPoint p = state.getForView(WIDTH / 2d, HEIGHT / 2d);
    110110        assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, p);
     
    113113        LatLon shouldLatLon = ProjectionRegistry.getProjection().getWorldBoundsLatLon().getCenter();
    114114        EastNorth shouldEastNorth = ProjectionRegistry.getProjection().latlon2eastNorth(shouldLatLon);
    115         assertEquals("east", shouldEastNorth.east(), eastnorth.east(), 0.01);
    116         assertEquals("north", shouldEastNorth.north(), eastnorth.north(), 0.01);
     115        assertEquals(shouldEastNorth.east(), eastnorth.east(), 0.01, "east");
     116        assertEquals(shouldEastNorth.north(), eastnorth.north(), 0.01, "north");
    117117        MapViewPoint reversed = state.getPointFor(shouldEastNorth);
    118118        assertHasViewCoords(WIDTH / 2d, HEIGHT / 2d, reversed);
    119119
    120120        LatLon latlon = p.getLatLon();
    121         assertEquals("lat", shouldLatLon.lat(), latlon.lat(), 0.01);
    122         assertEquals("lon", shouldLatLon.lon(), latlon.lon(), 0.01);
     121        assertEquals(shouldLatLon.lat(), latlon.lat(), 0.01, "lat");
     122        assertEquals(shouldLatLon.lon(), latlon.lon(), 0.01, "lon");
    123123
    124124        MapViewPoint p2 = state.getPointFor(new EastNorth(2, 3));
    125         assertEquals("east", 2, p2.getEastNorth().east(), 0.01);
    126         assertEquals("north", 3, p2.getEastNorth().north(), 0.01);
     125        assertEquals(2, p2.getEastNorth().east(), 0.01, "east");
     126        assertEquals(3, p2.getEastNorth().north(), 0.01, "north");
    127127    }
    128128
     
    131131     */
    132132    @Test
    133     public void testGetAffineTransform() {
     133    void testGetAffineTransform() {
    134134        for (EastNorth en : Arrays.asList(new EastNorth(100, 100), new EastNorth(0, 0), new EastNorth(300, 200),
    135135                new EastNorth(-1, -2.5))) {
     
    138138            Point2D result = transform.transform(new Point2D.Double(en.getX(), en.getY()), null);
    139139
    140             assertEquals("x", should.getInViewX(), result.getX(), 0.01);
    141             assertEquals("y", should.getInViewY(), result.getY(), 0.01);
     140            assertEquals(should.getInViewX(), result.getX(), 0.01, "x");
     141            assertEquals(should.getInViewY(), result.getY(), 0.01, "y");
    142142        }
    143143    }
     
    147147     */
    148148    @Test
    149     public void testOutsideFlags() {
     149    void testOutsideFlags() {
    150150        assertEquals(1, Integer.bitCount(MapViewState.OUTSIDE_BOTTOM));
    151151        assertEquals(1, Integer.bitCount(MapViewState.OUTSIDE_TOP));
     
    160160     */
    161161    @Test
    162     public void testPointGetOutsideRectangleFlags() {
     162    void testPointGetOutsideRectangleFlags() {
    163163        MapViewRectangle rect = state.getForView(0, 0).rectTo(state.getForView(10, 10));
    164164        assertEquals(0, state.getForView(1, 1).getOutsideRectangleFlags(rect));
     
    190190     */
    191191    @Test
    192     public void testPointOneNormInView() {
     192    void testPointOneNormInView() {
    193193        MapViewPoint p = state.getForView(5, 15);
    194194        assertEquals(0, p.oneNormInView(p), 1e-10);
     
    203203     */
    204204    @Test
    205     public void testToString() {
     205    void testToString() {
    206206        assertEquals("MapViewViewPoint [x=1.0, y=2.0]",
    207207                state.getForView(1, 2).toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/NavigatableComponentTest.java

    r16618 r17275  
    33
    44import static org.hamcrest.MatcherAssert.assertThat;
    5 import static org.junit.Assert.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    66
    77import java.awt.Point;
     
    1515import org.hamcrest.CustomTypeSafeMatcher;
    1616import org.hamcrest.Matcher;
    17 import org.junit.Before;
    18 import org.junit.Rule;
    19 import org.junit.Test;
     17import org.junit.jupiter.api.BeforeEach;
     18import org.junit.jupiter.api.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    2020import org.openstreetmap.josm.data.Bounds;
    2121import org.openstreetmap.josm.data.ProjectionBounds;
     
    3333 *
    3434 */
    35 public class NavigatableComponentTest {
     35class NavigatableComponentTest {
    3636
    3737    private static final class NavigatableComponentMock extends NavigatableComponent {
     
    5454     * We need the projection for coordinate conversions.
    5555     */
    56     @Rule
     56    @RegisterExtension
    5757    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5858    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    6161     * Create a new, fresh {@link NavigatableComponent}
    6262     */
    63     @Before
     63    @BeforeEach
    6464    public void setUp() {
    6565        component = new NavigatableComponentMock();
     
    8181     */
    8282    @Test
    83     public void testDefaultScale() {
     83    void testDefaultScale() {
    8484        assertEquals(ProjectionRegistry.getProjection().getDefaultZoomInPPD(), component.getScale(), 0.00001);
    8585    }
     
    8989     */
    9090    @Test
    91     public void testPoint2DEastNorth() {
     91    void testPoint2DEastNorth() {
    9292        assertThat(component.getPoint2D((EastNorth) null), CustomMatchers.is(new Point2D.Double()));
    9393        Point2D shouldBeCenter = component.getPoint2D(component.getCenter());
     
    103103     */
    104104    @Test
    105     public void testPoint2DLatLon() {
     105    void testPoint2DLatLon() {
    106106        assertThat(component.getPoint2D((LatLon) null), CustomMatchers.is(new Point2D.Double()));
    107107        // TODO: Really test this.
     
    112112     */
    113113    @Test
    114     public void testZoomToLatLon() {
     114    void testZoomToLatLon() {
    115115        component.zoomTo(new LatLon(10, 10));
    116116        Point2D shouldBeCenter = component.getPoint2D(new LatLon(10, 10));
     
    124124     */
    125125    @Test
    126     public void testZoomToFactor() {
     126    void testZoomToFactor() {
    127127        EastNorth center = component.getCenter();
    128128        double initialScale = component.getScale();
     
    150150     */
    151151    @Test
    152     public void testGetEastNorth() {
     152    void testGetEastNorth() {
    153153        EastNorth center = component.getCenter();
    154154        assertThat(component.getEastNorth(WIDTH / 2, HEIGHT / 2), CustomMatchers.is(center));
     
    162162     */
    163163    @Test
    164     public void testZoomToFactorCenter() {
     164    void testZoomToFactorCenter() {
    165165        // zoomToFactor(double, double, double)
    166166        // assumes getEastNorth works as expected
     
    189189     */
    190190    @Test
    191     public void testGetProjectionBounds() {
     191    void testGetProjectionBounds() {
    192192        ProjectionBounds bounds = component.getProjectionBounds();
    193193        assertThat(bounds.getCenter(), CustomMatchers.is(component.getCenter()));
     
    201201     */
    202202    @Test
    203     public void testGetRealBounds() {
     203    void testGetRealBounds() {
    204204        Bounds bounds = component.getRealBounds();
    205205        assertThat(bounds.getCenter(), CustomMatchers.is(component.getLatLon(WIDTH / 2, HEIGHT / 2)));
  • trunk/test/unit/org/openstreetmap/josm/gui/SystemOfMeasurementTest.java

    r8509 r17275  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.text.DecimalFormat;
     
    88import java.util.Locale;
    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;
    1313import org.openstreetmap.josm.data.SystemOfMeasurement;
     
    1616 * Unit tests of {@link SystemOfMeasurement} class.
    1717 */
    18 public class SystemOfMeasurementTest {
     18class SystemOfMeasurementTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @BeforeClass
     23    @BeforeAll
    2424    public static void setUp() {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3030     */
    3131    @Test
    32     public void testGetDistText() {
     32    void testGetDistText() {
    3333
    3434        assertEquals("< 0.01 m", SystemOfMeasurement.METRIC.getDistText(-1));
     
    7171     */
    7272    @Test
    73     public void testGetDistTextLocalized() {
     73    void testGetDistTextLocalized() {
    7474        final DecimalFormat format = new DecimalFormat("0.000", DecimalFormatSymbols.getInstance(Locale.GERMAN));
    7575        assertEquals("0,001 m", SystemOfMeasurement.METRIC.getDistText(0.001, format, 1e-6));
     
    8484     */
    8585    @Test
    86     public void testGetAreaText() {
     86    void testGetAreaText() {
    8787        assertEquals("< 0.01 m²", SystemOfMeasurement.METRIC.getAreaText(-1));
    8888        assertEquals("< 0.01 m²", SystemOfMeasurement.METRIC.getAreaText(-0.99));
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r14977 r17275  
    22package org.openstreetmap.josm.gui;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.lang.reflect.Constructor;
     
    1515
    1616import org.junit.Assert;
    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.testutils.JOSMTestRules;
     
    4040 * @see <a href="https://josm.openstreetmap.de/ticket/6301">#6301</a>
    4141 */
    42 public class TableCellRendererTest {
     42class TableCellRendererTest {
    4343
    4444    // list of classes that cannot be easily tested and are verified either manually or another unit tests
     
    5151     * Setup test.
    5252     */
    53     @Rule
     53    @RegisterExtension
    5454    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5555    public JOSMTestRules test = new JOSMTestRules().main();
     
    6262     */
    6363    @Test
    64     public void testTableCellRenderer() throws ReflectiveOperationException {
     64    void testTableCellRenderer() throws ReflectiveOperationException {
    6565        Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class);
    6666        Assert.assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
  • trunk/test/unit/org/openstreetmap/josm/gui/autofilter/AutoFilterRuleTest.java

    r15843 r17275  
    22package org.openstreetmap.josm.gui.autofilter;
    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.util.NoSuchElementException;
     
    99import java.util.stream.IntStream;
    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.OsmPrimitive;
    1414import org.openstreetmap.josm.data.osm.OsmUtils;
     
    2020 * Unit tests of {@link AutoFilterRule} class.
    2121 */
    22 public class AutoFilterRuleTest {
     22class AutoFilterRuleTest {
    2323
    2424    /**
    2525     * Setup tests
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().i18n();
     
    3333     */
    3434    @Test
    35     public void testTagValuesForPrimitive() {
     35    void testTagValuesForPrimitive() {
    3636        // #17109, support values like 0.5 or 1.5 - level values are multiplied by 2 when parsing, values are divided by 2 for formatting
    3737        final AutoFilterRule level = AutoFilterRule.getDefaultRule("level").orElseThrow(NoSuchElementException::new);
     
    5252     */
    5353    @Test
    54     public void testTagValuesForPrimitiveInclineUnit() {
     54    void testTagValuesForPrimitiveInclineUnit() {
    5555        final AutoFilterRule incline = AutoFilterRule.getDefaultRule("incline").orElseThrow(NoSuchElementException::new);
    5656        assertTagValuesForPrimitive(incline, "way incline=up");
     
    6363     */
    6464    @Test
    65     public void testTagValuesForPrimitivesDefaults() {
     65    void testTagValuesForPrimitivesDefaults() {
    6666        final AutoFilterRule layer = AutoFilterRule.getDefaultRule("layer").orElseThrow(NoSuchElementException::new);
    6767        assertTagValuesForPrimitive(layer, "way foo=bar");
     
    8585     */
    8686    @Test
    87     public void testValueFormatter() {
     87    void testValueFormatter() {
    8888        final AutoFilterRule voltage = AutoFilterRule.getDefaultRule("voltage").orElseThrow(NoSuchElementException::new);
    8989        assertEquals("230V", voltage.formatValue(230));
  • trunk/test/unit/org/openstreetmap/josm/gui/bbox/SizeButtonTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.bbox;
    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.gui.bbox.SizeButton.AccessibleSizeButton;
     
    1717 * Unit tests of {@link SizeButton} class.
    1818 */
    19 public class SizeButtonTest {
     19class SizeButtonTest {
    2020
    2121    /**
    2222     * Setup tests
    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 testSizeButton() {
     32    void testSizeButton() {
    3333        SizeButton sb = new SizeButton(new SlippyMapBBoxChooser());
    3434        sb.paint(TestUtils.newGraphics());
  • trunk/test/unit/org/openstreetmap/josm/gui/bugreport/BugReportSettingsPanelTest.java

    r12790 r17275  
    22package org.openstreetmap.josm.gui.bugreport;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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;
    99import org.openstreetmap.josm.tools.bugreport.BugReport;
     
    1414 * Tests the {@link BugReportSettingsPanel} class.
    1515 */
    16 public class BugReportSettingsPanelTest {
     16class BugReportSettingsPanelTest {
    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 testBugReportSettingsPanel() {
     29    void testBugReportSettingsPanel() {
    3030        assertNotNull(new BugReportSettingsPanel(new BugReport(BugReport.intercept(new Exception()))));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/bugreport/DebugTextDisplayTest.java

    r12790 r17275  
    22package org.openstreetmap.josm.gui.bugreport;
    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.gui.datatransfer.ClipboardUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit test of {@link DebugTextDisplay} class.
    1515 */
    16 public class DebugTextDisplayTest {
     16class DebugTextDisplayTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testGetCodeText() {
     28    void testGetCodeText() {
    2929        assertEquals("test", new DebugTextDisplay("test").getCodeText());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testCopyToClipboard() {
     36    void testCopyToClipboard() {
    3737        new DebugTextDisplay("copy").copyToClipboard();
    3838        assertEquals(String.format("{{{%ncopy%n}}}"), ClipboardUtils.getClipboardStringContent());
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java

    r12726 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    66
    77import java.util.NoSuchElementException;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.command.SequenceCommand;
    1212import org.openstreetmap.josm.data.conflict.Conflict;
     
    2323 * Unit tests of {@link ConflictResolver} class.
    2424 */
    25 public class ConflictResolverTest {
     25class ConflictResolverTest {
    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().preferences();
     
    3535     * Unit test of {@link ConflictResolver#buildResolveCommand} - empty case.
    3636     */
    37     @Test(expected = NoSuchElementException.class)
    38     public void testBuildResolveCommandEmpty() {
    39         assertNotNull(new ConflictResolver().buildResolveCommand());
     37    @Test
     38    void testBuildResolveCommandEmpty() {
     39        assertThrows(NoSuchElementException.class, () -> new ConflictResolver().buildResolveCommand());
    4040    }
    4141
     
    4444     */
    4545    @Test
    46     public void testBuildResolveCommandNode() {
     46    void testBuildResolveCommandNode() {
    4747        ConflictResolver resolver = new ConflictResolver();
    4848        Node n1 = new Node(LatLon.SOUTH_POLE);
     
    6060     */
    6161    @Test
    62     public void testBuildResolveCommandWay() {
     62    void testBuildResolveCommandWay() {
    6363        ConflictResolver resolver = new ConflictResolver();
    6464        Way w1 = new Way();
     
    7676     */
    7777    @Test
    78     public void testBuildResolveCommandRelation() {
     78    void testBuildResolveCommandRelation() {
    7979        ConflictResolver resolver = new ConflictResolver();
    8080        Relation r1 = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergeModelTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.nodes;
    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.fail;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.beans.PropertyChangeEvent;
     
    1919import javax.swing.DefaultListSelectionModel;
    2020
    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.osm.Node;
     
    3434 * Unit tests of {@link NodeListMergeModel}.
    3535 */
    36 public class NodeListMergeModelTest {
     36class NodeListMergeModelTest {
    3737
    3838    private final DatasetFactory my = new DatasetFactory();
     
    4242     * Setup test.
    4343     */
    44     @Rule
     44    @RegisterExtension
    4545    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4646    public JOSMTestRules test = new JOSMTestRules();
     
    7979            if (idx[i] instanceof Integer) {
    8080                int j = (Integer) idx[i];
    81                 assertTrue("expected row " + j + " to be selected", model.isSelectedIndex(j));
     81                assertTrue(model.isSelectedIndex(j), "expected row " + j + " to be selected");
    8282                break;
    8383            }
     
    9090            }
    9191            for (int j = rows[0]; j <= rows[1]; j++) {
    92                 assertTrue("expected row " + j + " to be selected", model.isSelectedIndex(j));
     92                assertTrue(model.isSelectedIndex(j), "expected row " + j + " to be selected");
    9393            }
    9494        }
     
    9696
    9797    @Test
    98     public void testCopyMyNodesToTop1() {
     98    void testCopyMyNodesToTop1() {
    9999        NodeListMergeModel model = new NodeListMergeModel();
    100100
     
    118118
    119119    @Test
    120     public void testCopyMyNodesToTop2() {
     120    void testCopyMyNodesToTop2() {
    121121        NodeListMergeModel model = new NodeListMergeModel();
    122122
     
    144144
    145145    @Test
    146     public void testCopyMyNodesToTop3() {
     146    void testCopyMyNodesToTop3() {
    147147        NodeListMergeModel model = new NodeListMergeModel();
    148148
     
    170170
    171171    @Test
    172     public void testCopyMyNodesToTop4() {
     172    void testCopyMyNodesToTop4() {
    173173        NodeListMergeModel model = new NodeListMergeModel();
    174174
     
    197197
    198198    @Test
    199     public void testCopyMyNodesToEnd1() {
     199    void testCopyMyNodesToEnd1() {
    200200        NodeListMergeModel model = new NodeListMergeModel();
    201201
     
    218218
    219219    @Test
    220     public void testCopyMyNodesToEnd2() {
     220    void testCopyMyNodesToEnd2() {
    221221        NodeListMergeModel model = new NodeListMergeModel();
    222222
     
    243243
    244244    @Test
    245     public void testCopyMyNodesToEnd3() {
     245    void testCopyMyNodesToEnd3() {
    246246        NodeListMergeModel model = new NodeListMergeModel();
    247247
     
    270270
    271271    @Test
    272     public void testCopyMyNodesToEnd4() {
     272    void testCopyMyNodesToEnd4() {
    273273        NodeListMergeModel model = new NodeListMergeModel();
    274274
     
    303303
    304304    @Test
    305     public void testCopyMyNodesBeforeCurrent1() {
     305    void testCopyMyNodesBeforeCurrent1() {
    306306        NodeListMergeModel model = new NodeListMergeModel();
    307307
     
    330330
    331331    @Test
    332     public void testCopyMyNodesBeforeCurrent2() {
     332    void testCopyMyNodesBeforeCurrent2() {
    333333        NodeListMergeModel model = new NodeListMergeModel();
    334334
     
    358358
    359359    @Test
    360     public void testCopyMyNodesBeforeCurrent3() {
     360    void testCopyMyNodesBeforeCurrent3() {
    361361        NodeListMergeModel model = new NodeListMergeModel();
    362362
     
    393393    /* ----------------------------------------------------------------------------- */
    394394    @Test
    395     public void testCopyMyNodesAfterCurrent1() {
     395    void testCopyMyNodesAfterCurrent1() {
    396396        NodeListMergeModel model = new NodeListMergeModel();
    397397
     
    420420
    421421    @Test
    422     public void testCopyMyNodesAfterCurrent2() {
     422    void testCopyMyNodesAfterCurrent2() {
    423423        NodeListMergeModel model = new NodeListMergeModel();
    424424
     
    449449
    450450    @Test
    451     public void testCopyMyNodesAfterCurrent3() {
     451    void testCopyMyNodesAfterCurrent3() {
    452452        NodeListMergeModel model = new NodeListMergeModel();
    453453
     
    482482    /* ----------------------------------------------------------------------------- */
    483483    @Test
    484     public void testMoveUpMergedNodes1() {
     484    void testMoveUpMergedNodes1() {
    485485        NodeListMergeModel model = new NodeListMergeModel();
    486486
     
    508508
    509509    @Test
    510     public void testMoveUpMergedNodes2() {
     510    void testMoveUpMergedNodes2() {
    511511        NodeListMergeModel model = new NodeListMergeModel();
    512512
     
    538538
    539539    @Test
    540     public void testMoveUpMergedNodes3() {
     540    void testMoveUpMergedNodes3() {
    541541        NodeListMergeModel model = new NodeListMergeModel();
    542542
     
    571571    /* ----------------------------------------------------------------------------- */
    572572    @Test
    573     public void testMoveDownMergedNodes1() {
     573    void testMoveDownMergedNodes1() {
    574574        NodeListMergeModel model = new NodeListMergeModel();
    575575
     
    597597
    598598    @Test
    599     public void testMoveDownMergedNodes2() {
     599    void testMoveDownMergedNodes2() {
    600600        NodeListMergeModel model = new NodeListMergeModel();
    601601
     
    627627
    628628    @Test
    629     public void testMoveDownMergedNodes3() {
     629    void testMoveDownMergedNodes3() {
    630630        NodeListMergeModel model = new NodeListMergeModel();
    631631
     
    660660    /* ----------------------------------------------------------------------------- */
    661661    @Test
    662     public void testAddPropertyChangeListener() throws ReflectiveOperationException {
     662    void testAddPropertyChangeListener() throws ReflectiveOperationException {
    663663        NodeListMergeModel model = new NodeListMergeModel();
    664664
     
    675675
    676676    @Test
    677     public void testRemovePropertyChangeListener() throws ReflectiveOperationException {
     677    void testRemovePropertyChangeListener() throws ReflectiveOperationException {
    678678        NodeListMergeModel model = new NodeListMergeModel();
    679679
     
    693693    /* ----------------------------------------------------------------------------- */
    694694    @Test
    695     public void testSetFrozen() {
     695    void testSetFrozen() {
    696696        NodeListMergeModel model = new NodeListMergeModel();
    697697        model.setFrozen(true);
     
    703703
    704704    @Test
    705     public void testSetFrozenWithPropertyChangeNotification() {
     705    void testSetFrozenWithPropertyChangeNotification() {
    706706        NodeListMergeModel model = new NodeListMergeModel();
    707707
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/nodes/NodeListMergerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.nodes;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 NodeListMerger} class.
    1414 */
    15 public class NodeListMergerTest {
     15class NodeListMergerTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testNodeListMerger() {
     28    void testNodeListMerger() {
    2929        assertNotNull(new NodeListMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.properties;
    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 javax.swing.event.ChangeEvent;
    99import javax.swing.event.ChangeListener;
    1010
    11 import org.junit.Before;
    12 import org.junit.Rule;
    13 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeEach;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.data.conflict.Conflict;
    1515import org.openstreetmap.josm.data.coor.LatLon;
     
    2727 * Unit tests of {@link PropertiesMergeModel}.
    2828 */
    29 public class PropertiesMergeModelTest {
     29class PropertiesMergeModelTest {
    3030
    3131    private abstract static class TestChangeListener implements ChangeListener {
     
    5050     * Setup test.
    5151     */
    52     @Rule
     52    @RegisterExtension
    5353    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5454    public JOSMTestRules test = new JOSMTestRules();
     
    5757     * Setup test.
    5858     */
    59     @Before
     59    @BeforeEach
    6060    public void setUp() {
    6161        model = new PropertiesMergeModel();
     
    6767
    6868    @Test
    69     public void testPopulate() {
     69    void testPopulate() {
    7070        DataSet d1 = new DataSet();
    7171        DataSet d2 = new DataSet();
     
    9090
    9191    @Test
    92     public void testDecidingAboutCoords() {
     92    void testDecidingAboutCoords() {
    9393        DataSet d1 = new DataSet();
    9494        DataSet d2 = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergerTest.java

    r12045 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.properties;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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;
     
    1414 * Unit tests of {@link PropertiesMerger} class.
    1515 */
    16 public class PropertiesMergerTest {
     16class PropertiesMergerTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testPropertiesMerger() {
     29    void testPropertiesMerger() {
    3030        PropertiesMerger merger = new PropertiesMerger();
    3131        assertNotNull(TestUtils.getComponentByName(merger, "button.keepmycoordinates"));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMergerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 RelationMemberMerger} class.
    1414 */
    15 public class RelationMemberMergerTest {
     15class RelationMemberMergerTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testRelationMemberMerger() {
     28    void testRelationMemberMerger() {
    2929        assertNotNull(new RelationMemberMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellEditorTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    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;
    77
    88import java.awt.Component;
    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.RelationMember;
     
    1919 * Unit tests of {@link RelationMemberTableCellEditor} class.
    2020 */
    21 public class RelationMemberTableCellEditorTest {
     21class RelationMemberTableCellEditorTest {
    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().preferences();
     
    3232     */
    3333    @Test
    34     public void testRelationMemberTableCellEditor() {
     34    void testRelationMemberTableCellEditor() {
    3535        RelationMemberTableCellEditor editor = new RelationMemberTableCellEditor();
    3636        assertNull(editor.getTableCellEditorComponent(null, null, false, 0, 0));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    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.Node;
    1111import org.openstreetmap.josm.data.osm.RelationMember;
     
    1919 * Unit tests of {@link RelationMemberTableCellRenderer} class.
    2020 */
    21 public class RelationMemberTableCellRendererTest {
     21class RelationMemberTableCellRendererTest {
    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().preferences();
     
    3232     */
    3333    @Test
    34     public void testRelationMemberTableCellRenderer() {
     34    void testRelationMemberTableCellRenderer() {
    3535        JTable table = new JTable(new NodeListMergeModel().new EntriesTableModel(ListRole.MY_ENTRIES));
    3636        RelationMember member = new RelationMember("foo", new Node());
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItemTest.java

    r12620 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.tags;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    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.Node;
    1111import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType;
     
    1818 * Unit tests of {@link TagMergeItem} class.
    1919 */
    20 public class TagMergeItemTest {
     20class TagMergeItemTest {
    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();
    2828
    2929    @Test
    30     public void testTagMergeItem() {
     30    void testTagMergeItem() {
    3131        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    3232        assertEquals("key", item.getKey());
     
    3737
    3838    @Test
    39     public void testTagMergeItem2() {
     39    void testTagMergeItem2() {
    4040        Node n1 = new Node(1);
    4141        Node n2 = new Node(1);
     
    5151
    5252    @Test
    53     public void testTagMergeItem3() {
     53    void testTagMergeItem3() {
    5454        Node n1 = new Node(1);
    5555        Node n2 = new Node(1);
     
    6565
    6666    @Test
    67     public void testTagMergeItem4() {
     67    void testTagMergeItem4() {
    6868        Node n1 = new Node(1);
    6969        Node n2 = new Node(1);
     
    8080
    8181    @Test
    82     public void testDecide() {
     82    void testDecide() {
    8383        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    8484        item.decide(MergeDecisionType.KEEP_MINE);
     
    8787
    8888    @Test
    89     public void testDecide1() {
     89    void testDecide1() {
    9090        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    9191        try {
     
    9999
    100100    @Test
    101     public void testApplyToMyPrimitive() {
     101    void testApplyToMyPrimitive() {
    102102        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    103103        item.decide(MergeDecisionType.KEEP_MINE);
     
    114114
    115115    @Test
    116     public void testApplyToMyPrimitive2() {
     116    void testApplyToMyPrimitive2() {
    117117        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    118118        item.decide(MergeDecisionType.KEEP_THEIR);
     
    129129
    130130    @Test
    131     public void testApplyToMyPrimitive3() {
     131    void testApplyToMyPrimitive3() {
    132132        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    133133        // item is undecided
     
    146146
    147147    @Test
    148     public void testApplyToMyPrimitive4() {
     148    void testApplyToMyPrimitive4() {
    149149        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    150150
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeModelTest.java

    r14092 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.tags;
    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.beans.PropertyChangeListener;
     
    99import java.util.Set;
    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.osm.Node;
     
    2222 */
    2323@SuppressWarnings("unchecked")
    24 public class TagMergeModelTest {
     24class TagMergeModelTest {
    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();
     
    4040
    4141    @Test
    42     public void testAddPropertyChangeListener() throws ReflectiveOperationException {
     42    void testAddPropertyChangeListener() throws ReflectiveOperationException {
    4343        TagMergeModel model = new TagMergeModel();
    4444        PropertyChangeListener listener = evt -> {
     
    5353
    5454    @Test
    55     public void testRemovePropertyChangeListener() throws ReflectiveOperationException {
     55    void testRemovePropertyChangeListener() throws ReflectiveOperationException {
    5656        TagMergeModel model = new TagMergeModel();
    5757        PropertyChangeListener listener = evt -> {
     
    6666
    6767    @Test
    68     public void testPopulateNoConflichts() throws ReflectiveOperationException {
     68    void testPopulateNoConflichts() throws ReflectiveOperationException {
    6969        Node my = new Node(1);
    7070        Node their = new Node(1);
     
    7878
    7979    @Test
    80     public void testPopulateNoConflicts1() throws ReflectiveOperationException {
     80    void testPopulateNoConflicts1() throws ReflectiveOperationException {
    8181        Node my = new Node(1);
    8282        my.put("key", "value");
     
    9292
    9393    @Test
    94     public void testPopulateMissingKeyMine() throws ReflectiveOperationException {
     94    void testPopulateMissingKeyMine() throws ReflectiveOperationException {
    9595        Node my = new Node(1);
    9696        Node their = new Node(1);
     
    110110
    111111    @Test
    112     public void testPopulateMissingKeyTheir() throws ReflectiveOperationException {
     112    void testPopulateMissingKeyTheir() throws ReflectiveOperationException {
    113113        Node my = new Node(1);
    114114        my.put("key", "value");
     
    128128
    129129    @Test
    130     public void testPopulateConflictingValues() throws ReflectiveOperationException {
     130    void testPopulateConflictingValues() throws ReflectiveOperationException {
    131131        Node my = new Node(1);
    132132        my.put("key", "myvalue");
     
    147147
    148148    @Test
    149     public void testAddItem() throws ReflectiveOperationException {
     149    void testAddItem() throws ReflectiveOperationException {
    150150        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    151151        TagMergeModel model = new TagMergeModel();
     
    163163
    164164    @Test
    165     public void testDecide() throws ReflectiveOperationException {
     165    void testDecide() throws ReflectiveOperationException {
    166166        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    167167        TagMergeModel model = new TagMergeModel();
     
    187187
    188188    @Test
    189     public void testDecideMultiple() throws ReflectiveOperationException {
     189    void testDecideMultiple() throws ReflectiveOperationException {
    190190
    191191        TagMergeModel model = new TagMergeModel();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 TagMerger} class.
    1414 */
    15 public class TagMergerTest {
     15class TagMergerTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testTagMerger() {
     28    void testTagMerger() {
    2929        assertNotNull(new TagMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditorTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 MultiValueCellEditor} class.
    1414 */
    15 public class MultiValueCellEditorTest {
     15class MultiValueCellEditorTest {
    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 testMultiValueCellEditor() {
     28    void testMultiValueCellEditor() {
    2929        assertNotNull(new MultiValueCellEditor().getTableCellEditorComponent(null, new MultiValueResolutionDecision(), false, 0, 0));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    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
    77import java.util.Arrays;
     
    1010import javax.swing.JTable;
    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.data.osm.Tag;
    1515import org.openstreetmap.josm.data.osm.TagCollection;
     
    2121 * Unit tests of {@link MultiValueCellRenderer} class.
    2222 */
    23 public class MultiValueCellRendererTest {
     23class MultiValueCellRendererTest {
    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();
     
    3434     */
    3535    @Test
    36     public void testMultiValueCellRenderer() {
     36    void testMultiValueCellRenderer() {
    3737        TagConflictResolverModel model = new TagConflictResolverModel();
    3838        TagCollection tags = new TagCollection(Arrays.asList(new Tag("oneway", "yes"), new Tag("oneway", "no")));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    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;
     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;
    88
    99import java.awt.Insets;
    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.OsmPrimitiveType;
    1414import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo;
     
    2222 * Unit tests of {@link PasteTagsConflictResolverDialog} class.
    2323 */
    24 public class PasteTagsConflictResolverDialogTest {
     24class PasteTagsConflictResolverDialogTest {
    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 testPaneTitles() {
     37    void testPaneTitles() {
    3838        assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES);
    3939        assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE));
     
    4646     */
    4747    @Test
    48     public void testStatisticsInfoTable() {
     48    void testStatisticsInfoTable() {
    4949        StatisticsInfo info = new StatisticsInfo();
    5050        StatisticsTableModel model = new StatisticsTableModel();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    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;
     
    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.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.osm.DataSet;
     
    2525 * Unit tests of {@link RelationMemberConflictResolverModel} class.
    2626 */
    27 public class RelationMemberConflictResolverModelTest {
     27class RelationMemberConflictResolverModelTest {
    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();
     
    5858
    5959    @Test
    60     public void testSameRoles() throws Exception {
     60    void testSameRoles() throws Exception {
    6161        final List<Way> ways = buildTestDataSet();
    6262        final Relation r = new Relation();
     
    7676
    7777    @Test
    78     public void testDifferentRoles() throws Exception {
     78    void testDifferentRoles() throws Exception {
    7979        final List<Way> ways = buildTestDataSet();
    8080        final Relation r = new Relation();
     
    8989
    9090    @Test
    91     public void testDifferentPresence() throws Exception {
     91    void testDifferentPresence() throws Exception {
    9292        final List<Way> ways = buildTestDataSet();
    9393        final Relation r = new Relation();
     
    101101
    102102    @Test
    103     public void testEveryMemberIsPresentTwice() throws Exception {
     103    void testEveryMemberIsPresentTwice() throws Exception {
    104104        final List<Way> ways = buildTestDataSet();
    105105        final Relation r = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 RelationMemberConflictResolver} class.
    1414 */
    15 public class RelationMemberConflictResolverTest {
     15class RelationMemberConflictResolverTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testRelationMemberConflictResolver() {
     28    void testRelationMemberConflictResolver() {
    2929        assertNotNull(new RelationMemberConflictResolver(null));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java

    r16164 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    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;
     
    1112import java.util.HashSet;
    1213import java.util.List;
     14import java.util.regex.PatternSyntaxException;
    1315import java.util.stream.Collectors;
    1416
    15 import org.junit.Rule;
    16 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1719import org.openstreetmap.josm.data.osm.Tag;
    1820import org.openstreetmap.josm.data.osm.TagCollection;
     
    2729 * Unit tests of {@link TagConflictResolutionUtil} class.
    2830 */
    29 public class TagConflictResolutionUtilTest {
     31class TagConflictResolutionUtilTest {
    3032
    3133    /**
    3234     * Setup test.
    3335     */
    34     @Rule
     36    @RegisterExtension
    3537    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3638    public JOSMTestRules test = new JOSMTestRules();
     
    4547     */
    4648    @Test
    47     public void testApplyAutomaticTagConflictResolution() {
     49    void testApplyAutomaticTagConflictResolution() {
    4850        // Check that general tag conflict are not resolved
    4951        TagCollection tc = new TagCollection();
     
    106108     * Unit tests of {@link AutomaticCombine} class.
    107109     */
    108     public static class AutomaticCombineTest {
     110    static class AutomaticCombineTest {
    109111
    110112        /**
     
    127129         * Setup test.
    128130         */
    129         @Rule
     131        @RegisterExtension
    130132        @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    131133        public JOSMTestRules test = new JOSMTestRules();
     
    135137         */
    136138        @Test
    137         public void testMatchesKeyEmptyKey() {
     139        void testMatchesKeyEmptyKey() {
    138140            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("", "random description", true, ";", null))) {
    139141                assertFalse(resolver.matchesKey("a"));
     
    146148         */
    147149        @Test
    148         public void testMatchesKeyNotRegex() {
     150        void testMatchesKeyNotRegex() {
    149151            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine(
    150152                    "keyname", "random description", false, "|", null))) {
     
    161163         */
    162164        @Test
    163         public void testMatchesKeyRegex() {
     165        void testMatchesKeyRegex() {
    164166            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("test[45].*", "", true, ";", "Integer"))) {
    165167                assertFalse(resolver.matchesKey("key"));
     
    173175         */
    174176        @Test
    175         public void testInvalidRegex() {
     177        void testInvalidRegex() {
    176178            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("invalidregex.(]", "", false, ";", null))) {
    177179                // Should not raise exception if the resolver.isRexEx == false:
     
    188190         * Unit test of {@link AutomaticCombine} with invalid regex.
    189191         */
    190         @Test(expected = java.util.regex.PatternSyntaxException.class)
    191         public void testInvalidRegexExceptionDefaultConstructed() {
     192        @Test
     193        void testInvalidRegexExceptionDefaultConstructed() {
    192194            AutomaticCombine resolver = new AutomaticCombine("AB.(]", "", true, ";", null);
    193             resolver.matchesKey("AB");
    194         }
    195 
     195            assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB"));
     196        }
    196197
    197198        /**
    198199         * Unit test of {@link AutomaticCombine} with invalid regex.
    199200         */
    200         @Test(expected = java.util.regex.PatternSyntaxException.class)
    201         public void testInvalidRegexExceptionFullyConstructed() {
     201        @Test
     202        void testInvalidRegexExceptionFullyConstructed() {
    202203            AutomaticCombine resolver = new AutomaticCombine();
    203204            resolver.key = "AB.(]";
    204205            resolver.isRegex = true;
    205             resolver.matchesKey("AB");
     206            assertThrows(PatternSyntaxException.class, () -> resolver.matchesKey("AB"));
    206207        }
    207208
     
    210211         */
    211212        @Test
    212         public void testResolve() {
     213        void testResolve() {
    213214            for (AutomaticCombine resolver: differentlyConstructed(new AutomaticCombine("random", "", true, "|", "String"))) {
    214215                assertEquals(resolver.resolve(newHashSet("value1", "value2")), "value1|value2");
     
    230231     * Unit tests of {@link AutomaticChoice} class.
    231232     */
    232     public static class AutomaticChoiceTest {
     233    static class AutomaticChoiceTest {
    233234        /**
    234235         * Setup test.
    235236         */
    236         @Rule
     237        @RegisterExtension
    237238        @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    238239        public JOSMTestRules test = new JOSMTestRules();
     
    260261         */
    261262        @Test
    262         public void testMatchesValue() {
     263        void testMatchesValue() {
    263264            for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice(
    264265                    "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) {
     
    282283         */
    283284        @Test
    284         public void testComputeScoreFromValue() {
     285        void testComputeScoreFromValue() {
    285286            for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice(
    286287                    "random key", "random group", "random description", false, ".*valueToMatch", "Score$0\\1"))) {
     
    298299         */
    299300        @Test
    300         public void testInvalidRegex() {
     301        void testInvalidRegex() {
    301302            for (AutomaticChoice resolver: differentlyConstructed(new AutomaticChoice(
    302303                    "k", "g", "", false, "invalidregex.(]", "InvalidScore$0\\1$-4"))) {
     
    316317         * Unit test of {@link AutomaticChoice} when invalid regex is used.
    317318         */
    318         @Test(expected = java.util.regex.PatternSyntaxException.class)
    319         public void testMatchesValueInvalidRegex() {
     319        @Test
     320        void testMatchesValueInvalidRegex() {
    320321            AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "InvalidScore$0\\1$-4");
    321             resolver.matchesValue("test");
     322            assertThrows(PatternSyntaxException.class, () -> resolver.matchesValue("test"));
    322323        }
    323324
     
    325326         * Unit test of {@link AutomaticChoice} when invalid regex is used.
    326327         */
    327         @Test(expected = java.util.regex.PatternSyntaxException.class)
    328         public void testComputeScoreFromValueInvalidRegex() {
     328        @Test
     329        void testComputeScoreFromValueInvalidRegex() {
    329330            AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "invalidregex.(]", "valid");
    330             resolver.computeScoreFromValue("valid");
    331         }
    332 
     331            assertThrows(PatternSyntaxException.class, () -> resolver.computeScoreFromValue("valid"));
     332        }
    333333
    334334        /**
     
    336336         */
    337337        @Test
    338         public void testComputeScoreFromValueInvalidReplacement() {
     338        void testComputeScoreFromValueInvalidReplacement() {
    339339            AutomaticChoice resolver = new AutomaticChoice("k", "g", "", true, "valid", "InvalidScore$0\\1$-4");
    340340            boolean exceptionThrown = false;
     
    351351     * Unit tests of {@link AutomaticChoiceGroup} class.
    352352     */
    353     public static class AutomaticChoiceGroupTest {
     353    static class AutomaticChoiceGroupTest {
    354354        /**
    355355         * Setup test.
    356356         */
    357         @Rule
     357        @RegisterExtension
    358358        @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    359359        public JOSMTestRules test = new JOSMTestRules();
     
    373373         */
    374374        @Test
    375         public void testGroupChoices() {
     375        void testGroupChoices() {
    376376            Collection<AutomaticChoiceGroup> groups = AutomaticChoiceGroup.groupChoices(Arrays.asList(choiceKey1Group1, choiceKey1Group2));
    377377            assertEquals(2, groups.size());
     
    405405         */
    406406        @Test
    407         public void testMatchesKey() {
     407        void testMatchesKey() {
    408408            AutomaticChoiceGroup group = new AutomaticChoiceGroup(
    409409                    choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex,
     
    427427         */
    428428        @Test
    429         public void testResolve() {
     429        void testResolve() {
    430430            AutomaticChoiceGroup group = new AutomaticChoiceGroup(
    431431                    choiceKey1Group1.key, choiceKey1Group1.group, choiceKey1Group1.isRegex,
  • trunk/test/unit/org/openstreetmap/josm/gui/correction/RoleCorrectionTableTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.correction;
    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;
    99
    1010import java.util.Arrays;
    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.data.correction.RoleCorrection;
    1515import org.openstreetmap.josm.data.osm.Node;
     
    2323 * Unit tests of {@link RoleCorrectionTable} class.
    2424 */
    25 public class RoleCorrectionTableTest {
     25class RoleCorrectionTableTest {
    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 testRoleCorrectionTable() {
     38    void testRoleCorrectionTable() {
    3939        Relation r = new Relation();
    4040        RelationMember member = new RelationMember("foo", new Node());
  • trunk/test/unit/org/openstreetmap/josm/gui/correction/TagCorrectionTableTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.correction;
    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;
    99
    1010import java.util.Arrays;
    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.data.correction.TagCorrection;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2020 * Unit tests of {@link TagCorrectionTable} class.
    2121 */
    22 public class TagCorrectionTableTest {
     22class TagCorrectionTableTest {
    2323
    2424    /**
    2525     * Setup tests
    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 testTagCorrectionTable() {
     35    void testTagCorrectionTable() {
    3636        TagCorrection tc1 = new TagCorrection("foo", "bar", "foo", "baz");
    3737        TagCorrection tc2 = new TagCorrection("bar", "foo", "baz", "foo");
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/ClipboardUtilsTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    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.assertSame;
    8 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.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99import static org.junit.Assume.assumeTrue;
    1010
     
    1717import java.io.IOException;
    1818
    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.testutils.JOSMTestRules;
    2222
     
    2828 * @author Michael Zangl
    2929 */
    30 public class ClipboardUtilsTest {
     30class ClipboardUtilsTest {
    3131    private static final class ThrowIllegalStateClipboard extends Clipboard {
    3232        private int failingAccesses = 3;
     
    7070     * No dependencies
    7171     */
    72     @Rule
     72    @RegisterExtension
    7373    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    7474    public JOSMTestRules test = new JOSMTestRules();
     
    7878     */
    7979    @Test
    80     public void testGetClipboard() {
     80    void testGetClipboard() {
    8181        Clipboard c = ClipboardUtils.getClipboard();
    8282        assertNotNull(c);
     
    8888     */
    8989    @Test
    90     public void testCopyPasteString() {
     90    void testCopyPasteString() {
    9191        ClipboardUtils.copyString("");
    9292        assertEquals("", ClipboardUtils.getClipboardStringContent());
     
    102102     */
    103103    @Test
    104     public void testGetContentIllegalState() {
     104    void testGetContentIllegalState() {
    105105        ThrowIllegalStateClipboard throwingClipboard = new ThrowIllegalStateClipboard("test");
    106106
     
    118118     */
    119119    @Test
    120     public void testSystemSelectionDoesNotFail() {
     120    void testSystemSelectionDoesNotFail() {
    121121        assumeTrue(GraphicsEnvironment.isHeadless());
    122122        assertNull(ClipboardUtils.getSystemSelection());
     
    128128     */
    129129    @Test
    130     public void testUtilityClass() throws ReflectiveOperationException {
     130    void testUtilityClass() throws ReflectiveOperationException {
    131131        UtilityClassTestUtil.assertUtilityClassWellDefined(ClipboardUtils.class);
    132132    }
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/LayerTransferableTest.java

    r10605 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertSame;
    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.assertSame;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.awt.datatransfer.DataFlavor;
     
    1112import java.util.Arrays;
    1213
    13 import org.junit.Before;
    14 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
    1516import org.openstreetmap.josm.gui.datatransfer.LayerTransferable.Data;
    1617import org.openstreetmap.josm.gui.layer.Layer;
     
    2425 * @since 10605
    2526 */
    26 public class LayerTransferableTest {
     27class LayerTransferableTest {
    2728    private TestLayer layer1;
    2829    private TestLayer layer2;
     
    3233     * Set up test data
    3334     */
    34     @Before
     35    @BeforeEach
    3536    public void createTestData() {
    3637        layer1 = new LayerManagerTest.TestLayer();
     
    4546     */
    4647    @Test
    47     public void testLayerData() {
     48    void testLayerData() {
    4849        Data data = new Data(manager, Arrays.<Layer>asList(layer1, layer2));
    4950
     
    5960     */
    6061    @Test
    61     public void testSupportedDataFlavor() {
     62    void testSupportedDataFlavor() {
    6263        LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
    6364
     
    7576     */
    7677    @Test
    77     public void testTransferData() throws Exception {
     78    void testTransferData() throws Exception {
    7879        LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
    7980
     
    8889    /**
    8990     * Test {@link LayerTransferable#getTransferData(DataFlavor)} for unsupported {@link DataFlavor}
    90      * @throws Exception if any error occurs
    9191     */
    92     @Test(expected = UnsupportedFlavorException.class)
    93     public void testTransferDataUnsupported() throws Exception {
     92    @Test
     93    void testTransferDataUnsupported() {
    9494        LayerTransferable transferable = new LayerTransferable(manager, Arrays.<Layer>asList(layer1, layer2));
    9595
    96         transferable.getTransferData(DataFlavor.imageFlavor);
     96        assertThrows(UnsupportedFlavorException.class, () -> transferable.getTransferData(DataFlavor.imageFlavor));
    9797    }
    9898}
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandlerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    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.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.actions.CopyAction;
    1212import org.openstreetmap.josm.data.coor.LatLon;
     
    2323 * Unit tests of {@link OsmTransferHandler} class.
    2424 */
    25 public class OsmTransferHandlerTest {
     25class OsmTransferHandlerTest {
    2626    /**
    2727     * Prefs to use OSM primitives
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
     
    3737     */
    3838    @Test
    39     public void testPasteOn() {
     39    void testPasteOn() {
    4040        DataSet ds1 = new DataSet();
    4141        Node n1 = new Node(new LatLon(43, 1));
     
    6363     */
    6464    @Test
    65     public void testPasteTags() {
     65    void testPasteTags() {
    6666        Node n = new Node(LatLon.ZERO);
    6767        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(n), "testPasteTags", null));
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/PrimitiveTransferableTest.java

    r10604 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    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.awt.datatransfer.DataFlavor;
     
    1314import java.util.List;
    1415
    15 import org.junit.Rule;
    16 import org.junit.Test;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1718import org.openstreetmap.josm.data.osm.Node;
    1819import org.openstreetmap.josm.data.osm.NodeData;
     
    2728 * Unit tests of {@link PrimitiveTransferable} class.
    2829 */
    29 public class PrimitiveTransferableTest {
     30class PrimitiveTransferableTest {
    3031    /**
    3132     * Prefs to use OSM primitives
    3233     */
    33     @Rule
     34    @RegisterExtension
    3435    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3536    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3940     */
    4041    @Test
    41     public void testGetTransferDataFlavors() {
     42    void testGetTransferDataFlavors() {
    4243        List<DataFlavor> flavors = Arrays.asList(new PrimitiveTransferable(null).getTransferDataFlavors());
    4344        int ptd = flavors.indexOf(PrimitiveTransferData.DATA_FLAVOR);
     
    5758     */
    5859    @Test
    59     public void testIsDataFlavorSupported() {
     60    void testIsDataFlavorSupported() {
    6061        assertTrue(new PrimitiveTransferable(null).isDataFlavorSupported(PrimitiveTransferData.DATA_FLAVOR));
    6162        assertFalse(new PrimitiveTransferable(null).isDataFlavorSupported(DataFlavor.imageFlavor));
     
    6768     */
    6869    @Test
    69     public void testGetTransferDataNominal() throws UnsupportedFlavorException {
     70    void testGetTransferDataNominal() throws UnsupportedFlavorException {
    7071        PrimitiveTransferData data = PrimitiveTransferData.getData(Collections.singleton(new Node(1)));
    7172        PrimitiveTransferable pt = new PrimitiveTransferable(data);
     
    8384    /**
    8485     * Test of {@link PrimitiveTransferable#getTransferData} method - error case.
    85      * @throws UnsupportedFlavorException always
    8686     */
    87     @Test(expected = UnsupportedFlavorException.class)
    88     public void testGetTransferDataError() throws UnsupportedFlavorException {
     87    @Test
     88    void testGetTransferDataError() {
    8989        PrimitiveTransferData data = PrimitiveTransferData.getData(Collections.singleton(new Node(1)));
    90         new PrimitiveTransferable(data).getTransferData(DataFlavor.imageFlavor);
     90        assertThrows(UnsupportedFlavorException.class, () -> new PrimitiveTransferable(data).getTransferData(DataFlavor.imageFlavor));
    9191    }
    9292}
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/RelationMemberTransferableTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    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;
    78import static org.openstreetmap.josm.gui.datatransfer.RelationMemberTransferable.RELATION_MEMBER_DATA;
    89
     
    1213import java.util.Collections;
    1314
    14 import org.junit.Rule;
    15 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1617import org.openstreetmap.josm.data.osm.Node;
    1718import org.openstreetmap.josm.data.osm.PrimitiveData;
     
    2627 * Unit tests of {@link RelationMemberTransferable} class.
    2728 */
    28 public class RelationMemberTransferableTest {
     29class RelationMemberTransferableTest {
    2930
    3031    /**
    3132     * Setup tests
    3233     */
    33     @Rule
     34    @RegisterExtension
    3435    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3536    public JOSMTestRules test = new JOSMTestRules();
     
    3940     */
    4041    @Test
    41     public void testGetTransferDataFlavors() {
     42    void testGetTransferDataFlavors() {
    4243        DataFlavor[] flavors = new RelationMemberTransferable(Collections.<RelationMember>emptyList()).getTransferDataFlavors();
    4344        assertEquals(3, flavors.length);
     
    5152     */
    5253    @Test
    53     public void testIsDataFlavorSupported() {
     54    void testIsDataFlavorSupported() {
    5455        RelationMemberTransferable transferable = new RelationMemberTransferable(Collections.<RelationMember>emptyList());
    5556        assertTrue(transferable.isDataFlavorSupported(RELATION_MEMBER_DATA));
     
    6364     */
    6465    @Test
    65     public void testGetTransferDataNominal() throws UnsupportedFlavorException {
     66    void testGetTransferDataNominal() throws UnsupportedFlavorException {
    6667        RelationMemberTransferable rmt = new RelationMemberTransferable(Collections.singleton(new RelationMember("test", new Node(1))));
    6768        assertEquals("node 1 test # incomplete\n", rmt.getTransferData(DataFlavor.stringFlavor));
     
    8081    /**
    8182     * Test of {@link RelationMemberTransferable#getTransferData} method - error case.
    82      * @throws UnsupportedFlavorException always
    8383     */
    84     @Test(expected = UnsupportedFlavorException.class)
    85     public void testGetTransferDataError() throws UnsupportedFlavorException {
    86         new RelationMemberTransferable(Collections.singleton(new RelationMember(null, new Node(1)))).getTransferData(null);
     84    @Test
     85    void testGetTransferDataError() {
     86        assertThrows(UnsupportedFlavorException.class,
     87                () -> new RelationMemberTransferable(Collections.singleton(new RelationMember(null, new Node(1)))).getTransferData(null));
    8788    }
    8889}
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/TagTransferableTest.java

    r11931 r17275  
    22package org.openstreetmap.josm.gui.datatransfer;
    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.awt.datatransfer.DataFlavor;
    910import java.awt.datatransfer.UnsupportedFlavorException;
    10 import java.io.IOException;
    1111import java.util.HashMap;
    1212import java.util.Map;
    1313
    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.gui.datatransfer.data.TagTransferData;
    1717import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2222 * Unit tests of {@link TagTransferable} class.
    2323 */
    24 public class TagTransferableTest {
     24class TagTransferableTest {
    2525
    2626    /**
    2727     * Setup tests
    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 testIsDataFlavorSupported() {
     37    void testIsDataFlavorSupported() {
    3838        TagTransferable tt = new TagTransferable(null);
    3939        assertTrue(tt.isDataFlavorSupported(TagTransferData.FLAVOR));
     
    4848     */
    4949    @Test
    50     public void testGetTransferDataNominal() throws Exception {
     50    void testGetTransferDataNominal() throws Exception {
    5151        Map<String, String> tags = new HashMap<>();
    5252        tags.put("foo", "bar");
     
    5858    /**
    5959     * Test of {@link TagTransferable#getTransferData} method - error case.
    60      * @throws UnsupportedFlavorException always
    61      * @throws IOException never
    6260     */
    63     @Test(expected = UnsupportedFlavorException.class)
    64     public void testGetTransferDataError() throws UnsupportedFlavorException, IOException {
    65         new TagTransferable(null).getTransferData(null);
     61    @Test
     62    void testGetTransferDataError() {
     63        assertThrows(UnsupportedFlavorException.class, () -> new TagTransferable(null).getTransferData(null));
    6664    }
    6765}
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/data/PrimitiveTagTransferDataTest.java

    r10737 r17275  
    22package org.openstreetmap.josm.gui.datatransfer.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.util.Arrays;
    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.Node;
    1414import org.openstreetmap.josm.data.osm.NodeData;
     
    2626 * @author Michael Zangl
    2727 */
    28 public class PrimitiveTagTransferDataTest {
     28class PrimitiveTagTransferDataTest {
    2929    /**
    3030     * Prefs only required because of the dependencies of OSM primitives.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4242     */
    4343    @Test
    44     public void testPrimitiveTagTransferDataPrimitiveTransferData() {
     44    void testPrimitiveTagTransferDataPrimitiveTransferData() {
    4545        PrimitiveTagTransferData data = new PrimitiveTagTransferData(PrimitiveTransferData.getData(Arrays.asList(new Node(), new Node())));
    4646        assertEquals(2, data.getSourcePrimitiveCount(OsmPrimitiveType.NODE));
     
    5353     */
    5454    @Test
    55     public void testIsHeterogeneousSource() {
     55    void testIsHeterogeneousSource() {
    5656        // 0 item
    5757        assertFalse(isHeterogeneousSource());
     
    7474     */
    7575    @Test
    76     public void testGetForPrimitives() {
     76    void testGetForPrimitives() {
    7777        PrimitiveTagTransferData data = createTestData();
    7878        TagCollection forNode = data.getForPrimitives(OsmPrimitiveType.NODE);
     
    100100     */
    101101    @Test
    102     public void testGetSourcePrimitiveCount() {
     102    void testGetSourcePrimitiveCount() {
    103103        PrimitiveTagTransferData data = createTestData();
    104104        assertEquals(2, data.getSourcePrimitiveCount(OsmPrimitiveType.NODE));
     
    111111     */
    112112    @Test
    113     public void testGetStatistics() {
     113    void testGetStatistics() {
    114114        PrimitiveTagTransferData data = createTestData();
    115115        Map<OsmPrimitiveType, Integer> stats = data.getStatistics();
  • trunk/test/unit/org/openstreetmap/josm/gui/datatransfer/importers/OsmLinkPasterTest.java

    r11282 r17275  
    22package org.openstreetmap.josm.gui.datatransfer.importers;
    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.data.coor.LatLon;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * @author Michael Zangl
    1717 */
    18 public class OsmLinkPasterTest {
     18class OsmLinkPasterTest {
    1919    /**
    2020     * No dependencies
    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 testParseLatLon() {
     30    void testParseLatLon() {
    3131        assertEquals(new LatLon(51.71873, 8.76164),
    3232                OsmLinkPaster.parseLatLon("https://www.openstreetmap.org/#map=17/51.71873/8.76164"));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ChangesetDialogTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui.dialogs;
    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.gui.dialogs.ChangesetDialog.LaunchChangesetManager;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1313 * Unit tests of {@link ChangesetDialog} class.
    1414 */
    15 public class ChangesetDialogTest {
     15class ChangesetDialogTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testUtilityClass() throws ReflectiveOperationException {
     29    void testUtilityClass() throws ReflectiveOperationException {
    3030        UtilityClassTestUtil.assertUtilityClassWellDefined(LaunchChangesetManager.class);
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/CommandStackDialogTest.java

    r14562 r17275  
    22package org.openstreetmap.josm.gui.dialogs;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.command.Command;
     
    2121 * Unit tests of {@link CommandStackDialog} class.
    2222 */
    23 public class CommandStackDialogTest {
     23class CommandStackDialogTest {
    2424
    2525    /**
    2626     * Setup tests
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    3434     */
    3535    @Test
    36     public void testCommandStackDialogEmpty() {
     36    void testCommandStackDialogEmpty() {
    3737        CommandStackDialog dlg = new CommandStackDialog();
    3838        dlg.showDialog();
     
    4646     */
    4747    @Test
    48     public void testCommandStackDialogNotEmpty() {
     48    void testCommandStackDialogNotEmpty() {
    4949        DataSet ds = new DataSet();
    5050        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
     
    7979     */
    8080    @Test
    81     public void testCommandStackDialogUndoAddCommand() {
     81    void testCommandStackDialogUndoAddCommand() {
    8282        DataSet ds = new DataSet();
    8383        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/ConflictDialogTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.dialogs;
    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
    77import java.awt.Color;
    88import java.awt.image.BufferedImage;
    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.osm.DataSet;
     
    2626 * Unit tests of {@link ConflictDialog} class.
    2727 */
    28 public class ConflictDialogTest {
     28class ConflictDialogTest {
    2929
    3030    /**
    3131     * Setup tests
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    3939     */
    4040    @Test
    41     public void testConflictDialog() {
     41    void testConflictDialog() {
    4242        assertNotNull(new ConflictDialog());
    4343    }
     
    4747     */
    4848    @Test
    49     public void testGetColor() {
     49    void testGetColor() {
    5050        assertEquals(Color.gray, ConflictDialog.getColor());
    5151    }
     
    5555     */
    5656    @Test
    57     public void testConflictPainter() {
     57    void testConflictPainter() {
    5858        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    5959        ConflictPainter cp = new ConflictPainter(MainApplication.getMap().mapView,
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/InspectPrimitiveDialogTest.java

    r17149 r17275  
    22package org.openstreetmap.josm.gui.dialogs;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55import static org.openstreetmap.josm.TestUtils.assertEqualsNewline;
    66
     
    99import javax.swing.JPanel;
    1010
    11 import org.junit.After;
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     11import org.junit.jupiter.api.AfterEach;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.data.SystemOfMeasurement;
    1616import org.openstreetmap.josm.data.coor.LatLon;
     
    2828 * Unit tests of {@link InspectPrimitiveDialog} class.
    2929 */
    30 public class InspectPrimitiveDialogTest {
     30class InspectPrimitiveDialogTest {
    3131
    3232    /**
    3333     * Setup tests
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules().main().projection().mapStyles();
     
    4040     * Setup test
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put("METRIC");
     
    4949     * Cleanup test
    5050     */
    51     @After
     51    @AfterEach
    5252    public void tearDown() {
    5353        SystemOfMeasurement.PROP_SYSTEM_OF_MEASUREMENT.put(null);
     
    5858     */
    5959    @Test
    60     public void testGenericMonospacePanel() {
     60    void testGenericMonospacePanel() {
    6161        assertNotNull(InspectPrimitiveDialog.genericMonospacePanel(new JPanel(), ""));
    6262    }
     
    6666     */
    6767    @Test
    68     public void testBuildDataText() {
     68    void testBuildDataText() {
    6969        DataSet ds = new DataSet();
    7070        assertEqualsNewline("", InspectPrimitiveDialog.buildDataText(ds, new ArrayList<>(ds.allPrimitives())));
     
    108108     */
    109109    @Test
    110     public void testBuildListOfEditorsText() {
     110    void testBuildListOfEditorsText() {
    111111        DataSet ds = new DataSet();
    112112        assertEqualsNewline("0 users last edited the selection:\n\n", InspectPrimitiveDialog.buildListOfEditorsText(ds.allPrimitives()));
     
    130130     */
    131131    @Test
    132     public void testBuildMapPaintText() {
     132    void testBuildMapPaintText() {
    133133        DataSet ds = new DataSet();
    134134        OsmDataLayer layer = new OsmDataLayer(ds, "", null);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MapPaintDialogTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.dialogs;
    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.data.osm.DataSet;
    77import org.openstreetmap.josm.gui.MainApplication;
     
    1414 * Unit tests of {@link MapPaintDialog} class.
    1515 */
    16 public class MapPaintDialogTest {
     16class MapPaintDialogTest {
    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().main().projection();
     
    2727     */
    2828    @Test
    29     public void testInfoAction() {
     29    void testInfoAction() {
    3030        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3131        MainApplication.getMap().mapPaintDialog.new InfoAction().actionPerformed(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/MinimapDialogTest.java

    r16160 r17275  
    33
    44import static java.util.concurrent.TimeUnit.MILLISECONDS;
    5 import static org.junit.Assert.assertArrayEquals;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.assertFalse;
    8 import static org.junit.Assert.assertTrue;
    9 import static org.junit.Assert.fail;
     5import static org.junit.jupiter.api.Assertions.fail;
     6import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     7import static org.junit.jupiter.api.Assertions.assertEquals;
     8import static org.junit.jupiter.api.Assertions.assertFalse;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
    1010import static org.openstreetmap.josm.tools.I18n.tr;
    1111
     
    2828
    2929import org.awaitility.Awaitility;
    30 import org.junit.Rule;
    31 import org.junit.Test;
     30import org.junit.jupiter.api.Test;
     31import org.junit.jupiter.api.extension.RegisterExtension;
    3232import org.openstreetmap.josm.TestUtils;
    3333import org.openstreetmap.josm.data.Bounds;
     
    5555 * Unit tests of {@link MinimapDialog} class.
    5656 */
    57 public class MinimapDialogTest {
     57class MinimapDialogTest {
    5858
    5959    /**
    6060     * Setup tests
    6161     */
    62     @Rule
     62    @RegisterExtension
    6363    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6464    public JOSMTestRules josmTestRules = new JOSMTestRules().main().projection().fakeImagery();
     
    6868     */
    6969    @Test
    70     public void testMinimapDialog() {
     70    void testMinimapDialog() {
    7171        MinimapDialog dlg = new MinimapDialog();
    7272        dlg.showDialog();
     
    102102                assertEquals(equalText, isSelected);
    103103                if (equalText) {
    104                     assertFalse("Second selected source found", found);
     104                    assertFalse(found, "Second selected source found");
    105105                    found = true;
    106106                }
    107107            }
    108108        }
    109         assertTrue("Selected source not found in menu", found);
     109        assertTrue(found, "Selected source not found in menu");
    110110    }
    111111
     
    199199     */
    200200    @Test
    201     public void testSourceSwitching() throws Exception {
     201    void testSourceSwitching() throws Exception {
    202202        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    203203        // (not that there's a data layer for it to use)
     
    246246     */
    247247    @Test
    248     public void testRefreshSourcesRetainsSelection() throws Exception {
     248    void testRefreshSourcesRetainsSelection() throws Exception {
    249249        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    250250        // (not that there's a data layer for it to use)
     
    284284     */
    285285    @Test
    286     public void testRemovedSourceStillSelected() throws Exception {
     286    void testRemovedSourceStillSelected() throws Exception {
    287287        // relevant prefs starting out empty, should choose the first source and have shown download area enabled
    288288        // (not that there's a data layer for it to use)
     
    317317     */
    318318    @Test
    319     public void testTileSourcesFromCurrentLayers() throws Exception {
     319    void testTileSourcesFromCurrentLayers() throws Exception {
    320320        // relevant prefs starting out empty, should choose the first (ImageryLayerInfo) source and have shown download area enabled
    321321        // (not that there's a data layer for it to use)
     
    451451     */
    452452    @Test
    453     public void testSourcePrefObeyed() throws Exception {
     453    void testSourcePrefObeyed() throws Exception {
    454454        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    455455
     
    478478     */
    479479    @Test
    480     public void testSourcePrefInvalid() throws Exception {
     480    void testSourcePrefInvalid() throws Exception {
    481481        Config.getPref().put("slippy_map_chooser.mapstyle", "Hooloovoo Tiles");
    482482
     
    500500     */
    501501    @Test
    502     public void testViewportAspectRatio() throws Exception {
     502    void testViewportAspectRatio() throws Exception {
    503503        // Add a test layer to the layer manager to get the MapFrame & MapView
    504504        MainApplication.getLayerManager().addLayer(new TestLayer());
     
    546546        // should equal the number on the right
    547547        assertTrue(
    548             "Viewport marker not horizontally centered",
    549             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
     548            Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
     549            "Viewport marker not horizontally centered"
    550550        );
    551551
     
    561561        // should equal the number on the bottom
    562562        assertTrue(
    563             "Viewport marker not vertically centered",
    564             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
     563            Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
     564            "Viewport marker not vertically centered"
    565565        );
    566566
    567567        // (within a tolerance for numerical error) the viewport marker should be square
    568568        assertTrue(
    569             "Viewport marker not square",
    570             Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4
     569            Math.abs(colMatcher.group(2).length() - rowMatcher.group(2).length()) < 4,
     570            "Viewport marker not square"
    571571        );
    572572
     
    591591        );
    592592        assertTrue(
    593             "Viewport marker not horizontally centered",
    594             Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4
     593            Math.abs(rowMatcher.group(1).length() - rowMatcher.group(3).length()) < 4,
     594            "Viewport marker not horizontally centered"
    595595        );
    596596
     
    603603        );
    604604        assertTrue(
    605             "Viewport marker not vertically centered",
    606             Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4
     605            Math.abs(colMatcher.group(1).length() - colMatcher.group(3).length()) < 4,
     606            "Viewport marker not vertically centered"
    607607        );
    608608
     
    614614
    615615        assertTrue(
    616             "Viewport marker not 2:1 aspect ratio",
    617             Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5
     616            Math.abs(colMatcher.group(2).length() - (rowMatcher.group(2).length()*2.0)) < 5,
     617            "Viewport marker not 2:1 aspect ratio"
    618618        );
    619619    }
     
    624624        for (Component c: menu.getComponents()) {
    625625            if (JPopupMenu.Separator.class.isInstance(c)) {
    626                 assertFalse("More than one separator before target item", afterSeparator);
     626                assertFalse(afterSeparator, "More than one separator before target item");
    627627                afterSeparator = true;
    628628            } else if (((JMenuItem) c).getText().equals(tr("Show downloaded area"))) {
    629                 assertTrue("Separator not found before target item", afterSeparator);
    630                 assertTrue("Target item doesn't appear to be a JCheckBoxMenuItem", JCheckBoxMenuItem.class.isInstance(c));
     629                assertTrue(afterSeparator, "Separator not found before target item");
     630                assertTrue(JCheckBoxMenuItem.class.isInstance(c), "Target item doesn't appear to be a JCheckBoxMenuItem");
    631631                return (JCheckBoxMenuItem) c;
    632632            }
     
    641641     */
    642642    @Test
    643     public void testShowDownloadedArea() throws Exception {
     643    void testShowDownloadedArea() throws Exception {
    644644        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    645645        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", false);
     
    800800     */
    801801    @Test
    802     public void testShowDownloadedAreaLayerSwitching() throws Exception {
     802    void testShowDownloadedAreaLayerSwitching() throws Exception {
    803803        Config.getPref().put("slippy_map_chooser.mapstyle", "Green Tiles");
    804804        Config.getPref().putBoolean("slippy_map_chooser.show_downloaded_area", true);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheManagerTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    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.awt.GraphicsEnvironment;
     
    1414import java.util.List;
    1515
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
     17import org.junit.jupiter.api.Test;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.data.osm.Changeset;
     
    4141 * Unit tests of {@link ChangesetCacheManager} class.
    4242 */
    43 public class ChangesetCacheManagerTest {
     43class ChangesetCacheManagerTest {
    4444
    4545    /**
    4646     * Setup tests
    4747     */
    48     @Rule
     48    @RegisterExtension
    4949    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5050    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    5454     */
    5555    @Test
    56     public void testDestroyInstance() {
     56    void testDestroyInstance() {
    5757        ChangesetCacheManager.destroyInstance();
    5858    }
     
    6464     */
    6565    @Test
    66     public void testBuild() {
     66    void testBuild() {
    6767        assertNotNull(ChangesetCacheManager.buildButtonPanel());
    6868        assertNotNull(ChangesetCacheManager.buildToolbarPanel());
     
    7474     */
    7575    @Test
    76     public void testChangesetDetailViewSynchronizer() {
     76    void testChangesetDetailViewSynchronizer() {
    7777        new ChangesetDetailViewSynchronizer(new ChangesetCacheManagerModel(null) {
    7878            @Override
     
    9494     */
    9595    @Test
    96     public void testCancelAction() {
     96    void testCancelAction() {
    9797        new CancelAction().actionPerformed(null);
    9898    }
     
    102102     */
    103103    @Test
    104     public void testCloseSelectedChangesetsAction() {
     104    void testCloseSelectedChangesetsAction() {
    105105        CloseSelectedChangesetsAction action = new CloseSelectedChangesetsAction(new ChangesetCacheManagerModel(null) {
    106106            @Override
     
    117117     */
    118118    @Test
    119     public void testDownloadMyChangesets() {
     119    void testDownloadMyChangesets() {
    120120        TestUtils.assumeWorkingJMockit();
    121121        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
     
    140140     */
    141141    @Test
    142     public void testDownloadSelectedChangesetContentAction() {
     142    void testDownloadSelectedChangesetContentAction() {
    143143        if (GraphicsEnvironment.isHeadless()) {
    144144            TestUtils.assumeWorkingJMockit();
     
    156156     */
    157157    @Test
    158     public void testDownloadSelectedChangesetsAction() {
     158    void testDownloadSelectedChangesetsAction() {
    159159        if (GraphicsEnvironment.isHeadless()) {
    160160            TestUtils.assumeWorkingJMockit();
     
    172172     */
    173173    @Test
    174     public void testQueryAction() {
     174    void testQueryAction() {
    175175        TestUtils.assumeWorkingJMockit();
    176176
     
    217217     */
    218218    @Test
    219     public void testRemoveFromCacheAction() {
     219    void testRemoveFromCacheAction() {
    220220        RemoveFromCacheAction action = new RemoveFromCacheAction(ChangesetCacheManager.buildModel());
    221221        action.valueChanged(null);
     
    227227     */
    228228    @Test
    229     public void testShowDetailAction() {
     229    void testShowDetailAction() {
    230230        new ShowDetailAction(ChangesetCacheManager.buildModel()).actionPerformed(null);
    231231    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetCacheTableColumnModelTest.java

    r11020 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetCacheTableColumnModel} class.
    1414 */
    15 public class ChangesetCacheTableColumnModelTest {
     15class ChangesetCacheTableColumnModelTest {
    1616
    1717    /**
    1818     * Setup tests
    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 testChangesetCacheTableColumnModel() {
     28    void testChangesetCacheTableColumnModel() {
    2929        assertNotNull(new ChangesetCacheTableColumnModel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetContentPanel} class.
    1414 */
    15 public class ChangesetContentPanelTest {
     15class ChangesetContentPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testChangesetContentPanel() {
     28    void testChangesetContentPanel() {
    2929        assertNotNull(new ChangesetContentPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDetailPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetDetailPanel} class.
    1414 */
    15 public class ChangesetDetailPanelTest {
     15class ChangesetDetailPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testChangesetDetailPanel() {
     28    void testChangesetDetailPanel() {
    2929        assertNotNull(new ChangesetDetailPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetDiscussionPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetDiscussionPanel} class.
    1414 */
    15 public class ChangesetDiscussionPanelTest {
     15class ChangesetDiscussionPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testChangesetDiscussionPanel() {
     28    void testChangesetDiscussionPanel() {
    2929        assertNotNull(new ChangesetDiscussionPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetTagsPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetTagsPanel} class.
    1414 */
    15 public class ChangesetTagsPanelTest {
     15class ChangesetTagsPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testChangesetTagsPanel() {
     28    void testChangesetTagsPanel() {
    2929        assertNotNull(new ChangesetTagsPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/AdvancedChangesetQueryPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset.query;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 AdvancedChangesetQueryPanel} class.
    1414 */
    15 public class AdvancedChangesetQueryPanelTest {
     15class AdvancedChangesetQueryPanelTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testAdvancedChangesetQueryPanel() {
     28    void testAdvancedChangesetQueryPanel() {
    2929        assertNotNull(new AdvancedChangesetQueryPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/BasicChangesetQueryPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset.query;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 BasicChangesetQueryPanel} class.
    1414 */
    15 public class BasicChangesetQueryPanelTest {
     15class BasicChangesetQueryPanelTest {
    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();
     
    2626     */
    2727    @Test
    28     public void testBasicChangesetQueryPanel() {
     28    void testBasicChangesetQueryPanel() {
    2929        assertNotNull(new BasicChangesetQueryPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/changeset/query/UrlBasedQueryPanelTest.java

    r13617 r17275  
    22package org.openstreetmap.josm.gui.dialogs.changeset.query;
    33
    4 import static org.junit.Assert.assertNotNull;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    7 import org.junit.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
    1010
     
    1414 * Unit tests of {@link UrlBasedQueryPanel} class.
    1515 */
    16 public class UrlBasedQueryPanelTest {
     16class UrlBasedQueryPanelTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testUrlBasedQueryPanel() {
     29    void testUrlBasedQueryPanel() {
    3030        assertNotNull(new UrlBasedQueryPanel());
    3131    }
     
    3535     */
    3636    @Test
    37     public void testExamplesAreCorrect() {
     37    void testExamplesAreCorrect() {
    3838        for (String example : UrlBasedQueryPanel.getExamples()) {
    39             assertTrue(example, UrlBasedQueryPanel.isValidChangesetQueryUrl(example));
     39            assertTrue(UrlBasedQueryPanel.isValidChangesetQueryUrl(example), example);
    4040        }
    4141    }
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/CycleLayerActionTest.java

    r15923 r17275  
    22package org.openstreetmap.josm.gui.dialogs.layer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.openstreetmap.josm.tools.I18n.tr;
    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.data.imagery.ImageryInfo;
    1111import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
     
    2424 * @author Taylor Smock
    2525 */
    26 public class CycleLayerActionTest {
     26class CycleLayerActionTest {
    2727    /** Layers need a projection */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection().fakeImagery();
     
    3737     * Set up common items (make layers, etc.)
    3838     */
    39     @Before
     39    @BeforeEach
    4040    public void setUp() {
    4141        cycleDown = new CycleLayerDownAction();
     
    5151     */
    5252    @Test
    53     public void testDownBottom() {
     53    void testDownBottom() {
    5454        manager.setActiveLayer(manager.getLayers().get(0));
    5555        cycleDown.actionPerformed(null);
     
    6161     */
    6262    @Test
    63     public void testUpTop() {
     63    void testUpTop() {
    6464        manager.setActiveLayer(manager.getLayers().get(manager.getLayers().size() - 1));
    6565        cycleUp.actionPerformed(null);
     
    7171     */
    7272    @Test
    73     public void testDown() {
     73    void testDown() {
    7474        manager.setActiveLayer(manager.getLayers().get(3));
    7575        cycleDown.actionPerformed(null);
     
    8181     */
    8282    @Test
    83     public void testUp() {
     83    void testUp() {
    8484        manager.setActiveLayer(manager.getLayers().get(3));
    8585        cycleUp.actionPerformed(null);
     
    9191     */
    9292    @Test
    93     public void testNoLayers() {
     93    void testNoLayers() {
    9494        manager.getLayers().forEach(manager::removeLayer);
    9595        cycleUp.actionPerformed(null);
     
    102102     */
    103103    @Test
    104     public void testWithAerialImagery() {
     104    void testWithAerialImagery() {
    105105        final ImageryInfo magentaTilesInfo = ImageryLayerInfo.instance.getLayers().stream()
    106106                .filter(i -> i.getName().equals("Magenta Tiles")).findAny().get();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/DuplicateActionTest.java

    r12636 r17275  
    22package org.openstreetmap.josm.gui.dialogs.layer;
    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;
     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;
    88
    99import java.io.InputStream;
    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.gui.MainApplication;
     
    2222 * Unit tests of {@link DuplicateAction} class.
    2323 */
    24 public class DuplicateActionTest {
     24class DuplicateActionTest {
    2525    /**
    2626     * TMS layer needs prefs. Platform for LayerListDialog shortcuts.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3535     */
    3636    @Test
    37     public void testTicket4539() throws Exception {
     37    void testTicket4539() throws Exception {
    3838        try (InputStream is = TestUtils.getRegressionDataStream(4539, "josm_error_#4539.osm.zip")) {
    3939            OsmDataLayer layer = new OsmDataLayer(OsmReader.parseDataSet(is, null), null, null);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityActionTest.java

    r15650 r17275  
    22package org.openstreetmap.josm.gui.dialogs.layer;
    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.gui.MainApplication;
    1111import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    2020 * Unit tests of {@link LayerVisibilityAction} class.
    2121 */
    22 public class LayerVisibilityActionTest {
     22class LayerVisibilityActionTest {
    2323    /**
    2424     * TMS layer needs prefs. Platform for LayerListDialog shortcuts.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().preferences().projection().main();
     
    3232     */
    3333    @Test
    34     public void testLayerVisibilityAction() {
     34    void testLayerVisibilityAction() {
    3535        TMSLayer layer = TMSLayerTest.createTmsLayer();
    3636        LayerListModel model = new LayerListDialog(MainApplication.getLayerManager()) {
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesCellRendererTest.java

    r16319 r17275  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.function.IntFunction;
     
    1010import javax.swing.table.DefaultTableModel;
    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.JOSMTestRules;
    1515
     
    1919 * Unit tests of {@link PropertiesCellRenderer} class.
    2020 */
    21 public class PropertiesCellRendererTest {
     21class PropertiesCellRendererTest {
    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().preferences();
     
    3232     */
    3333    @Test
    34     public void testColorRendering() {
     34    void testColorRendering() {
    3535        PropertiesCellRenderer renderer = new PropertiesCellRenderer();
    3636        DefaultTableModel tableModel = new DefaultTableModel(new Object[][]{
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialogTest.java

    r15822 r17275  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.ArrayList;
    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.data.coor.LatLon;
    1212import org.openstreetmap.josm.data.osm.Node;
     
    2020 * Unit tests of {@link PropertiesDialog} class.
    2121 */
    22 public class PropertiesDialogTest {
     22class PropertiesDialogTest {
    2323
    2424    /**
    2525     * Setup tests
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    3737     */
    3838    @Test
    39     public void testTicket12504() {
     39    void testTicket12504() {
    4040        List<OsmPrimitive> sel = new ArrayList<>();
    4141        // 160 objects with foo=bar, 400 objects without foo
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/RecentTagCollectionTest.java

    r12842 r17275  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    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;
    99import java.util.Collections;
    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.Tag;
    1414import org.openstreetmap.josm.data.osm.search.SearchParseError;
     
    2222 * Unit tests of {@link RecentTagCollection} class.
    2323 */
    24 public class RecentTagCollectionTest {
     24class RecentTagCollectionTest {
    2525
    2626    /**
    2727     * Setup tests
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3737     */
    3838    @Test
    39     public void testVarious() throws SearchParseError {
     39    void testVarious() throws SearchParseError {
    4040        final RecentTagCollection recentTags = new RecentTagCollection(2);
    4141        assertTrue(recentTags.isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TagEditHelperTest.java

    r16321 r17275  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
    77
    88import java.awt.GraphicsEnvironment;
     
    2121import javax.swing.table.DefaultTableModel;
    2222
    23 import org.junit.Rule;
    24 import org.junit.Test;
     23import org.junit.jupiter.api.extension.RegisterExtension;
     24import org.junit.jupiter.api.Test;
    2525import org.openstreetmap.josm.TestUtils;
    2626import org.openstreetmap.josm.data.coor.LatLon;
     
    4444 * Unit tests of {@link TagEditHelper} class.
    4545 */
    46 public class TagEditHelperTest {
     46class TagEditHelperTest {
    4747
    4848    /**
    4949     * Setup tests
    5050     */
    51     @Rule
     51    @RegisterExtension
    5252    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5353    public JOSMTestRules test = new JOSMTestRules().territories().projection();
     
    6464     */
    6565    @Test
    66     public void testAcItemComparator() {
     66    void testAcItemComparator() {
    6767        List<AutoCompletionItem> list = new ArrayList<>();
    6868        list.add(new AutoCompletionItem("Bing Sat"));
     
    8181     */
    8282    @Test
    83     public void testContainsDataKey() {
     83    void testContainsDataKey() {
    8484        assertFalse(newTagEditHelper().containsDataKey("foo"));
    8585        // TODO: complete test
     
    9292     */
    9393    @Test
    94     public void testTicket18764() throws Exception {
     94    void testTicket18764() throws Exception {
    9595        testIcon("*[building] ⧉ *[highway] { text: tr(\"Building crossing highway\"); }", ds -> {
    9696            Way way = TestUtils.newWay("", new Node(LatLon.NORTH_POLE), new Node(LatLon.SOUTH_POLE));
     
    106106     */
    107107    @Test
    108     public void testTicket18798() throws Exception {
     108    void testTicket18798() throws Exception {
    109109        testIcon("node:righthandtraffic[junction=roundabout] { text: tr(\"Roundabout node\"); }", ds -> {
    110110            Node node = new Node(LatLon.NORTH_POLE);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/properties/TaginfoActionTest.java

    r16606 r17275  
    22package org.openstreetmap.josm.gui.dialogs.properties;
    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 javax.swing.Action;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.data.osm.Tag;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1515
    16 public class TaginfoActionTest {
     16class TaginfoActionTest {
    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 testTaginfoUrls() {
     29    void testTaginfoUrls() {
    3030        TaginfoAction action = new TaginfoAction(() -> null, () -> null);
    3131        assertEquals("https://taginfo.openstreetmap.org/keys/railway", action.getTaginfoUrlForTag(new Tag("railway")));
     
    4040     */
    4141    @Test
    42     public void testCustomInstance() {
     42    void testCustomInstance() {
    4343        TaginfoAction action = new TaginfoAction(() -> null, () -> null).withTaginfoUrl("example.com", "https://taginfo.example.com////");
    4444        assertEquals("example.com", action.getValue(Action.NAME));
     
    5050     */
    5151    @Test
    52     public void testTagHistoryUrls() throws Exception {
     52    void testTagHistoryUrls() {
    5353        TaginfoAction action = new TaginfoAction(() -> null, () -> null).toTagHistoryAction();
    5454        assertEquals("https://taghistory.raifer.tech/#***/railway/", action.getTaginfoUrlForTag(new Tag("railway")));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/ChildRelationBrowserTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.osm.DataSet;
    99import org.openstreetmap.josm.data.osm.Relation;
     
    1616 * Unit tests of {@link ChildRelationBrowser} class.
    1717 */
    18 public class ChildRelationBrowserTest {
     18class ChildRelationBrowserTest {
    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().preferences();
     
    2929     */
    3030    @Test
    31     public void testChildRelationBrowser() {
     31    void testChildRelationBrowser() {
    3232        DataSet ds = new DataSet();
    3333        Relation r = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditorTest.java

    r16652 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    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;
    77
    88import java.util.Collections;
     
    1111import javax.swing.JPanel;
    1212
    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;
    1616import org.openstreetmap.josm.data.osm.DataSet;
     
    3535     * Setup test.
    3636     */
    37     @Rule
     37    @RegisterExtension
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3939    public JOSMTestRules test = new JOSMTestRules().preferences().main();
     
    8585     */
    8686    @Test
    87     public void testAddPrimitivesToRelation() {
     87    void testAddPrimitivesToRelation() {
    8888        TestUtils.assumeWorkingJMockit();
    8989        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker();
     
    117117     */
    118118    @Test
    119     public void testBuild() {
     119    void testBuild() {
    120120        DataSet ds = new DataSet();
    121121        Relation relation = new Relation(1);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableLinkedCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    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.gui.dialogs.relation.sort.WayConnectionType;
     
    1717 * Unit tests of {@link MemberTableLinkedCellRenderer} class.
    1818 */
    19 public class MemberTableLinkedCellRendererTest {
     19class MemberTableLinkedCellRendererTest {
    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 testMemberTableLinkedCellRenderer() {
     32    void testMemberTableLinkedCellRenderer() {
    3333        MemberTableLinkedCellRenderer r = new MemberTableLinkedCellRenderer();
    3434        assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableMemberCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    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.DataSet;
    1111import org.openstreetmap.josm.data.osm.Node;
     
    1818 * Unit tests of {@link MemberTableMemberCellRenderer} class.
    1919 */
    20 public class MemberTableMemberCellRendererTest {
     20class MemberTableMemberCellRendererTest {
    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().preferences();
     
    3131     */
    3232    @Test
    33     public void testMemberTableMemberCellRenderer() {
     33    void testMemberTableMemberCellRenderer() {
    3434        MemberTableMemberCellRenderer r = new MemberTableMemberCellRenderer();
    3535        assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.util.Collection;
     
    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.OsmPrimitive;
     
    2121 * Unit tests of {@link MemberTableModel} class.
    2222 */
    23 public class MemberTableModelTest {
     23class MemberTableModelTest {
    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();
     
    3434     */
    3535    @Test
    36     public void testTicket12443() {
     36    void testTicket12443() {
    3737        final Node n = new Node(1);
    3838        assertNotNull(new MemberTableModel(null, null, new TaggingPresetHandler() {
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/MemberTableRoleCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    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.DataSet;
    1111import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    1717 * Unit tests of {@link MemberTableRoleCellRenderer} class.
    1818 */
    19 public class MemberTableRoleCellRendererTest {
     19class MemberTableRoleCellRendererTest {
    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 testMemberTableRoleCellRenderer() {
     32    void testMemberTableRoleCellRenderer() {
    3333        MemberTableRoleCellRenderer r = new MemberTableRoleCellRenderer();
    3434        assertEquals(r, r.getTableCellRendererComponent(null, null, false, false, 0, 0));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/ReferringRelationsBrowserTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    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.data.osm.DataSet;
    77import org.openstreetmap.josm.data.osm.Relation;
     
    1414 * Unit tests of {@link ReferringRelationsBrowser} class.
    1515 */
    16 public class ReferringRelationsBrowserTest {
     16class ReferringRelationsBrowserTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testReferringRelationsBrowser() {
     29    void testReferringRelationsBrowser() {
    3030        DataSet ds = new DataSet();
    3131        Relation r = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/RelationTreeCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTree;
    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.Relation;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link RelationTreeCellRenderer} class.
    1717 */
    18 public class RelationTreeCellRendererTest {
     18class RelationTreeCellRendererTest {
    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().preferences();
     
    2929     */
    3030    @Test
    31     public void testRelationTreeCellRenderer() {
     31    void testRelationTreeCellRenderer() {
    3232        RelationTreeCellRenderer r = new RelationTreeCellRenderer();
    3333        assertEquals(r, r.getTreeCellRendererComponent(new JTree(), new Relation(), false, false, false, 0, false));
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    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.Node;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link SelectionTableCellRenderer} class.
    1717 */
    18 public class SelectionTableCellRendererTest {
     18class SelectionTableCellRendererTest {
    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().preferences();
     
    2929     */
    3030    @Test
    31     public void testSelectionTableCellRenderer() {
     31    void testSelectionTableCellRenderer() {
    3232        MemberTableModel model = new MemberTableModel(null, null, null);
    3333        SelectionTableCellRenderer r = new SelectionTableCellRenderer(model);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/SelectionTableTest.java

    r12636 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation;
    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
    77import java.awt.event.MouseEvent;
    88import java.awt.event.MouseListener;
    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.osm.DataSet;
     
    2525 * Unit tests of {@link SelectionTable} class.
    2626 */
    27 public class SelectionTableTest {
     27class SelectionTableTest {
    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 testSelectionTable() {
     40    void testSelectionTable() {
    4141        // Constructs a relation with a member
    4242        DataSet ds = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/AbstractRelationEditorActionTest.java

    r14138 r17275  
    66import java.util.List;
    77
    8 import org.junit.Before;
    9 import org.junit.Ignore;
    10 import org.junit.Rule;
     8import org.junit.jupiter.api.BeforeEach;
     9import org.junit.jupiter.api.Disabled;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.data.osm.DataSet;
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3131 * @author Michael Zangl
    3232 */
    33 @Ignore
     33@Disabled
    3434public abstract class AbstractRelationEditorActionTest {
    3535    /**
    3636     * Platform for tooltips.
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules().preferences().main();
     
    9191     * Set up the test data required for common tests using one relation.
    9292     */
    93     @Before
     93    @BeforeEach
    9494    public void setupTestData() {
    9595        DataSet ds = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/PasteMembersActionTest.java

    r14028 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation.actions;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertSame;
    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.assertSame;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.Collections;
    1010import java.util.Set;
    1111
    12 import org.junit.Test;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.osm.Node;
    1414import org.openstreetmap.josm.data.osm.Relation;
     
    2424 * @author Michael Zangl
    2525 */
    26 public class PasteMembersActionTest extends AbstractRelationEditorActionTest {
     26class PasteMembersActionTest extends AbstractRelationEditorActionTest {
    2727    /**
    2828     * Test {@link PasteMembersAction#isEnabled()}
    2929     */
    3030    @Test
    31     public void testEnabledState() {
     31    void testEnabledState() {
    3232        copyString();
    3333
     
    6565     */
    6666    @Test
    67     public void testActionWrongClipboard() {
     67    void testActionWrongClipboard() {
    6868        copyString();
    6969        PasteMembersAction action = new PasteMembersAction(relationEditorAccess);
     
    7979     */
    8080    @Test
    81     public void testActionForMembers() {
     81    void testActionForMembers() {
    8282        Node testNode = new Node(10);
    8383        layer.data.addPrimitive(testNode);
     
    9797     */
    9898    @Test
    99     public void testActionForPrimitives() {
     99    void testActionForPrimitives() {
    100100        Node testNode = new Node(10);
    101101        layer.data.addPrimitive(testNode);
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/actions/RelationEditorActionsTest.java

    r16160 r17275  
    22package org.openstreetmap.josm.gui.dialogs.relation.actions;
    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.Component;
    88import java.awt.Container;
     9
    910import javax.swing.Icon;
    1011import javax.swing.JOptionPane;
    1112import javax.swing.text.JTextComponent;
    1213
     14import org.junit.jupiter.api.Test;
    1315import org.openstreetmap.josm.TestUtils;
    1416import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
     
    1820import mockit.MockUp;
    1921
    20 import org.junit.Test;
    21 
    2222/**
    2323 * Unit tests for relation editor actions.
    2424 */
    25 public class RelationEditorActionsTest extends AbstractRelationEditorActionTest {
     25class RelationEditorActionsTest extends AbstractRelationEditorActionTest {
    2626
    2727    /**
     
    2929     */
    3030    @Test
    31     public void testNoDialogActions() {
     31    void testNoDialogActions() {
    3232        new AddSelectedAfterSelection(relationEditorAccess).actionPerformed(null);
    3333        new AddSelectedBeforeSelection(relationEditorAccess).actionPerformed(null);
     
    6969     */
    7070    @Test
    71     public void testDeleteCurrentRelationAction() {
     71    void testDeleteCurrentRelationAction() {
    7272        TestUtils.assumeWorkingJMockit();
    7373        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker() {
     74            @Override
    7475            public String getStringFromOriginalMessage(Object originalMessage) {
    7576                return ((JTextComponent) ((Container) originalMessage).getComponent(0)).getText();
     
    105106     */
    106107    @Test
    107     public void testSetRoleAction() {
     108    void testSetRoleAction() {
    108109        TestUtils.assumeWorkingJMockit();
    109110        final JOptionPaneSimpleMocker.MessagePanelMocker mpMocker = new JOptionPaneSimpleMocker.MessagePanelMocker();
     
    111112        // complexity, but this is quite a simple use of showOptionDialog which we can mock from scratch.
    112113        final boolean[] jopMockerCalled = new boolean[] {false};
    113         final MockUp<JOptionPane> jopMocker = new MockUp<JOptionPane>() {
     114        new MockUp<JOptionPane>() {
    114115            @Mock
    115116            public int showOptionDialog(
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/RelationSorterTest.java

    r16886 r17275  
    99
    1010import org.junit.Assert;
    11 import org.junit.Before;
    12 import org.junit.Rule;
    13 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeEach;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.data.osm.DataSet;
    1515import org.openstreetmap.josm.data.osm.Relation;
     
    2525 * Unit tests of {@link RelationSorter} class.
    2626 */
    27 public class RelationSorterTest {
     27class RelationSorterTest {
    2828
    2929    private final RelationSorter sorter = new RelationSorter();
     
    3333     * Use Mercator projection
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    4242     * @throws IOException in case of I/O error
    4343     */
    44     @Before
     44    @BeforeEach
    4545    public void loadData() throws IllegalDataException, IOException {
    4646        if (testDataset == null) {
     
    6464
    6565    @Test
    66     public void testGeneric() {
     66    void testGeneric() {
    6767        String[] actual = getNames(sorter.sortMembers(getRelation("generic").getMembers()));
    6868        final String[] expected = {"t1w4", "t1w3", "t1w2", "t1w1", "t1w7", "t1w6", "t1w5", "t1n1", "t1n2"};
     
    7373
    7474    @Test
    75     public void testAssociatedStreet() {
     75    void testAssociatedStreet() {
    7676        String[] actual = getNames(sorter.sortMembers(getRelation("associatedStreet").getMembers()));
    7777        Assert.assertArrayEquals(new String[] {"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4"}, actual);
     
    7979
    8080    @Test
    81     public void testStreet() {
     81    void testStreet() {
    8282        String[] actual = getNames(sorter.sortMembers(getRelation("street").getMembers()));
    8383        Assert.assertArrayEquals(new String[]{"t2w1", "t2w2", "t2n1", "t2n2", "t2n3", "t2n4", "playground", "tree"}, actual);
     
    9090
    9191    @Test
    92     public void testThreeLoopsEndsLoop() {
     92    void testThreeLoopsEndsLoop() {
    9393        Relation relation = getRelation("three-loops-ends-loop");
    9494        // Check the first way before sorting, otherwise the sorter
     
    106106
    107107    @Test
    108     public void testThreeLoopsEndsWay() {
     108    void testThreeLoopsEndsWay() {
    109109        Relation relation = getRelation("three-loops-ends-way");
    110110        // Check the first way before sorting, otherwise the sorter
     
    122122
    123123    @Test
    124     public void testThreeLoopsEndsNode() {
     124    void testThreeLoopsEndsNode() {
    125125        Relation relation = getRelation("three-loops-ends-node");
    126126        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
     
    133133
    134134    @Test
    135     public void testOneLoopEndsSplit() {
     135    void testOneLoopEndsSplit() {
    136136        Relation relation = getRelation("one-loop-ends-split");
    137137        String[] actual = getNames(sorter.sortMembers(relation.getMembers()));
     
    144144
    145145    @Test
    146     public void testNoLoopEndsSplit() {
     146    void testNoLoopEndsSplit() {
    147147        Relation relation = getRelation("no-loop-ends-split");
    148148        // TODO: This is not yet sorted properly, so this route is
     
    157157
    158158    @Test
    159     public void testIncompleteLoops() {
     159    void testIncompleteLoops() {
    160160        Relation relation = getRelation("incomplete-loops");
    161161        // TODO: This is not yet sorted perfectly (might not be possible)
     
    169169
    170170    @Test
    171     public void testParallelOneWay() {
     171    void testParallelOneWay() {
    172172        Relation relation = getRelation("parallel-oneway");
    173173        // TODO: This is not always sorted properly, only when the right
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/relation/sort/WayConnectionTypeCalculatorTest.java

    r16913 r17275  
    1313
    1414import org.junit.Assert;
    15 import org.junit.Before;
    16 import org.junit.Rule;
    17 import org.junit.Test;
     15import org.junit.jupiter.api.BeforeEach;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.openstreetmap.josm.data.osm.DataSet;
    1919import org.openstreetmap.josm.data.osm.Node;
     
    3131 * Unit tests of {@link WayConnectionTypeCalculator} class.
    3232 */
    33 public class WayConnectionTypeCalculatorTest {
     33class WayConnectionTypeCalculatorTest {
    3434
    3535    private final RelationSorter sorter = new RelationSorter();
     
    4040     * Use Mercator projection
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    4949     * @throws IOException in case of I/O error
    5050     */
    51     @Before
     51    @BeforeEach
    5252    public void loadData() throws IllegalDataException, IOException {
    5353        if (testDataset == null) {
     
    100100
    101101    @Test
    102     public void testEmpty() {
     102    void testEmpty() {
    103103        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(new ArrayList<>()));
    104104        Assert.assertEquals("[]", actual);
     
    110110
    111111    @Test
    112     public void testGeneric() {
     112    void testGeneric() {
    113113        Relation relation = getRelation("generic");
    114114        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
     
    119119
    120120    @Test
    121     public void testAssociatedStreet() {
     121    void testAssociatedStreet() {
    122122        Relation relation = getRelation("associatedStreet");
    123123        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
     
    128128
    129129    @Test
    130     public void testLoop() {
     130    void testLoop() {
    131131        Relation relation = getRelation("loop");
    132132        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(relation.getMembers()));
     
    143143
    144144    @Test
    145     public void testThreeLoopsEndsLoop() {
     145    void testThreeLoopsEndsLoop() {
    146146        Relation relation = getRelation("three-loops-ends-loop");
    147147        // Check the first way before sorting, otherwise the sorter
     
    159159
    160160    @Test
    161     public void testThreeLoopsEndsWay() {
     161    void testThreeLoopsEndsWay() {
    162162        Relation relation = getRelation("three-loops-ends-way");
    163163        // Check the first way before sorting, otherwise the sorter
     
    175175
    176176    @Test
    177     public void testThreeLoopsEndsNode() {
     177    void testThreeLoopsEndsNode() {
    178178        Relation relation = getRelation("three-loops-ends-node");
    179179        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
     
    187187
    188188    @Test
    189     public void testOneLoopEndsSplit() {
     189    void testOneLoopEndsSplit() {
    190190        Relation relation = getRelation("one-loop-ends-split");
    191191        String actual = getConnections(wayConnectionTypeCalculator.updateLinks(sorter.sortMembers(relation.getMembers())));
     
    199199
    200200    @Test
    201     public void testNoLoopEndsSplit() {
     201    void testNoLoopEndsSplit() {
    202202        Relation relation = getRelation("no-loop-ends-split");
    203203        // TODO: This is not yet sorted properly, so this route is
     
    212212
    213213    @Test
    214     public void testIncompleteLoops() {
     214    void testIncompleteLoops() {
    215215        Relation relation = getRelation("incomplete-loops");
    216216        // TODO: This is not yet sorted perfectly (might not be possible)
     
    225225
    226226    @Test
    227     public void testParallelOneWay() {
     227    void testParallelOneWay() {
    228228        Relation relation = getRelation("parallel-oneway");
    229229        // TODO: This is not always sorted properly, only when the right
     
    250250     */
    251251    @Test
    252     public void testDirectionsOnewaysOnly() {
     252    void testDirectionsOnewaysOnly() {
    253253        Relation relation = getRelation("direction");
    254254
     
    318318     */
    319319    @Test
    320     public void testDirectionsOnewayMix() {
     320    void testDirectionsOnewayMix() {
    321321        Relation relation = getRelation("direction");
    322322
  • trunk/test/unit/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanelTest.java

    r11182 r17275  
    22package org.openstreetmap.josm.gui.dialogs.validator;
    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;
    77
    88import java.util.ArrayList;
     
    1313import java.util.Set;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.data.osm.Node;
    1818import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2626 * Unit tests of {@link ValidatorTreePanel} class.
    2727 */
    28 public class ValidatorTreePanelTest {
     28class ValidatorTreePanelTest {
    2929
    3030    /**
    3131     * Setup tests
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3939     */
    4040    @Test
    41     public void testValidatorTreePanel() {
     41    void testValidatorTreePanel() {
    4242        assertNotNull(new ValidatorTreePanel());
    4343
  • trunk/test/unit/org/openstreetmap/josm/gui/download/BookmarkSelectionTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.download;
    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.data.Bounds;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1212 * Unit tests of {@link BookmarkSelection} class.
    1313 */
    14 public class BookmarkSelectionTest {
     14class BookmarkSelectionTest {
    1515
    1616    /**
    1717     * Setup tests
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testBookmarkSelection() {
     27    void testBookmarkSelection() {
    2828        BookmarkSelection sel = new BookmarkSelection();
    2929        sel.addGui(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/download/BoundingBoxSelectionTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.download;
    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.data.Bounds;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1212 * Unit tests of {@link BoundingBoxSelection} class.
    1313 */
    14 public class BoundingBoxSelectionTest {
     14class BoundingBoxSelectionTest {
    1515
    1616    /**
    1717     * Setup tests
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testBoundingBoxSelection() {
     27    void testBoundingBoxSelection() {
    2828        BoundingBoxSelection sel = new BoundingBoxSelection();
    2929        sel.addGui(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/download/PlaceSelectionTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.download;
    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.data.Bounds;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1212 * Unit tests of {@link PlaceSelection} class.
    1313 */
    14 public class PlaceSelectionTest {
     14class PlaceSelectionTest {
    1515
    1616    /**
    1717     * Setup tests
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testBookmarkSelection() {
     27    void testBookmarkSelection() {
    2828        PlaceSelection sel = new PlaceSelection();
    2929        sel.addGui(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/download/TileSelectionTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.download;
    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.data.Bounds;
    77import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1212 * Unit tests of {@link TileSelection} class.
    1313 */
    14 public class TileSelectionTest {
     14class TileSelectionTest {
    1515
    1616    /**
    1717     * Setup tests
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testTileSelection() {
     27    void testTileSelection() {
    2828        TileSelection sel = new TileSelection();
    2929        sel.addGui(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HelpContentReaderTest.java

    r13920 r17275  
    22package org.openstreetmap.josm.gui.help;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.testutils.JOSMTestRules;
    910
     
    1314 * Unit tests of {@link HelpContentReader} class.
    1415 */
    15 public class HelpContentReaderTest {
     16class HelpContentReaderTest {
    1617
    1718    /**
    1819     * Setup tests
    1920     */
    20     @Rule
     21    @RegisterExtension
    2122    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2223    public JOSMTestRules test = new JOSMTestRules().timeout(30000);
     
    2425    /**
    2526     * Unit test of {@link HelpContentReader#fetchHelpTopicContent} - null case.
    26      * @throws HelpContentReaderException always
    2727     */
    28     @Test(expected = HelpContentReaderException.class)
    29     public void testFetchHelpTopicContentNull() throws HelpContentReaderException {
    30         new HelpContentReader(null).fetchHelpTopicContent(null, false);
     28    @Test
     29    void testFetchHelpTopicContentNull() {
     30        assertThrows(HelpContentReaderException.class, () -> new HelpContentReader(null).fetchHelpTopicContent(null, false));
    3131    }
    3232
     
    3636     */
    3737    @Test
    38     public void testFetchHelpTopicContentNominal() throws HelpContentReaderException {
     38    void testFetchHelpTopicContentNominal() throws HelpContentReaderException {
    3939        String res = new HelpContentReader(HelpUtil.getWikiBaseUrl()).fetchHelpTopicContent(HelpBrowserTest.URL_1, false);
    4040        assertFalse(res.trim().isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/gui/help/HyperlinkHandlerTest.java

    r14807 r17275  
    22package org.openstreetmap.josm.gui.help;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.StringReader;
     
    1111import javax.swing.text.html.HTMLEditorKit;
    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.gui.widgets.JosmEditorPane;
    1616import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * Unit tests of {@link HyperlinkHandler} class.
    2222 */
    23 public class HyperlinkHandlerTest {
     23class HyperlinkHandlerTest {
    2424
    2525    /**
    2626     * Setup tests
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3535     */
    3636    @Test
    37     public void testTicket17338() throws Exception {
     37    void testTicket17338() throws Exception {
    3838        JosmEditorPane help = new JosmEditorPane();
    3939        HTMLEditorKit htmlKit = new HTMLEditorKit();
  • trunk/test/unit/org/openstreetmap/josm/gui/history/CoordinateInfoViewerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.testutils.JOSMTestRules;
    910
     
    1314 * Unit tests of {@link CoordinateInfoViewer} class.
    1415 */
    15 public class CoordinateInfoViewerTest {
     16class CoordinateInfoViewerTest {
    1617
    1718    /**
    1819     * Setup test.
    1920     */
    20     @Rule
     21    @RegisterExtension
    2122    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2223    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2526     * Test for {@link CoordinateInfoViewer#CoordinateInfoViewer} - {@code null} handling.
    2627     */
    27     @Test(expected = IllegalArgumentException.class)
    28     public void testCoordinateInfoViewerNull() {
    29         new CoordinateInfoViewer(null);
     28    @Test
     29    void testCoordinateInfoViewerNull() {
     30        assertThrows(IllegalArgumentException.class, () -> new CoordinateInfoViewer(null));
    3031    }
    3132
     
    3435     */
    3536    @Test
    36     public void testCoordinateInfoViewerNominal() {
     37    void testCoordinateInfoViewerNominal() {
    3738        assertNotNull(new CoordinateInfoViewer(new HistoryBrowserModel()));
    3839    }
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserDialogTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.history;
    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.data.osm.OsmPrimitiveType;
    1111import org.openstreetmap.josm.data.osm.User;
     
    2222 * Unit tests of {@link HistoryBrowserDialog} class.
    2323 */
    24 public class HistoryBrowserDialogTest {
     24class HistoryBrowserDialogTest {
    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 testBuildTitle() {
     37    void testBuildTitle() {
    3838        HistoryDataSet hds = new HistoryDataSet();
    3939        User user = User.createOsmUser(1, "");
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java

    r13509 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotEquals;
    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.assertNotEquals;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    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.OsmPrimitiveType;
     
    2424 * Unit tests of {@link HistoryBrowserModel} class.
    2525 */
    26 public class HistoryBrowserModelTest {
     26class HistoryBrowserModelTest {
    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().preferences().devAPI().timeout(30000);
     
    3737     */
    3838    @Test
    39     public void testHistoryBrowserModel() {
     39    void testHistoryBrowserModel() {
    4040        HistoryBrowserModel model = new HistoryBrowserModel();
    4141        assertNotNull(model.getVersionTableModel());
     
    5757     */
    5858    @Test
    59     public void testGetTagTableModel() {
     59    void testGetTagTableModel() {
    6060        HistoryBrowserModel model = new HistoryBrowserModel();
    6161        TagTableModel t1 = model.getTagTableModel(PointInTimeType.CURRENT_POINT_IN_TIME);
     
    7070     */
    7171    @Test
    72     public void testGetNodeListTableModel() {
     72    void testGetNodeListTableModel() {
    7373        HistoryBrowserModel model = new HistoryBrowserModel();
    7474        DiffTableModel t1 = model.getNodeListTableModel(PointInTimeType.CURRENT_POINT_IN_TIME);
     
    8383     */
    8484    @Test
    85     public void testGetRelationMemberTableModel() {
     85    void testGetRelationMemberTableModel() {
    8686        HistoryBrowserModel model = new HistoryBrowserModel();
    8787        DiffTableModel t1 = model.getRelationMemberTableModel(PointInTimeType.CURRENT_POINT_IN_TIME);
     
    9696     */
    9797    @Test
    98     public void testSetPointsInTimeNullHistory() {
     98    void testSetPointsInTimeNullHistory() {
    9999        HistoryBrowserModel model = new HistoryBrowserModel();
    100100        VersionTableModel tableModel = model.getVersionTableModel();
     
    109109     */
    110110    @Test
    111     public void testSetPointsInTimeNodeHistory() {
     111    void testSetPointsInTimeNodeHistory() {
    112112        SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.NODE);
    113113        new HistoryLoadTask().add(id).run();
     
    132132     */
    133133    @Test
    134     public void testSetPointsInTimeWayHistory() {
     134    void testSetPointsInTimeWayHistory() {
    135135        SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.WAY);
    136136        new HistoryLoadTask().add(id).run();
     
    155155     */
    156156    @Test
    157     public void testSetPointsInTimeRelationHistory() {
     157    void testSetPointsInTimeRelationHistory() {
    158158        SimplePrimitiveId id = new SimplePrimitiveId(2, OsmPrimitiveType.RELATION);
    159159        new HistoryLoadTask().add(id).run();
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryLoadTaskTest.java

    r13435 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
    77import java.io.InputStream;
    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;
     
    3030 * Unit tests of {@link HistoryLoadTask} class.
    3131 */
    32 public class HistoryLoadTaskTest {
     32class HistoryLoadTaskTest {
    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().preferences().devAPI().timeout(20000);
     
    4343     */
    4444    @Test
    45     public void testGetLoadingMessage() {
     45    void testGetLoadingMessage() {
    4646        assertEquals("Loading history for node {0}", HistoryLoadTask.getLoadingMessage(new Node().getPrimitiveId()));
    4747        assertEquals("Loading history for way {0}", HistoryLoadTask.getLoadingMessage(new Way().getPrimitiveId()));
     
    5757     */
    5858    @Test
    59     public void testLoadHistory() throws OsmTransferException {
     59    void testLoadHistory() throws OsmTransferException {
    6060        HistoryDataSet ds = HistoryLoadTask.loadHistory(new OsmServerHistoryReader(OsmPrimitiveType.NODE, 0) {
    6161            @Override
  • trunk/test/unit/org/openstreetmap/josm/gui/history/NodeListViewerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.testutils.JOSMTestRules;
    910
     
    1314 * Unit tests of {@link NodeListViewer} class.
    1415 */
    15 public class NodeListViewerTest {
     16class NodeListViewerTest {
    1617
    1718    /**
    1819     * Setup test.
    1920     */
    20     @Rule
     21    @RegisterExtension
    2122    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2223    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2526     * Test for {@link NodeListViewer#NodeListViewer} - {@code null} handling.
    2627     */
    27     @Test(expected = IllegalArgumentException.class)
    28     public void testNodeListViewerNull() {
    29         new NodeListViewer(null);
     28    @Test
     29    void testNodeListViewerNull() {
     30        assertThrows(IllegalArgumentException.class, () -> new NodeListViewer(null));
    3031    }
    3132
     
    3435     */
    3536    @Test
    36     public void testNodeListViewerNominal() {
     37    void testNodeListViewerNominal() {
    3738        assertNotNull(new NodeListViewer(new HistoryBrowserModel()));
    3839    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/ActionFlagsTableCellTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.io.File;
     
    1010import javax.swing.JTable;
    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.data.osm.DataSet;
    1515import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
     
    2222 * Unit tests of {@link ActionFlagsTableCell} class.
    2323 */
    24 public class ActionFlagsTableCellTest {
     24class ActionFlagsTableCellTest {
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules();
     
    3434     */
    3535    @Test
    36     public void testActionFlagsTableCell() {
     36    void testActionFlagsTableCell() {
    3737        JTable table = new JTable();
    3838        File file = new File("test");
  • trunk/test/unit/org/openstreetmap/josm/gui/io/AsynchronousUploadPrimitivesTaskTest.java

    r16159 r17275  
    77import javax.swing.JOptionPane;
    88
    9 import org.junit.After;
    109import org.junit.Assert;
    11 import org.junit.Before;
    12 import org.junit.Rule;
    13 import org.junit.Test;
     10import org.junit.jupiter.api.AfterEach;
     11import org.junit.jupiter.api.BeforeEach;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.openstreetmap.josm.data.APIDataSet;
     
    2929 * Unit tests of {@link AsynchronousUploadPrimitivesTask}.
    3030 */
    31 public class AsynchronousUploadPrimitivesTaskTest {
     31class AsynchronousUploadPrimitivesTaskTest {
    3232
    3333    private UploadStrategySpecification strategy;
     
    4040     * Setup tests
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules().assertionsInEDT();
     
    4747     * Bootstrap.
    4848     */
    49     @Before
     49    @BeforeEach
    5050    public void bootStrap() {
    5151        DataSet dataSet = new DataSet();
     
    7171     * Tear down.
    7272     */
    73     @After
     73    @AfterEach
    7474    public void tearDown() {
    7575        toUpload = null;
     
    8787     */
    8888    @Test
    89     public void testSingleUploadInstance() {
     89    void testSingleUploadInstance() {
    9090        TestUtils.assumeWorkingJMockit();
    9191        new JOptionPaneSimpleMocker(Collections.singletonMap(
  • trunk/test/unit/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanelTest.java

    r12719 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 BasicUploadSettingsPanel} class.
    1414 */
    15 public class BasicUploadSettingsPanelTest {
     15class BasicUploadSettingsPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testBasicUploadSettingsPanel() {
     28    void testBasicUploadSettingsPanel() {
    2929        assertNotNull(new BasicUploadSettingsPanel(new ChangesetCommentModel(), new ChangesetCommentModel(), new ChangesetReviewModel()));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JList;
    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.Changeset;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link ChangesetCellRenderer} class.
    1717 */
    18 public class ChangesetCellRendererTest {
     18class ChangesetCellRendererTest {
    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();
     
    2828     */
    2929    @Test
    30     public void testChangesetCellRenderer() {
     30    void testChangesetCellRenderer() {
    3131        JList<Changeset> list = new JList<>();
    3232        Changeset cs = new Changeset();
  • trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetCommentModelTest.java

    r13994 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    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 {@link ChangesetCommentModel} class.
    1717 */
    18 public class ChangesetCommentModelTest {
     18class ChangesetCommentModelTest {
    1919
    2020    /**
    2121     * Setup tests
    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 testFindHashTags() {
     31    void testFindHashTags() {
    3232        ChangesetCommentModel model = new ChangesetCommentModel();
    3333        assertEquals(Collections.emptyList(), model.findHashTags());
  • trunk/test/unit/org/openstreetmap/josm/gui/io/ChangesetManagementPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 ChangesetManagementPanel} class.
    1414 */
    15 public class ChangesetManagementPanelTest {
     15class ChangesetManagementPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testChangesetManagementPanel() {
     28    void testChangesetManagementPanel() {
    2929        assertNotNull(new ChangesetManagementPanel(new ChangesetCommentModel()));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/CredentialDialogTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    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.gui.io.CredentialDialog.CredentialPanel;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1717 * Unit tests of {@link CredentialDialog} class.
    1818 */
    19 public class CredentialDialogTest {
     19class CredentialDialogTest {
    2020
    2121    /**
    2222     * Setup tests
    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 testCredentialPanel() {
     32    void testCredentialPanel() {
    3333        CredentialPanel cp = new CredentialPanel(null);
    3434        cp.build();
  • trunk/test/unit/org/openstreetmap/josm/gui/io/CustomConfiguratorTest.java

    r16329 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.File;
     
    1313import java.util.Collections;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.Preferences;
     
    2727 * Unit tests for class {@link CustomConfigurator}.
    2828 */
    29 public class CustomConfiguratorTest {
     29class CustomConfiguratorTest {
    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().preferences();
     
    4141     */
    4242    @Test
    43     public void testExportPreferencesKeysToFile() throws IOException {
     43    void testExportPreferencesKeysToFile() throws IOException {
    4444        File tmp = File.createTempFile("josm.testExportPreferencesKeysToFile.lorem_ipsum", ".xml");
    4545
     
    5858        assertTrue(xml.contains("<preferences operation=\"replace\">"));
    5959        for (String entry : Config.getPref().getList("lorem_ipsum")) {
    60             assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
     60            assertTrue(xml.contains(entry), entry + "\nnot found in:\n" + xml);
    6161        }
    6262
     
    6666        assertTrue(xml.contains("<preferences operation=\"append\">"));
    6767        for (String entry : Config.getPref().getList("test")) {
    68             assertTrue(entry + "\nnot found in:\n" + xml, xml.contains(entry));
     68            assertTrue(xml.contains(entry), entry + "\nnot found in:\n" + xml);
    6969        }
    7070
     
    7777     */
    7878    @Test
    79     public void testReadXML() throws IOException {
     79    void testReadXML() throws IOException {
    8080        // Test 1 - read(dir, file) + append
    8181        Config.getPref().putList("test", Collections.<String>emptyList());
     
    8383        CustomConfigurator.readXML(TestUtils.getTestDataRoot() + "customconfigurator", "append.xml");
    8484        String log = PreferencesUtils.getLog();
    85         assertFalse(log, log.contains("Error"));
     85        assertFalse(log.contains("Error"), log);
    8686        assertEquals(Arrays.asList("11111111", "2222222", "JOSM"), Config.getPref().getList("test"));
    8787
     
    9494        CustomConfigurator.readXML(new File(TestUtils.getTestDataRoot() + "customconfigurator", "replace.xml"), pref);
    9595        log = PreferencesUtils.getLog();
    96         assertFalse(log, log.contains("Error"));
     96        assertFalse(log.contains("Error"), log);
    9797        assertEquals(9, pref.getList("lorem_ipsum").size());
    9898    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.awt.GraphicsEnvironment;
     
    1414import javax.swing.JPanel;
    1515
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
     17import org.junit.jupiter.api.Test;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.data.UserIdentityManager;
     
    3232 * Unit tests of {@link DownloadOpenChangesetsTask} class.
    3333 */
    34 public class DownloadOpenChangesetsTaskTest {
     34class DownloadOpenChangesetsTaskTest {
    3535
    3636    /**
    3737     * Setup tests
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
     
    7272     */
    7373    @Test
    74     public void testAnonymous() {
     74    void testAnonymous() {
    7575        TestUtils.assumeWorkingJMockit();
    7676        if (GraphicsEnvironment.isHeadless()) {
     
    105105     */
    106106    @Test
    107     public void testPartiallyIdentified() {
     107    void testPartiallyIdentified() {
    108108        TestUtils.assumeWorkingJMockit();
    109109        if (GraphicsEnvironment.isHeadless()) {
  • trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadPrimitivesTaskTest.java

    r13435 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Arrays;
    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.DataSet;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    2121 * Unit tests of {@link DownloadPrimitivesTask} class.
    2222 */
    23 public class DownloadPrimitivesTaskTest {
     23class DownloadPrimitivesTaskTest {
    2424
    2525    /**
    2626     * Setup tests
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
     
    3434     */
    3535    @Test
    36     public void testDownloadPrimitivesTask() {
     36    void testDownloadPrimitivesTask() {
    3737        DataSet ds = new DataSet();
    3838        assertTrue(ds.allPrimitives().isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/gui/io/LayerNameAndFilePathTableCellTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    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;
    77
    88import java.io.File;
     
    1010import javax.swing.JTable;
    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.data.osm.DataSet;
    1515import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
     
    2222 * Unit tests of {@link LayerNameAndFilePathTableCell} class.
    2323 */
    24 public class LayerNameAndFilePathTableCellTest {
     24class LayerNameAndFilePathTableCellTest {
    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();
     
    3434     */
    3535    @Test
    36     public void testLayerNameAndFilePathTableCell() {
     36    void testLayerNameAndFilePathTableCell() {
    3737        JTable table = new JTable();
    3838        File file = new File("test");
  • trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayerInfoTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    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;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import java.io.File;
    89
    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.osm.DataSet;
    1213import org.openstreetmap.josm.gui.layer.AbstractModifiableLayer;
     
    1920 * Unit tests of {@link SaveLayerInfo} class.
    2021 */
    21 public class SaveLayerInfoTest {
     22class SaveLayerInfoTest {
    2223    /**
    2324     * Setup test.
    2425     */
    25     @Rule
     26    @RegisterExtension
    2627    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2728    public JOSMTestRules test = new JOSMTestRules();
     
    3031     * Test of {@link SaveLayerInfo} class - null case.
    3132     */
    32     @Test(expected = IllegalArgumentException.class)
     33    @Test
    3334    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL")
    34     public void testSaveLayerInfoNull() {
    35         new SaveLayerInfo(null);
     35    void testSaveLayerInfoNull() {
     36        assertThrows(IllegalArgumentException.class, () -> new SaveLayerInfo(null));
    3637    }
    3738
     
    4041     */
    4142    @Test
    42     public void testSaveLayerInfoNominal() {
     43    void testSaveLayerInfoNominal() {
    4344        File file = new File("test");
    4445        String name = "layername";
  • trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayerTaskTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.data.osm.DataSet;
    910import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    1516 * Unit tests of {@link SaveLayerTask} class.
    1617 */
    17 public class SaveLayerTaskTest {
     18class SaveLayerTaskTest {
    1819    /**
    1920     * Setup test.
    2021     */
    21     @Rule
     22    @RegisterExtension
    2223    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2324    public JOSMTestRules test = new JOSMTestRules();
     
    2627     * Test of {@link SaveLayerTask} class - null case.
    2728     */
    28     @Test(expected = IllegalArgumentException.class)
     29    @Test
    2930    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL")
    30     public void testSaveLayerTaskNull() {
    31         new SaveLayerTask(null, null);
     31    void testSaveLayerTaskNull() {
     32        assertThrows(IllegalArgumentException.class, () -> new SaveLayerTask(null, null));
    3233    }
    3334
     
    3637     */
    3738    @Test
    38     public void testSaveLayerTaskNominal() {
     39    void testSaveLayerTaskNominal() {
    3940        assertNotNull(new SaveLayerTask(new SaveLayerInfo(new OsmDataLayer(new DataSet(), "", null)), null));
    4041    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/SaveLayersDialogTest.java

    r14358 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.Collections;
     
    1313import javax.swing.JOptionPane;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.data.osm.DataSet;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     
    2525 * Unit tests of {@link SaveLayersDialog} class.
    2626 */
    27 public class SaveLayersDialogTest {
     27class SaveLayersDialogTest {
    2828
    2929    /**
    3030     * Setup tests
    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 testConfirmSaveLayerInfosOK() {
     40    void testConfirmSaveLayerInfosOK() {
    4141        final List<SaveLayerInfo> list = Collections.singletonList(new SaveLayerInfo(new OsmDataLayer(new DataSet(), null, null)));
    4242
  • trunk/test/unit/org/openstreetmap/josm/gui/io/TagSettingsPanelTest.java

    r12719 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 TagSettingsPanel} class.
    1414 */
    15 public class TagSettingsPanelTest {
     15class TagSettingsPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testTagSettingsPanel() {
     28    void testTagSettingsPanel() {
    2929        assertNotNull(new TagSettingsPanel(new ChangesetCommentModel(), new ChangesetCommentModel(), new ChangesetReviewModel()));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadAndSaveProgressRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.beans.PropertyChangeEvent;
     
    99import javax.swing.JPanel;
    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.gui.io.SaveLayersModel.Mode;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1919 * Unit tests of {@link UploadAndSaveProgressRenderer} class.
    2020 */
    21 public class UploadAndSaveProgressRendererTest {
     21class UploadAndSaveProgressRendererTest {
    2222
    2323    /**
    2424     * Setup tests
    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 testUploadAndSaveProgressRenderer() {
     34    void testUploadAndSaveProgressRenderer() {
    3535        JPanel parent = new JPanel();
    3636        UploadAndSaveProgressRenderer r = new UploadAndSaveProgressRenderer();
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadDialogTest.java

    r16672 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.awt.GraphicsEnvironment;
     
    1717import javax.swing.JOptionPane;
    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;
    2222import org.openstreetmap.josm.gui.io.UploadDialog.UploadAction;
     
    3131 * Unit tests of {@link UploadDialog} class.
    3232 */
    33 public class UploadDialogTest {
     33class UploadDialogTest {
    3434
    3535    /**
    3636     * Setup tests
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4343        private final String source;
    4444        private final String comment;
    45 
    46         public int handleMissingCommentCalls;
    47         public int handleMissingSourceCalls;
    4845
    4946        MockUploadDialog(final String comment, final String source) {
     
    6461        @Override
    6562        public void handleMissingSource() {
    66             this.handleMissingSourceCalls += 1;
    6763        }
    6864
    6965        @Override
    7066        public void handleMissingComment() {
    71             this.handleMissingCommentCalls += 1;
    7267        }
    7368
     
    107102     */
    108103    @Test
    109     public void testCancelAction() {
     104    void testCancelAction() {
    110105        if (GraphicsEnvironment.isHeadless()) {
    111106            TestUtils.assumeWorkingJMockit();
     
    120115     */
    121116    @Test
    122     public void testIsUploadCommentTooShort() {
     117    void testIsUploadCommentTooShort() {
    123118        assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort(""));
    124119        assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort("test"));
     
    147142     */
    148143    @Test
    149     public void testGetLastChangesetCommentFromHistory() {
     144    void testGetLastChangesetCommentFromHistory() {
    150145        doTestGetLastChangesetTagFromHistory(
    151146                BasicUploadSettingsPanel.HISTORY_KEY,
     
    158153     */
    159154    @Test
    160     public void testGetLastChangesetSourceFromHistory() {
     155    void testGetLastChangesetSourceFromHistory() {
    161156        doTestGetLastChangesetTagFromHistory(
    162157                BasicUploadSettingsPanel.SOURCE_HISTORY_KEY,
     
    196191     */
    197192    @Test
    198     public void testValidateUploadTag() {
     193    void testValidateUploadTag() {
    199194        doTestValidateUploadTag("upload.comment");
    200195        doTestValidateUploadTag("upload.source");
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadParameterSummaryPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 UploadParameterSummaryPanel} class.
    1414 */
    15 public class UploadParameterSummaryPanelTest {
     15class UploadParameterSummaryPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testUploadParameterSummaryPanel() {
     28    void testUploadParameterSummaryPanel() {
    2929        assertNotNull(new UploadParameterSummaryPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadPrimitivesTaskTest.java

    r12687 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.osm.Changeset;
    99import org.openstreetmap.josm.data.osm.DataSet;
     
    1717 * Unit tests of {@link UploadPrimitivesTask} class.
    1818 */
    19 public class UploadPrimitivesTaskTest {
     19class UploadPrimitivesTaskTest {
    2020
    2121    /**
    2222     * Setup tests
    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 testUploadPrimitivesTask() {
     32    void testUploadPrimitivesTask() {
    3333        assertNotNull(new UploadPrimitivesTask(
    3434                new UploadStrategySpecification(),
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadStrategySelectionPanelTest.java

    r12687 r17275  
    22package org.openstreetmap.josm.gui.io;
    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.io.UploadStrategy;
    99import org.openstreetmap.josm.io.UploadStrategySpecification;
     
    1515 * Unit tests of {@link UploadStrategySelectionPanel} class.
    1616 */
    17 public class UploadStrategySelectionPanelTest {
     17class UploadStrategySelectionPanelTest {
    1818
    1919    /**
    2020     * Setup tests
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
     
    2828     */
    2929    @Test
    30     public void testUploadStrategySelectionPanel() {
     30    void testUploadStrategySelectionPanel() {
    3131        UploadStrategySelectionPanel p = new UploadStrategySelectionPanel();
    3232        p.setNumUploadedObjects(Integer.MAX_VALUE);
     
    4141     */
    4242    @Test
    43     public void testUploadStrategySpecification() {
     43    void testUploadStrategySpecification() {
    4444        UploadStrategySelectionPanel p = new UploadStrategySelectionPanel();
    4545
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadTextComponentValidatorTest.java

    r16672 r17275  
    88import javax.swing.JTextField;
    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
    1414import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1515
    16 public class UploadTextComponentValidatorTest {
     16class UploadTextComponentValidatorTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testUploadCommentValidator() {
     29    void testUploadCommentValidator() {
    3030        JTextField textField = new JTextField();
    3131        JLabel feedback = new JLabel();
     
    4242     */
    4343    @Test
    44     public void testUploadSourceValidator() {
     44    void testUploadSourceValidator() {
    4545        JTextField textField = new JTextField();
    4646        JLabel feedback = new JLabel();
  • trunk/test/unit/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.io;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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 UploadedObjectsSummaryPanel} class.
    1414 */
    15 public class UploadedObjectsSummaryPanelTest {
     15class UploadedObjectsSummaryPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    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 testUploadedObjectsSummaryPanel() {
     28    void testUploadedObjectsSummaryPanel() {
    2929        assertNotNull(new UploadedObjectsSummaryPanel());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/io/importexport/JpgImporterTest.java

    r12671 r17275  
    22package org.openstreetmap.josm.gui.io.importexport;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.File;
     
    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.gui.progress.NullProgressMonitor;
    1616import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * Unit tests of {@link JpgImporter} class.
    2222 */
    23 public class JpgImporterTest {
     23class JpgImporterTest {
    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();
     
    3535     */
    3636    @Test
    37     public void testTicket14868() throws IOException {
     37    void testTicket14868() throws IOException {
    3838        List<File> files = new ArrayList<>();
    3939        JpgImporter.addRecursiveFiles(files, new HashSet<>(), Arrays.asList(
  • trunk/test/unit/org/openstreetmap/josm/gui/io/importexport/NoteImporterTest.java

    r12671 r17275  
    22package org.openstreetmap.josm.gui.io.importexport;
    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.File;
    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.gui.MainApplication;
     
    1616 * Unit tests of {@link NoteImporter} class.
    1717 */
    18 public class NoteImporterTest {
     18class NoteImporterTest {
    1919
    2020    /**
    2121     * Use the test rules to remove any layers and reset state.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    public final JOSMTestRules rules = new JOSMTestRules();
    2525
     
    2828     */
    2929    @Test
    30     public void testTicket12531() {
     30    void testTicket12531() {
    3131        MainApplication.getLayerManager().resetState();
    3232        assertNull(MainApplication.getMap());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java

    r10883 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.concurrent.atomic.AtomicBoolean;
    88
    9 import org.junit.Before;
    10 import org.junit.Rule;
    11 import org.junit.Test;
     9import org.junit.jupiter.api.BeforeEach;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1212import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationListener;
    1313import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1919 * @author Michael Zangl
    2020 */
    21 public class AbstractMapViewPaintableTest {
     21class AbstractMapViewPaintableTest {
    2222    /**
    2323     * No special test rules
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3232     * Create test layer
    3333     */
    34     @Before
     34    @BeforeEach
    3535    public void setUp() {
    3636        testLayer = new LayerManagerTest.TestLayer();
     
    4141     */
    4242    @Test
    43     public void testInvalidate() {
     43    void testInvalidate() {
    4444        AtomicBoolean fired = new AtomicBoolean();
    4545        PaintableInvalidationListener listener = l -> fired.set(true);
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.awt.Point;
     
    1212import java.util.concurrent.atomic.AtomicBoolean;
    1313
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.gui.jmapviewer.Coordinate;
    1818import org.openstreetmap.gui.jmapviewer.Projected;
     
    3939 * Test of the base {@link AbstractTileSourceLayer} class
    4040 */
    41 public class AbstractTileSourceLayerTest {
     41class AbstractTileSourceLayerTest {
    4242
    4343    /**
    4444     * Setup test
    4545     */
    46     @Rule
     46    @RegisterExtension
    4747    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4848    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    148148     * Create test layer
    149149     */
    150     @Before
     150    @BeforeEach
    151151    public void setUp() {
    152152        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
     
    159159     */
    160160    @Test
    161     public void testFilterChanged() {
     161    void testFilterChanged() {
    162162        try {
    163163            ImageryFilterSettings filterSettings = new ImageryFilterSettings();
     
    175175     */
    176176    @Test
    177     public void testClearTileCache() {
     177    void testClearTileCache() {
    178178        testLayer.loadAllTiles(true);
    179179        assertTrue(testLayer.getTileCache().getTileCount() > 0);
     
    186186     */
    187187    @Test
    188     public void testGetAdjustAction() {
     188    void testGetAdjustAction() {
    189189        assertNotNull(testLayer.getAdjustAction());
    190190    }
     
    194194     */
    195195    @Test
    196     public void testGetInfoComponent() {
     196    void testGetInfoComponent() {
    197197        assertNotNull(testLayer.getInfoComponent());
    198198    }
     
    202202     */
    203203    @Test
    204     public void testTileSourceLayerPopup() {
     204    void testTileSourceLayerPopup() {
    205205        assertNotNull(testLayer.new TileSourceLayerPopup(100, 100));
    206206    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AutosaveTaskTest.java

    r16977 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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;
    99
    1010import java.io.BufferedWriter;
     
    2121import java.util.List;
    2222
    23 import org.junit.Before;
    24 import org.junit.Rule;
    25 import org.junit.Test;
     23import org.junit.jupiter.api.BeforeEach;
     24import org.junit.jupiter.api.Test;
     25import org.junit.jupiter.api.extension.RegisterExtension;
    2626import org.openstreetmap.josm.data.coor.LatLon;
    2727import org.openstreetmap.josm.data.osm.DataSet;
     
    3636 * Unit tests for class {@link AutosaveTask}.
    3737 */
    38 public class AutosaveTaskTest {
     38class AutosaveTaskTest {
    3939    /**
    4040     * We need preferences and a home directory for this.
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    5050     * @throws IOException if autosave directory cannot be created
    5151     */
    52     @Before
     52    @BeforeEach
    5353    public void setUp() throws IOException {
    5454        task = new AutosaveTask();
     
    5959     */
    6060    @Test
    61     public void testGetUnsavedLayersFilesEmpty() {
     61    void testGetUnsavedLayersFilesEmpty() {
    6262        assertTrue(task.getUnsavedLayersFiles().isEmpty());
    6363    }
     
    6868     */
    6969    @Test
    70     public void testGetUnsavedLayersFilesNotEmpty() throws IOException {
     70    void testGetUnsavedLayersFilesNotEmpty() throws IOException {
    7171        Files.createDirectories(task.getAutosaveDir());
    7272        String autodir = task.getAutosaveDir().toString();
     
    9090     */
    9191    @Test
    92     public void testGetNewLayerFile() throws IOException {
     92    void testGetNewLayerFile() throws IOException {
    9393        Files.createDirectories(task.getAutosaveDir());
    9494        AutosaveLayerInfo<?> info = new AutosaveLayerInfo<>(new OsmDataLayer(new DataSet(), "layer", null));
     
    127127     */
    128128    @Test
    129     public void testScheduleCreatesDirectories() {
     129    void testScheduleCreatesDirectories() {
    130130        try {
    131131            task.schedule();
     
    140140     */
    141141    @Test
    142     public void testAutosaveIgnoresUnmodifiedLayer() {
     142    void testAutosaveIgnoresUnmodifiedLayer() {
    143143        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "OsmData", null);
    144144        MainApplication.getLayerManager().addLayer(layer);
     
    162162     */
    163163    @Test
    164     public void testAutosaveSavesLayer() {
     164    void testAutosaveSavesLayer() {
    165165        runAutosaveTaskSeveralTimes(1);
    166166    }
     
    170170     */
    171171    @Test
    172     public void testAutosaveSavesLayerMultipleTimes() {
     172    void testAutosaveSavesLayerMultipleTimes() {
    173173        AutosaveTask.PROP_FILES_PER_LAYER.put(3);
    174174        runAutosaveTaskSeveralTimes(5);
     
    199199     */
    200200    @Test
    201     public void testDiscardUnsavedLayersIgnoresCurrentInstance() throws IOException {
     201    void testDiscardUnsavedLayersIgnoresCurrentInstance() throws IOException {
    202202        runAutosaveTaskSeveralTimes(1);
    203203        try (BufferedWriter file = Files.newBufferedWriter(
     
    215215     */
    216216    @Test
    217     public void testAutosaveHandlesDuplicateNames() {
     217    void testAutosaveHandlesDuplicateNames() {
    218218        DataSet data1 = new DataSet();
    219219        OsmDataLayer layer1 = new OsmDataLayer(data1, "OsmData", null);
     
    243243     */
    244244    @Test
    245     public void testRecoverLayers() throws Exception {
     245    void testRecoverLayers() throws Exception {
    246246        runAutosaveTaskSeveralTimes(1);
    247247        try (BufferedWriter file = Files.newBufferedWriter(
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/GpxLayerTest.java

    r15924 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.awt.Color;
     
    1617import javax.swing.JScrollPane;
    1718
    18 import org.junit.Rule;
    19 import org.junit.Test;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2021import org.openstreetmap.josm.TestUtils;
    2122import org.openstreetmap.josm.data.gpx.GpxData;
     
    4142     * Setup tests
    4243     */
    43     @Rule
     44    @RegisterExtension
    4445    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4546    public JOSMTestRules test = new JOSMTestRules().main().projection().i18n().metricSystem();
     
    7475     */
    7576    @Test
    76     public void testGpxLayer() throws Exception {
     77    void testGpxLayer() throws Exception {
    7778        GpxLayer layer = new GpxLayer(new GpxData(), "foo", false);
    7879        GpxTrack trk = new GpxTrack(new ArrayList<IGpxTrackSegment>(), new HashMap<>());
     
    105106     */
    106107    @Test
    107     public void testGetInfoComponent() throws Exception {
     108    void testGetInfoComponent() throws Exception {
    108109        assertEquals("<html>\n"+
    109110                     "  <head>\n" +
     
    192193     */
    193194    @Test
    194     public void testGetTimespanForTrack() throws Exception {
     195    void testGetTimespanForTrack() throws Exception {
    195196        assertEquals("", GpxLayer.getTimespanForTrack(
    196197                new GpxTrack(new ArrayList<Collection<WayPoint>>(), new HashMap<String, Object>())));
     
    207208     */
    208209    @Test
    209     public void testMergeFrom() throws Exception {
     210    void testMergeFrom() throws Exception {
    210211        GpxLayer layer = new GpxLayer(new GpxData());
    211212        assertTrue(layer.data.isEmpty());
     
    219220     * Test that {@link GpxLayer#mergeFrom} throws IAE for invalid arguments
    220221     */
    221     @Test(expected = IllegalArgumentException.class)
    222     public void testMergeFromIAE() {
    223         new GpxLayer(new GpxData()).mergeFrom(new OsmDataLayer(new DataSet(), "", null));
     222    @Test
     223    void testMergeFromIAE() {
     224        assertThrows(IllegalArgumentException.class, () -> new GpxLayer(new GpxData()).mergeFrom(new OsmDataLayer(new DataSet(), "", null)));
    224225    }
    225226
     
    229230     */
    230231    @Test
    231     public void testPaint() throws Exception {
     232    void testPaint() throws Exception {
    232233        GpxLayer layer = getMinimalGpxLayer();
    233234        try {
     
    244245     */
    245246    @Test
    246     public void testGetChangesetSourceTag() {
     247    void testGetChangesetSourceTag() {
    247248        assertEquals("survey", new GpxLayer(new GpxData(), "", true).getChangesetSourceTag());
    248249        assertNull(new GpxLayer(new GpxData(), "", false).getChangesetSourceTag());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/ImageryLayerTest.java

    r10547 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertNotNull;
    5 import static org.junit.Assert.assertSame;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertSame;
    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.gui.layer.imagery.ImageryFilterSettings;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1515 * Unit tests of {@link ImageryLayer} class.
    1616 */
    17 public class ImageryLayerTest {
     17class ImageryLayerTest {
    1818
    1919    /**
    2020     * For creating layers
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2828     */
    2929    @Test
    30     public void testHasSettings() {
     30    void testHasSettings() {
    3131        ImageryLayer layer = TMSLayerTest.createTmsLayer();
    3232        ImageryFilterSettings settings = layer.getFilterSettings();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerManagerTest.java

    r16977 r17275  
    44import static org.hamcrest.CoreMatchers.is;
    55import static org.hamcrest.MatcherAssert.assertThat;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.assertFalse;
    8 import static org.junit.Assert.assertNotNull;
    9 import static org.junit.Assert.assertNull;
    10 import static org.junit.Assert.assertSame;
    11 import static org.junit.Assert.assertTrue;
    12 import static org.junit.Assert.fail;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
     7import static org.junit.jupiter.api.Assertions.assertFalse;
     8import static org.junit.jupiter.api.Assertions.assertNotNull;
     9import static org.junit.jupiter.api.Assertions.assertNull;
     10import static org.junit.jupiter.api.Assertions.assertSame;
     11import static org.junit.jupiter.api.Assertions.assertTrue;
     12import static org.junit.jupiter.api.Assertions.fail;
    1313import static org.junit.jupiter.api.Assertions.assertThrows;
    1414import static org.openstreetmap.josm.testutils.ThrowableRootCauseMatcher.hasRootCause;
     
    2525import javax.swing.Icon;
    2626
    27 import org.junit.Before;
    28 import org.junit.Test;
     27import org.junit.jupiter.api.BeforeEach;
     28import org.junit.jupiter.api.Test;
    2929import org.openstreetmap.josm.data.Bounds;
    3030import org.openstreetmap.josm.data.osm.visitor.BoundingXYVisitor;
     
    166166     * Set up test layer manager.
    167167     */
    168     @Before
     168    @BeforeEach
    169169    public void setUp() {
    170170        layerManager = new LayerManager();
     
    175175     */
    176176    @Test
    177     public void testAddLayer() {
     177    void testAddLayer() {
    178178        Layer layer1 = new TestLayer() {
    179179            @Override
     
    222222     */
    223223    @Test
    224     public void testAddLayerFails() {
     224    void testAddLayerFails() {
    225225        Exception e = assertThrows(ReportedException.class, () -> {
    226226            TestLayer layer1 = new TestLayer();
     
    236236     */
    237237    @Test
    238     public void testAddLayerIllegalPosition() {
     238    void testAddLayerIllegalPosition() {
    239239        Exception e = assertThrows(ReportedException.class, () -> {
    240240            TestLayer layer1 = new TestLayer() {
     
    254254     */
    255255    @Test
    256     public void testRemoveLayer() {
     256    void testRemoveLayer() {
    257257        TestLayer layer1 = new TestLayer();
    258258        TestLayer layer2 = new TestLayer();
     
    275275     */
    276276    @Test
    277     public void testMoveLayer() {
     277    void testMoveLayer() {
    278278        TestLayer layer1 = new TestLayer();
    279279        TestLayer layer2 = new TestLayer();
     
    303303     */
    304304    @Test
    305     public void testMoveLayerFailsRange() {
     305    void testMoveLayerFailsRange() {
    306306        Exception e = assertThrows(ReportedException.class, () -> {
    307307            TestLayer layer1 = new TestLayer();
     
    319319     */
    320320    @Test
    321     public void testMoveLayerFailsNotInList() {
     321    void testMoveLayerFailsNotInList() {
    322322        Exception e = assertThrows(ReportedException.class, () -> {
    323323            TestLayer layer1 = new TestLayer();
     
    333333     * {@link LayerManager#getLayers()} unmodifiable
    334334     */
    335     @Test(expected = UnsupportedOperationException.class)
    336     public void testGetLayers() {
     335    @Test
     336    void testGetLayers() {
    337337        // list should be immutable
    338338        TestLayer layer1 = new TestLayer();
     
    340340        layerManager.addLayer(layer1);
    341341        layerManager.addLayer(layer2);
    342         layerManager.getLayers().remove(0);
     342        assertThrows(UnsupportedOperationException.class, () -> layerManager.getLayers().remove(0));
    343343    }
    344344
     
    347347     */
    348348    @Test
    349     public void testGetLayersOfType() {
     349    void testGetLayersOfType() {
    350350        TestLayer2 layer1 = new TestLayer2();
    351351        TestLayer2 layer2 = new TestLayer2();
     
    361361     */
    362362    @Test
    363     public void testContainsLayer() {
     363    void testContainsLayer() {
    364364        TestLayer layer = new TestLayer();
    365365        layerManager.addLayer(layer);
     
    374374     */
    375375    @Test
    376     public void testAddLayerChangeListener() {
     376    void testAddLayerChangeListener() {
    377377        CapturingLayerChangeListener l = new CapturingLayerChangeListener();
    378378        layerManager.addLayerChangeListener(l);
     
    385385     * {@link LayerManager#addLayerChangeListener(LayerChangeListener)} twice
    386386     */
    387     @Test(expected = IllegalArgumentException.class)
    388     public void testAddLayerChangeListenerDuplicates() {
     387    @Test
     388    void testAddLayerChangeListenerDuplicates() {
    389389        CapturingLayerChangeListener l = new CapturingLayerChangeListener();
    390390        layerManager.addLayerChangeListener(l);
    391         layerManager.addLayerChangeListener(l);
     391        assertThrows(IllegalArgumentException.class, () -> layerManager.addLayerChangeListener(l));
    392392    }
    393393
     
    396396     */
    397397    @Test
    398     public void testAddLayerChangeListenerFire() {
     398    void testAddLayerChangeListenerFire() {
    399399        final ArrayList<Layer> fired = new ArrayList<>();
    400400        TestLayer layer1 = new TestLayer();
     
    426426     */
    427427    @Test
    428     public void testRemoveLayerChangeListener() {
     428    void testRemoveLayerChangeListener() {
    429429        CapturingLayerChangeListener l = new CapturingLayerChangeListener();
    430430        layerManager.addLayerChangeListener(l);
     
    441441     * {@link LayerManager#removeLayerChangeListener(LayerChangeListener)} listener not in list
    442442     */
    443     @Test(expected = IllegalArgumentException.class)
    444     public void testRemoveLayerChangeListenerNotAdded() {
    445         CapturingLayerChangeListener l = new CapturingLayerChangeListener();
    446         layerManager.removeLayerChangeListener(l);
     443    @Test
     444    void testRemoveLayerChangeListenerNotAdded() {
     445        CapturingLayerChangeListener l = new CapturingLayerChangeListener();
     446        assertThrows(IllegalArgumentException.class, () -> layerManager.removeLayerChangeListener(l));
    447447    }
    448448
     
    451451     */
    452452    @Test
    453     public void testRemoveLayerChangeListenerFire() {
     453    void testRemoveLayerChangeListenerFire() {
    454454        final ArrayList<Layer> fired = new ArrayList<>();
    455455        TestLayer layer1 = new TestLayer();
     
    483483     */
    484484    @Test
    485     public void testLayerRemoveScheduleRemoval() {
     485    void testLayerRemoveScheduleRemoval() {
    486486        TestLayer layer1 = new TestLayer();
    487487        TestLayer layer2 = new TestLayer();
     
    516516     */
    517517    @Test
    518     public void testResetState() {
     518    void testResetState() {
    519519        ResetStateChangeListener changeListener = new ResetStateChangeListener();
    520520        layerManager.addLayer(new TestLayer());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerPositionStrategyTest.java

    r11008 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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 * Test the {@link LayerPositionStrategy} class.
    1010 */
    11 public class LayerPositionStrategyTest {
     11class LayerPositionStrategyTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testNullManager() {
     17    void testNullManager() {
    1818        assertEquals(0, LayerPositionStrategy.inFrontOfFirst(l -> true).getPosition(null));
    1919        assertEquals(0, LayerPositionStrategy.afterLast(l -> true).getPosition(null));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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;
    99
    1010import java.io.File;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.data.projection.ProjectionRegistry;
    1616import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2222 * @author Michael Zangl
    2323 */
    24 public class LayerTest {
     24class LayerTest {
    2525    /**
    2626     * We need projection
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    3535     * Create test layer
    3636     */
    37     @Before
     37    @BeforeEach
    3838    public void setUp() {
    3939        testLayer = new LayerManagerTest.TestLayer();
     
    4444     */
    4545    @Test
    46     public void testIsInfoResizable() {
     46    void testIsInfoResizable() {
    4747        assertFalse(testLayer.isInfoResizable());
    4848    }
     
    5252     */
    5353    @Test
    54     public void testAssociatedFile() {
     54    void testAssociatedFile() {
    5555        assertNull(testLayer.getAssociatedFile());
    5656
     
    6464     */
    6565    @Test
    66     public void testGetName() {
     66    void testGetName() {
    6767        assertEquals("Test Layer", testLayer.getName());
    6868    }
     
    7272     */
    7373    @Test
    74     public void testSetName() {
     74    void testSetName() {
    7575        testLayer.setName("Test Layer2");
    7676        assertEquals("Test Layer2", testLayer.getName());
     
    8989     */
    9090    @Test
    91     public void testRename() {
     91    void testRename() {
    9292        assertFalse(testLayer.isRenamed());
    9393        testLayer.rename("Test Layer2");
     
    100100     */
    101101    @Test
    102     public void testBackgroundLayer() {
     102    void testBackgroundLayer() {
    103103        assertFalse(testLayer.isBackgroundLayer());
    104104        testLayer.setBackgroundLayer(true);
     
    110110     */
    111111    @Test
    112     public void testVisible() {
     112    void testVisible() {
    113113        assertTrue(testLayer.isVisible());
    114114        testLayer.setVisible(false);
     
    122122     */
    123123    @Test
    124     public void testToggleVisible() {
     124    void testToggleVisible() {
    125125        assertTrue(testLayer.isVisible());
    126126        testLayer.toggleVisible();
     
    134134     */
    135135    @Test
    136     public void testOpacity() {
     136    void testOpacity() {
    137137        assertEquals(1, testLayer.getOpacity(), 1e-3);
    138138
     
    152152     */
    153153    @Test
    154     public void testIsProjectionSupported() {
     154    void testIsProjectionSupported() {
    155155        assertFalse(testLayer.isProjectionSupported(null));
    156156        assertTrue(testLayer.isProjectionSupported(ProjectionRegistry.getProjection()));
     
    161161     */
    162162    @Test
    163     public void testNameSupportedProjections() {
     163    void testNameSupportedProjections() {
    164164        assertNotNull(testLayer.nameSupportedProjections());
    165165    }
     
    169169     */
    170170    @Test
    171     public void testIsSavable() {
     171    void testIsSavable() {
    172172        assertFalse(testLayer.isSavable());
    173173    }
     
    177177     */
    178178    @Test
    179     public void testCheckSaveConditions() {
     179    void testCheckSaveConditions() {
    180180        assertTrue(testLayer.checkSaveConditions());
    181181    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/MainLayerManagerTest.java

    r14273 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
    6 import static org.junit.Assert.assertSame;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
     6import static org.junit.jupiter.api.Assertions.assertSame;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    89import java.util.Arrays;
    910
    10 import org.junit.Before;
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
    1314import org.openstreetmap.josm.JOSMFixture;
    1415import org.openstreetmap.josm.data.osm.DataSet;
     
    2122 * @author Michael Zangl
    2223 */
    23 public class MainLayerManagerTest extends LayerManagerTest {
     24class MainLayerManagerTest extends LayerManagerTest {
    2425
    2526    private MainLayerManager layerManagerWithActive;
     
    5455    }
    5556
    56     @BeforeClass
     57    @BeforeAll
    5758    public static void setUpClass() {
    5859        JOSMFixture.createUnitTestFixture().init();
     
    6061
    6162    @Override
    62     @Before
     63    @BeforeEach
    6364    public void setUp() {
    6465        layerManager = layerManagerWithActive = new MainLayerManager();
     
    6667
    6768    @Test
    68     public void testAddLayerSetsActiveLayer() {
     69    void testAddLayerSetsActiveLayer() {
    6970        TestLayer layer1 = new TestLayer();
    7071        AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer();
     
    8485
    8586    @Test
    86     public void testRemoveLayerUnsetsActiveLayer() {
     87    void testRemoveLayerUnsetsActiveLayer() {
    8788        TestLayer layer1 = new TestLayer();
    8889        AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer();
     
    114115     */
    115116    @Test
    116     public void testAddActiveLayerChangeListener() {
     117    void testAddActiveLayerChangeListener() {
    117118        TestLayer layer1 = new TestLayer();
    118119        AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer();
     
    141142     * Test if {@link MainLayerManager#addActiveLayerChangeListener(ActiveLayerChangeListener)} prevents listener from being added twice.
    142143     */
    143     @Test(expected = IllegalArgumentException.class)
    144     public void testAddActiveLayerChangeListenerTwice() {
     144    @Test
     145    void testAddActiveLayerChangeListenerTwice() {
    145146        CapturingActiveLayerChangeListener listener = new CapturingActiveLayerChangeListener();
    146147        layerManagerWithActive.addActiveLayerChangeListener(listener);
    147         layerManagerWithActive.addActiveLayerChangeListener(listener);
     148        assertThrows(IllegalArgumentException.class, () -> layerManagerWithActive.addActiveLayerChangeListener(listener));
    148149    }
    149150
     
    152153     */
    153154    @Test
    154     public void testRemoveActiveLayerChangeListener() {
     155    void testRemoveActiveLayerChangeListener() {
    155156        TestLayer layer1 = new TestLayer();
    156157        AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer();
     
    169170     * Test if {@link MainLayerManager#removeActiveLayerChangeListener(ActiveLayerChangeListener)} checks if listener is in list.
    170171     */
    171     @Test(expected = IllegalArgumentException.class)
    172     public void testRemoveActiveLayerChangeListenerNotInList() {
    173         layerManagerWithActive.removeActiveLayerChangeListener(new CapturingActiveLayerChangeListener());
     172    @Test
     173    void testRemoveActiveLayerChangeListenerNotInList() {
     174        assertThrows(IllegalArgumentException.class,
     175                () -> layerManagerWithActive.removeActiveLayerChangeListener(new CapturingActiveLayerChangeListener()));
    174176    }
    175177
     
    180182     */
    181183    @Test
    182     public void testSetGetActiveLayer() {
     184    void testSetGetActiveLayer() {
    183185        TestLayer layer1 = new TestLayer();
    184186        TestLayer layer2 = new TestLayer();
     
    197199     */
    198200    @Test
    199     public void testGetEditDataSet() {
     201    void testGetEditDataSet() {
    200202        assertNull(layerManagerWithActive.getEditDataSet());
    201203        TestLayer layer0 = new TestLayer();
     
    219221     */
    220222    @Test
    221     public void testGetVisibleLayersInZOrder() {
     223    void testGetVisibleLayersInZOrder() {
    222224        AbstractTestOsmLayer layer1 = new AbstractTestOsmLayer();
    223225        AbstractTestOsmLayer layer2 = new AbstractTestOsmLayer();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/MapViewPaintableTest.java

    r10300 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.layer.MapViewPaintable.PaintableInvalidationEvent;
     
    1212 * Unit tests of {@link MapViewPaintable} class.
    1313 */
    14 public class MapViewPaintableTest {
     14class MapViewPaintableTest {
    1515
    1616    /**
    1717     * Setup tests
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testToString() {
     28    void testToString() {
    2929        assertEquals("LayerInvalidationEvent [layer=null]", new PaintableInvalidationEvent(null).toString());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/NativeScaleLayerTest.java

    r10306 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertNull;
    55
    66import java.util.Collections;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.JOSMFixture;
    1111
     
    1313 * Unit tests of {@link NativeScaleLayer} class.
    1414 */
    15 public class NativeScaleLayerTest {
     15class NativeScaleLayerTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @BeforeClass
     20    @BeforeAll
    2121    public static void setUpBeforeClass() {
    2222        JOSMFixture.createUnitTestFixture().init();
     
    2727     */
    2828    @Test
    29     public void testTicket12255() {
     29    void testTicket12255() {
    3030        assertNull(new NativeScaleLayer.ScaleList(Collections.<Double>emptyList()).getSnapScale(10, 2, false));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/NoteLayerTest.java

    r13165 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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 NoteLayer} class.
    1414 */
    15 public class NoteLayerTest {
     15class NoteLayerTest {
    1616
    1717    /**
    1818     * Setup tests
    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 testTicket13208() {
     28    void testTicket13208() {
    2929        assertEquals("0 notes", new NoteLayer().getToolTipText());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testInsertLineBreaks() {
     36    void testInsertLineBreaks() {
    3737        // empty string
    3838        assertEquals("", NoteLayer.insertLineBreaks(""));
     
    6161     */
    6262    @Test
    63     public void testReplaceLinks() {
     63    void testReplaceLinks() {
    6464        // empty string
    6565        assertEquals("", NoteLayer.replaceLinks(""));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r16969 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.ByteArrayInputStream;
     
    1515import java.util.Iterator;
    1616
    17 import org.junit.Before;
    18 import org.junit.Rule;
    19 import org.junit.Test;
     17import org.junit.jupiter.api.BeforeEach;
     18import org.junit.jupiter.api.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    2020import org.openstreetmap.josm.TestUtils;
    2121import org.openstreetmap.josm.actions.ExpertToggleAction;
     
    4646 * Unit tests of {@link OsmDataLayer} class.
    4747 */
    48 public class OsmDataLayerTest {
     48class OsmDataLayerTest {
    4949
    5050    /**
    5151     * Setup tests
    5252     */
    53     @Rule
     53    @RegisterExtension
    5454    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5555    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    6161     * Setup tests
    6262     */
    63     @Before
     63    @BeforeEach
    6464    public void setUp() {
    6565        ds = new DataSet();
     
    7272     */
    7373    @Test
    74     public void testRecentRelation() {
     74    void testRecentRelation() {
    7575        int n = OsmDataLayer.PROPERTY_RECENT_RELATIONS_NUMBER.get();
    7676        assertTrue(n > 0);
     
    9393     */
    9494    @Test
    95     public void testGetInfoComponent() {
     95    void testGetInfoComponent() {
    9696        assertNotNull(layer.getInfoComponent());
    9797
     
    130130     */
    131131    @Test
    132     public void testLayerStateChangeListenerNull() {
     132    void testLayerStateChangeListenerNull() {
    133133        layer.addLayerStateChangeListener(null);
    134134    }
     
    138138     */
    139139    @Test
    140     public void testGetIcon() {
     140    void testGetIcon() {
    141141        assertNotNull(layer.getIcon());
    142142        layer.setUploadDiscouraged(true);
     
    148148     */
    149149    @Test
    150     public void testPaint() {
     150    void testPaint() {
    151151        fillDataSet(ds);
    152152        assertNotNull(MainApplication.getMap());
     
    158158     */
    159159    @Test
    160     public void testGetToolTipText() {
     160    void testGetToolTipText() {
    161161        assertEquals("<html>0 nodes<br>0 ways<br>0 relations</html>", new OsmDataLayer(ds, "", null).getToolTipText());
    162162        fillDataSet(ds);
     
    169169     */
    170170    @Test
    171     public void testMergeFrom() {
     171    void testMergeFrom() {
    172172        fillDataSet(ds);
    173173        OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), "", null);
     
    186186     */
    187187    @Test
    188     public void testCleanupAfterUpload() {
     188    void testCleanupAfterUpload() {
    189189        fillDataSet(ds);
    190190        assertEquals(6, layer.data.allPrimitives().size());
     
    197197     */
    198198    @Test
    199     public void testGetMenuEntries() {
     199    void testGetMenuEntries() {
    200200        ExpertToggleAction.getInstance().setExpert(true);
    201201        assertEquals(17, layer.getMenuEntries().length);
     
    210210     */
    211211    @Test
    212     public void testToGpxData() throws IllegalDataException {
     212    void testToGpxData() throws IllegalDataException {
    213213        ds.mergeFrom(OsmReader.parseDataSet(new ByteArrayInputStream((
    214214                "<?xml version='1.0' encoding='UTF-8'?>\n" +
     
    264264     */
    265265    @Test
    266     public void testContainsPoint() {
     266    void testContainsPoint() {
    267267        fillDataSet(ds);
    268268        assertTrue(layer.containsPoint(LatLon.ZERO));
     
    273273     */
    274274    @Test
    275     public void testIsModified() {
     275    void testIsModified() {
    276276        assertFalse(layer.isModified());
    277277        fillDataSet(ds);
     
    283283     */
    284284    @Test
    285     public void testProjectionChanged() {
     285    void testProjectionChanged() {
    286286        layer.projectionChanged(null, null);
    287287    }
     
    291291     */
    292292    @Test
    293     public void testCheckSaveConditions() {
     293    void testCheckSaveConditions() {
    294294        TestUtils.assumeWorkingJMockit();
    295295        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker(
     
    311311     */
    312312    @Test
    313     public void testLayerNameIncreases() {
     313    void testLayerNameIncreases() {
    314314        final OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), OsmDataLayer.createLayerName(147), null);
    315315        final OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
     
    322322     */
    323323    @Test
    324     public void testLayerUnnumberedName() {
     324    void testLayerUnnumberedName() {
    325325        final OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Data Layer ", null);
    326326        assertEquals("Data Layer ", layer.getName());
     
    331331     */
    332332    @Test
    333     public void testLayerNameDoesFinish() {
     333    void testLayerNameDoesFinish() {
    334334        final OsmDataLayer layer = new OsmDataLayer(new DataSet(), "Data Layer from GeoJSON: foo.geojson", null);
    335335        assertEquals("Data Layer from GeoJSON: foo.geojson", layer.getName());
     
    340340     */
    341341    @Test
    342     public void testTicket17065() {
     342    void testTicket17065() {
    343343        ClipboardUtils.clear();
    344344        Logging.clearLastErrorAndWarnings();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/TMSLayerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
    88import org.openstreetmap.josm.data.imagery.ImageryInfo;
    99import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    2121     * Setup tests
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    6363     */
    6464    @Test
    65     public void testTMSLayer() {
     65    void testTMSLayer() {
    6666        test(ImageryType.TMS, createTmsLayer());
    6767        test(ImageryType.BING, createBingLayer());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/ValidatorLayerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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
    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.data.osm.DataSet;
    1212import org.openstreetmap.josm.gui.MainApplication;
     
    1818 * Unit tests of {@link ValidatorLayer} class.
    1919 */
    20 public class ValidatorLayerTest {
     20class ValidatorLayerTest {
    2121
    2222    /**
    2323     * Setup tests
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    3131     */
    3232    @Test
    33     public void testValidatorLayer() {
     33    void testValidatorLayer() {
    3434        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3535        ValidatorLayer layer = new ValidatorLayer();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.data.imagery.ImageryInfo;
    910import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    1617 * Unit tests of {@link WMSLayer} class.
    1718 */
    18 public class WMSLayerTest {
     19class WMSLayerTest {
    1920
    2021    /**
    2122     * Setup tests
    2223     */
    23     @Rule
     24    @RegisterExtension
    2425    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2526    public JOSMTestRules test = new JOSMTestRules().main().projection();
     
    2930     */
    3031    @Test
    31     public void testWMSLayer() {
     32    void testWMSLayer() {
    3233        WMSLayer wms = new WMSLayer(new ImageryInfo("test wms", "http://localhost"));
    3334        MainApplication.getLayerManager().addLayer(wms);
     
    4344     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/13828">Bug #13828</a>.
    4445     */
    45     @Test(expected = IllegalArgumentException.class)
    46     public void testTicket13828() {
    47         new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png"));
     46    @Test
     47    void testTicket13828() {
     48        assertThrows(IllegalArgumentException.class, () -> new WMSLayer(new ImageryInfo("TMS", "http://203.159.29.217/try2/{z}/{x}/{y}.png")));
    4849    }
    4950}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMTSLayerTest.java

    r13733 r17275  
    22package org.openstreetmap.josm.gui.layer;
    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.imagery.ImageryInfo;
    99import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType;
     
    1515 * Unit tests of {@link WMTSLayer} class.
    1616 */
    17 public class WMTSLayerTest {
     17class WMTSLayerTest {
    1818
    1919    /**
    2020     * Setup tests
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules().preferences().timeout(20000);
     
    2828     */
    2929    @Test
    30     public void testWMTSLayer() {
     30    void testWMTSLayer() {
    3131        WMTSLayer wmts = new WMTSLayer(new ImageryInfo("test wmts", "http://localhost", "wmts", null, null));
    3232        assertEquals(ImageryType.WMTS, wmts.getInfo().getImageryType());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.gui.layer.geoimage;
    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.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.data.gpx.GpxData;
    1212import org.openstreetmap.josm.data.gpx.GpxTimeOffset;
     
    2323 * Unit tests of {@link CorrelateGpxWithImages} class.
    2424 */
    25 public class CorrelateGpxWithImagesTest {
     25class CorrelateGpxWithImagesTest {
    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();
     
    3535     * Setup test.
    3636     */
    37     @BeforeClass
     37    @BeforeAll
    3838    public static void setUp() {
    3939        DateUtilsTest.setTimeZone(DateUtils.UTC);
     
    4545     */
    4646    @Test
    47     public void testAutoGuess() throws Exception {
     47    void testAutoGuess() throws Exception {
    4848        final GpxData gpx = GpxReaderTest.parseGpxData("nodist/data/2094047.gpx");
    4949        final ImageEntry i0 = new ImageEntry();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

    r12636 r17275  
    22package org.openstreetmap.josm.gui.layer.geoimage;
    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;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import java.io.File;
     
    1011import java.util.List;
    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;
    1516import org.openstreetmap.josm.data.osm.DataSet;
     
    2627 * Unit tests of {@link GeoImageLayer} class.
    2728 */
    28 public class GeoImageLayerTest {
     29class GeoImageLayerTest {
    2930    /**
    3031     * We need prefs for this.
    3132     */
    32     @Rule
     33    @RegisterExtension
    3334    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3435    public JOSMTestRules test = new JOSMTestRules().preferences();
    35 
    3636
    3737    /**
     
    4040     */
    4141    @Test
    42     public void testLoader() throws Exception {
     42    void testLoader() throws Exception {
    4343        try (InputStream in = TestUtils.getRegressionDataStream(12255, "bobrava2.gpx")) {
    4444            GpxReader reader = new GpxReader(in);
     
    6363     * Test that {@link GeoImageLayer#mergeFrom} throws IAE for invalid arguments
    6464     */
    65     @Test(expected = IllegalArgumentException.class)
    66     public void testMergeFromIAE() {
    67         new GeoImageLayer(null, null).mergeFrom(new OsmDataLayer(new DataSet(), "", null));
     65    @Test
     66    void testMergeFromIAE() {
     67        assertThrows(IllegalArgumentException.class, () -> new GeoImageLayer(null, null).mergeFrom(new OsmDataLayer(new DataSet(), "", null)));
    6868    }
    6969}
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplayTest.java

    r13127 r17275  
    22package org.openstreetmap.josm.gui.layer.geoimage;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.awt.Dimension;
    77import java.awt.Rectangle;
    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.gui.layer.geoimage.ImageDisplay.VisRect;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1717 * Unit tests of {@link ImageDisplay} class.
    1818 */
    19 public class ImageDisplayTest {
     19class ImageDisplayTest {
    2020    /**
    2121     * We need prefs for this.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2929     */
    3030    @Test
    31     public void testCalculateDrawImageRectangle() {
     31    void testCalculateDrawImageRectangle() {
    3232        assertEquals(new Rectangle(),
    3333                ImageDisplay.calculateDrawImageRectangle(new VisRect(), new Dimension()));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/ImageEntryTest.java

    r14212 r17275  
    22package org.openstreetmap.josm.gui.layer.geoimage;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.File;
    77
    8 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.TestUtils;
    1010import org.openstreetmap.josm.data.gpx.GpxImageEntry;
     
    1616 * Unit tests of {@link ImageEntry} class.
    1717 */
    18 public class ImageEntryTest {
     18class ImageEntryTest {
    1919
    2020    /**
     
    2222     */
    2323    @Test
    24     public void testTicket12255() {
     24    void testTicket12255() {
    2525        ImageEntry e = new ImageEntry(new File(TestUtils.getRegressionDataFile(12255, "G0016941.JPG")));
    2626        e.extractExif();
     
    3232     */
    3333    @Test
    34     public void testEqualsContract() {
     34    void testEqualsContract() {
    3535        TestUtils.assumeWorkingEqualsVerifier();
    3636        EqualsVerifier.forClass(ImageEntry.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ChooseTrackVisibilityActionTest.java

    r15516 r17275  
    22package org.openstreetmap.josm.gui.layer.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JLabel;
    77import javax.swing.JPanel;
    88
    9 import org.junit.Ignore;
    10 import org.junit.Rule;
    11 import org.junit.Test;
     9import org.junit.jupiter.api.Disabled;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1212import org.openstreetmap.josm.TestUtils;
    1313import org.openstreetmap.josm.gui.ExtendedDialog;
     
    2121 * Unit tests of {@link ChooseTrackVisibilityAction} class.
    2222 */
    23 public class ChooseTrackVisibilityActionTest {
     23class ChooseTrackVisibilityActionTest {
    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();
     
    3535     */
    3636    @Test
    37     @Ignore("broken, see #16796")
    38     public void testAction() throws Exception {
     37    @Disabled("broken, see #16796")
     38    void testAction() throws Exception {
    3939        TestUtils.assumeWorkingJMockit();
    4040        final ExtendedDialogMocker edMocker = new ExtendedDialogMocker() {
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/ConvertToDataLayerActionTest.java

    r16953 r17275  
    22package org.openstreetmap.josm.gui.layer.gpx;
    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
    77import java.io.IOException;
     
    1515import java.util.stream.Collectors;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.TestUtils;
    2020import org.openstreetmap.josm.data.coor.LatLon;
     
    4242     * Setup test.
    4343     */
    44     @Rule
     44    @RegisterExtension
    4545    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4646    public JOSMTestRules test = new JOSMTestRules();
     
    5151     */
    5252    @Test
    53     public void testFromMarkerLayer() throws Exception {
     53    void testFromMarkerLayer() throws Exception {
    5454        final GpxData data = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "minimal.gpx");
    5555        final MarkerLayer markers = new MarkerLayer(data, "Markers", data.storageFile, null);
     
    6565     */
    6666    @Test
    67     public void testFromTrack() throws Exception {
     67    void testFromTrack() throws Exception {
    6868        Config.getPref().put("gpx.convert-tags", "no");
    6969        testFromTrack("tracks.gpx", "tracks.osm");
     
    138138                .collect(Collectors.toList());
    139139
    140         assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", nodesExpected, nodes);
     140        assertEquals(nodesExpected, nodes, "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!");
    141141
    142142        List<String> ways = osm.getWays().stream()
     
    152152                .collect(Collectors.toList());
    153153
    154         assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", waysExpected, ways);
     154        assertEquals(waysExpected, ways, "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!");
    155155
    156         assertEquals("Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!", osmExpected.allPrimitives().size(),
    157                 osm.allPrimitives().size());
     156        assertEquals(osmExpected.allPrimitives().size(), osm.allPrimitives().size(),
     157                "Conversion " + originalGpx + " -> " + expectedOsm + " didn't match!");
    158158    }
    159159
     
    164164     */
    165165    @Test
    166     public void testTicket14275() throws IOException, SAXException {
     166    void testTicket14275() throws IOException, SAXException {
    167167        assertNotNull(GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(14275, "1485101437.8189685.gpx")));
    168168    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java

    r16850 r17275  
    22package org.openstreetmap.josm.gui.layer.gpx;
    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;
    77
    88import java.util.Collections;
    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.gpx.GpxData;
     
    2525 * Unit tests of {@link DownloadAlongTrackAction} class.
    2626 */
    27 public class DownloadAlongTrackActionTest {
     27class DownloadAlongTrackActionTest {
    2828
    2929    /**
    3030     * The test rules for this test
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    7272     */
    7373    @Test
    74     public void testDownload() throws Exception {
     74    void testDownload() throws Exception {
    7575        assertNotNull(createTask("minimal.gpx"));
    7676    }
     
    8181     */
    8282    @Test
    83     public void testDownloadEmpty() throws Exception {
     83    void testDownloadEmpty() throws Exception {
    8484        assertNull(createTask("empty.gpx"));
    8585    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java

    r16160 r17275  
    22package org.openstreetmap.josm.gui.layer.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.FileNotFoundException;
     
    1212import java.util.stream.Collectors;
    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.data.gpx.GpxData;
     
    2828 * Unit tests of {@link GpxDrawHelper} class.
    2929 */
    30 public class GpxDrawHelperTest {
     30class GpxDrawHelperTest {
    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();
     
    4444     */
    4545    @Test
    46     public void testTicket12312() throws FileNotFoundException, IOException, SAXException {
     46    void testTicket12312() throws FileNotFoundException, IOException, SAXException {
    4747        final Map<String, String> prefs = new HashMap<String, String>() {{
    4848            put("colormode.dynamic-range", "true");
     
    6060     */
    6161    @Test
    62     public void testNone() throws IOException, SAXException {
     62    void testNone() throws IOException, SAXException {
    6363        final List<String> colors = calculateColors("nodist/data/2094047.gpx", Collections.emptyMap(), 10);
    6464        assertEquals("[#000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000, #000000]", colors.toString());
     
    7272     */
    7373    @Test
    74     public void testVelocity() throws IOException, SAXException {
     74    void testVelocity() throws IOException, SAXException {
    7575        final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.VELOCITY.toIndex()));
    7676        final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10);
     
    8585     */
    8686    @Test
    87     public void testVelocityDynamic() throws IOException, SAXException {
     87    void testVelocityDynamic() throws IOException, SAXException {
    8888        final Map<String, String> prefs = new HashMap<String, String>() {{
    8989            put("colormode.dynamic-range", "true");
     
    101101     */
    102102    @Test
    103     public void testDirection() throws IOException, SAXException {
     103    void testDirection() throws IOException, SAXException {
    104104        final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.DIRECTION.toIndex()));
    105105        final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10);
     
    114114     */
    115115    @Test
    116     public void testTime() throws IOException, SAXException {
     116    void testTime() throws IOException, SAXException {
    117117        final Map<String, String> prefs = Collections.singletonMap("colormode", Integer.toString(ColorMode.TIME.toIndex()));
    118118        final List<String> colors = calculateColors("nodist/data/2094047.gpx", prefs, 10);
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/ColorfulImageProcessorTest.java

    r13397 r17275  
    22package org.openstreetmap.josm.gui.layer.imagery;
    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 java.awt.image.IndexColorModel;
    1212
    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 * @author Michael Zangl
    2222 */
    23 public class ColorfulImageProcessorTest {
     23class ColorfulImageProcessorTest {
    2424
    2525    private static final int TEST_IMAGE_SIZE = 5;
     
    4444     * No special rules
    4545     */
    46     @Rule
     46    @RegisterExtension
    4747    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4848    public JOSMTestRules test = new JOSMTestRules();
     
    5252     */
    5353    @Test
    54     public void testSetGet() {
     54    void testSetGet() {
    5555        ColorfulImageProcessor processor = new ColorfulImageProcessor();
    5656
     
    8080     */
    8181    @Test
    82     public void testProcessing() {
     82    void testProcessing() {
    8383        for (ConversionData data : new ConversionData[] {
    8484                new ConversionData(Color.BLACK, 1.5, Color.BLACK),
     
    114114            for (int y = 0; y < TEST_IMAGE_SIZE; y++) {
    115115                Color color = new Color(image.getRGB(x, y));
    116                 assertEquals(data + ":" + type + ": red", data.getExpectedColor().getRed(), color.getRed(), 1.05);
    117                 assertEquals(data + ":" + type + ": green", data.getExpectedColor().getGreen(), color.getGreen(), 1.05);
    118                 assertEquals(data + ":" + type + ": blue", data.getExpectedColor().getBlue(), color.getBlue(), 1.05);
     116                assertEquals(data.getExpectedColor().getRed(), color.getRed(), 1.05, data + ":" + type + ": red");
     117                assertEquals(data.getExpectedColor().getGreen(), color.getGreen(), 1.05, data + ":" + type + ": green");
     118                assertEquals(data.getExpectedColor().getBlue(), color.getBlue(), 1.05, data + ":" + type + ": blue");
    119119            }
    120120        }
     
    171171     */
    172172    @Test
    173     public void testToString() {
     173    void testToString() {
    174174        ColorfulImageProcessor processor = new ColorfulImageProcessor();
    175175        assertEquals("ColorfulImageProcessor [colorfulness=1.0]", processor.toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/GammaImageProcessorTest.java

    r10547 r17275  
    22package org.openstreetmap.josm.gui.layer.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 * @author Michael Zangl
    1515 */
    16 public class GammaImageProcessorTest {
     16class GammaImageProcessorTest {
    1717
    1818    /**
    1919     * No special rules
    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 testSetGet() {
     29    void testSetGet() {
    3030        GammaImageProcessor processor = new GammaImageProcessor();
    3131
     
    5555     */
    5656    @Test
    57     public void testToString() {
     57    void testToString() {
    5858        GammaImageProcessor processor = new GammaImageProcessor();
    5959        assertEquals("GammaImageProcessor [gamma=1.0]", processor.toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java

    r10556 r17275  
    22package org.openstreetmap.josm.gui.layer.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 * @author Michael Zangl
    1515 */
    16 public class SharpenImageProcessorTest {
     16class SharpenImageProcessorTest {
    1717
    1818    /**
    1919     * No special rules
    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 testSetGet() {
     29    void testSetGet() {
    3030        SharpenImageProcessor processor = new SharpenImageProcessor();
    3131
     
    5555     */
    5656    @Test
    57     public void testToString() {
     57    void testToString() {
    5858        SharpenImageProcessor processor = new SharpenImageProcessor();
    5959        assertEquals("SharpenImageProcessor [sharpenLevel=1.0]", processor.toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.gui.layer.markerlayer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.net.MalformedURLException;
    77import java.net.URL;
    88
    9 import org.junit.BeforeClass;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.BeforeAll;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.data.coor.LatLon;
     
    1717 * Unit tests of {@link AudioMarker} class.
    1818 */
    19 public class AudioMarkerTest {
     19class AudioMarkerTest {
    2020
    2121    /**
    2222     * Setup tests
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUpBeforeClass() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAudioMarker() throws MalformedURLException {
     34    void testAudioMarker() throws MalformedURLException {
    3535        URL url = new URL("file://something.wav");
    3636        AudioMarker marker = new AudioMarker(
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/ImageMarkerTest.java

    r9779 r17275  
    22package org.openstreetmap.josm.gui.layer.markerlayer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.net.MalformedURLException;
    77import java.net.URL;
    88
    9 import org.junit.BeforeClass;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.BeforeAll;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.data.coor.LatLon;
     
    1717 * Unit tests of {@link ImageMarker} class.
    1818 */
    19 public class ImageMarkerTest {
     19class ImageMarkerTest {
    2020
    2121    /**
    2222     * Setup tests
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUpBeforeClass() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testImageMarker() throws MalformedURLException {
     34    void testImageMarker() throws MalformedURLException {
    3535        ImageMarker marker = new ImageMarker(
    3636                LatLon.ZERO,
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/MarkerLayerTest.java

    r15496 r17275  
    22package org.openstreetmap.josm.gui.layer.markerlayer;
    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.Arrays;
    1010
    11 import org.junit.Before;
    12 import org.junit.Rule;
    13 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeEach;
     12import org.junit.jupiter.api.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
    1414import org.openstreetmap.josm.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    2929 * Unit tests of {@link MarkerLayer} class.
    3030 */
    31 public class MarkerLayerTest {
     31class MarkerLayerTest {
    3232
    3333    /**
    3434     * For creating layers
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules().main().preferences().projection();
     
    4141     * Setup tests
    4242     */
    43     @Before
     43    @BeforeEach
    4444    public void setUp() {
    4545        Config.getPref().putBoolean("marker.traceaudio", true);
     
    5050     */
    5151    @Test
    52     public void testMarkerLayer() {
     52    void testMarkerLayer() {
    5353        MarkerLayer layer = new MarkerLayer(new GpxData(), "foo", null, null);
    5454        MainApplication.getLayerManager().addLayer(layer);
     
    8383     */
    8484    @Test
    85     public void testPlayHeadMarker() {
     85    void testPlayHeadMarker() {
    8686        try {
    8787            MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarkerTest.java

    r9814 r17275  
    22package org.openstreetmap.josm.gui.layer.markerlayer;
    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.BeforeClass;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.BeforeAll;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.JOSMFixture;
    1010import org.openstreetmap.josm.data.coor.LatLon;
     
    1414 * Unit tests of {@link PlayHeadMarker} class.
    1515 */
    16 public class PlayHeadMarkerTest {
     16class PlayHeadMarkerTest {
    1717
    1818    /**
    1919     * Setup tests
    2020     */
    21     @BeforeClass
     21    @BeforeAll
    2222    public static void setUpBeforeClass() {
    2323        JOSMFixture.createUnitTestFixture().init();
     
    2828     */
    2929    @Test
    30     public void testPlayHeadMarker() {
     30    void testPlayHeadMarker() {
    3131        PlayHeadMarker marker = PlayHeadMarker.create();
    3232        assertNotNull(marker);
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/WebMarkerTest.java

    r17125 r17275  
    2525 * Unit tests of {@link WebMarker} class.
    2626 */
    27 public class WebMarkerTest {
     27class WebMarkerTest {
    2828
    2929    /**
     
    4141     */
    4242    @Test
    43     public void testWebMarker(@Injectable final PlatformHook mockPlatformHook,
     43    void testWebMarker(@Injectable final PlatformHook mockPlatformHook,
    4444                              @Mocked final PlatformManager platformManager) throws Exception {
    4545        TestUtils.assumeWorkingJMockit();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/AllMappaintTests.java

    r14068 r17275  
    1515    AllMapCSSTests.class
    1616})
    17 public class AllMappaintTests {
     17class AllMappaintTests {
    1818
    1919}
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/LabelCompositionStrategyTest.java

    r14048 r17275  
    22package org.openstreetmap.josm.gui.mappaint;
    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.util.Arrays;
    88import java.util.Collections;
    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.gui.mappaint.styleelement.LabelCompositionStrategy;
     
    2222 * Unit tests of {@link LabelCompositionStrategy}.
    2323 */
    24 public class LabelCompositionStrategyTest {
     24class LabelCompositionStrategyTest {
    2525
    2626    /**
    2727     * Setup rule
    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 testCreateStaticLabelCompositionStrategy() {
     37    void testCreateStaticLabelCompositionStrategy() {
    3838        Node n = new Node();
    3939
     
    4949     */
    5050    @Test
    51     public void testCreateTagLookupCompositionStrategy() {
     51    void testCreateTagLookupCompositionStrategy() {
    5252        Node n = new Node();
    5353        n.put("my-tag", "my-value");
     
    6767     */
    6868    @Test
    69     public void testCreateDeriveLabelFromNameTagsCompositionStrategy() {
     69    void testCreateDeriveLabelFromNameTagsCompositionStrategy() {
    7070        DeriveLabelFromNameTagsCompositionStrategy strat = new DeriveLabelFromNameTagsCompositionStrategy();
    7171        strat.setNameTags(null);
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/MapCSSWithExtendedTextDirectivesTest.java

    r14048 r17275  
    22package org.openstreetmap.josm.gui.mappaint;
    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.awt.Color;
    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.Node;
    1414import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.TagKeyReference;
     
    2323 * Extended text directives tests.
    2424 */
    25 public class MapCSSWithExtendedTextDirectivesTest {
     25class MapCSSWithExtendedTextDirectivesTest {
    2626
    2727    /**
    2828     * Setup rule
    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 testCreateAutoTextElement() {
     38    void testCreateAutoTextElement() {
    3939        MultiCascade mc = new MultiCascade();
    4040        Cascade c = mc.getOrCreateCascade("default");
     
    5353     */
    5454    @Test
    55     public void testCreateTextElementComposingTextFromTag() {
     55    void testCreateTextElementComposingTextFromTag() {
    5656        MultiCascade mc = new MultiCascade();
    5757        Cascade c = mc.getOrCreateCascade("default");
     
    7171     */
    7272    @Test
    73     public void testCreateNullStrategy() {
     73    void testCreateNullStrategy() {
    7474        MultiCascade mc = new MultiCascade();
    7575        Node osm = new Node();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/RenderingCLIAreaTest.java

    r16643 r17275  
    1212import org.hamcrest.CoreMatchers;
    1313import org.hamcrest.Matcher;
    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.junit.runner.RunWith;
    1717import org.junit.runners.Parameterized;
     
    2626 */
    2727@RunWith(Parameterized.class)
    28 public class RenderingCLIAreaTest {
     28class RenderingCLIAreaTest {
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().projection().territories();
     
    153153    private final Matcher<Bounds> boundsMatcher;
    154154
    155     public RenderingCLIAreaTest(String args, Matcher<Double> scaleMatcher, Matcher<Bounds> boundsMatcher) {
     155    RenderingCLIAreaTest(String args, Matcher<Double> scaleMatcher, Matcher<Bounds> boundsMatcher) {
    156156        this.args = args.split("\\s+", -1);
    157157        this.scaleMatcher = scaleMatcher;
     
    160160
    161161    @Test
    162     public void testDetermineRenderingArea() {
     162    void testDetermineRenderingArea() {
    163163        RenderingCLI cli = new RenderingCLI();
    164164        cli.parseArguments(args);
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ChildOrParentSelectorTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    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.nio.file.Files;
     
    1010import java.util.Arrays;
    1111
    12 import org.junit.Before;
    13 import org.junit.Ignore;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Disabled;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.coor.LatLon;
    1717import org.openstreetmap.josm.data.osm.DataSet;
     
    3232 * Unit tests of {@link ChildOrParentSelector}.
    3333 */
    34 public class ChildOrParentSelectorTest {
     34class ChildOrParentSelectorTest {
    3535
    3636    private DataSet ds;
     
    3939     * Setup rule
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules().projection();
     
    4646     * Setup test
    4747     */
    48     @Before
     48    @BeforeEach
    4949    public void setUp() {
    5050        ds = new DataSet();
     
    7878
    7979    @Test
    80     @Ignore
     80    @Disabled
    8181    public void matches_1() {
    8282        String css = "relation >[role=\"my_role\"] node {}";
     
    9292
    9393    @Test
    94     @Ignore
     94    @Disabled
    9595    public void matches_2() {
    9696        String css = "relation >[\"my_role\"] node {}";
     
    106106
    107107    @Test
    108     @Ignore
     108    @Disabled
    109109    public void matches_3() {
    110110        String css = "relation >[!\"my_role\"] node {}";
     
    120120
    121121    @Test
    122     @Ignore
     122    @Disabled
    123123    public void matches_4() {
    124124        String css = "way < relation {}";
     
    189189    /**
    190190     * Test inside/contains selectors (spatial test)
     191     * @throws Exception in case of any error
    191192     */
    192193    @Test
    193     public void testContains() throws Exception {
     194    void testContains() throws Exception {
    194195        ds = OsmReader.parseDataSet(Files.newInputStream(Paths.get("nodist/data/amenity-in-amenity.osm")), null);
    195196        ChildOrParentSelector css = parse("node[tag(\"amenity\") = parent_tag(\"amenity\")] ∈ *[amenity] {}");
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactoryTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import static org.junit.jupiter.api.Assertions.assertThrows;
     5
     6import org.junit.jupiter.api.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
    68import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context;
    79import org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.Op;
     
    1517 * Unit tests of {@link ConditionFactory}.
    1618 */
    17 public class ConditionFactoryTest {
     19class ConditionFactoryTest {
    1820
    1921    /**
    2022     * Setup rule
    2123     */
    22     @Rule
     24    @RegisterExtension
    2325    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2426    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2628    /**
    2729     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/14368">#14368</a>.
    28      * @throws Exception if an error occurs
    2930     */
    30     @Test(expected = MapCSSException.class)
    31     public void testTicket14368() throws Exception {
    32         ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false);
     31    @Test
     32    void testTicket14368() {
     33        assertThrows(MapCSSException.class,
     34                () -> ConditionFactory.createKeyValueCondition("name", "Rodovia ([A-Z]{2,3}-[0-9]{2,4}", Op.REGEX, Context.PRIMITIVE, false));
    3335    }
    3436
     
    3840     */
    3941    @Test
    40     public void testUtilityClass() throws ReflectiveOperationException {
     42    void testUtilityClass() throws ReflectiveOperationException {
    4143        UtilityClassTestUtil.assertUtilityClassWellDefined(PseudoClasses.class);
    4244    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionTest.java

    r10837 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
    7 
    8 import org.junit.Before;
    9 import org.junit.Rule;
    10 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.assertTrue;
     7
     8import org.junit.jupiter.api.BeforeEach;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1212import org.openstreetmap.josm.data.osm.OsmUtils;
     
    2424 * @author Michael Zangl
    2525 */
    26 public class ConditionTest {
     26class ConditionTest {
    2727    /**
    2828     * We need prefs for nodes.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4040     * Set up some useful test data.
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        node0 = OsmUtils.createPrimitive("n");
     
    5353     */
    5454    @Test
    55     public void testKeyValueEq() {
     55    void testKeyValueEq() {
    5656        Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.EQ, Context.PRIMITIVE, false);
    5757        assertFalse(op.applies(genEnv(node0)));
     
    7171     */
    7272    @Test
    73     public void testKeyValueEqAsKey() {
     73    void testKeyValueEqAsKey() {
    7474        Condition op = ConditionFactory.createKeyValueCondition("k1", "k2", Op.EQ, Context.PRIMITIVE, true);
    7575        assertFalse(op.applies(genEnv(node0)));
     
    8787     */
    8888    @Test
    89     public void testKeyValueNeq() {
     89    void testKeyValueNeq() {
    9090        Condition op = ConditionFactory.createKeyValueCondition("k1", "v1", Op.NEQ, Context.PRIMITIVE, false);
    9191        assertTrue(op.applies(genEnv(node0)));
     
    100100     */
    101101    @Test
    102     public void testKeyValueGreatherEq() {
     102    void testKeyValueGreatherEq() {
    103103        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER_OR_EQUAL, Context.PRIMITIVE, false);
    104104        assertFalse(op.applies(genEnv(node0)));
     
    113113     */
    114114    @Test
    115     public void testKeyValueGreather() {
     115    void testKeyValueGreather() {
    116116        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.GREATER, Context.PRIMITIVE, false);
    117117        assertFalse(op.applies(genEnv(node0)));
     
    126126     */
    127127    @Test
    128     public void testKeyValueLessEq() {
     128    void testKeyValueLessEq() {
    129129        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS_OR_EQUAL, Context.PRIMITIVE, false);
    130130        assertFalse(op.applies(genEnv(node0)));
     
    139139     */
    140140    @Test
    141     public void testKeyValueLess() {
     141    void testKeyValueLess() {
    142142        Condition op = ConditionFactory.createKeyValueCondition("f1", "0.2", Op.LESS, Context.PRIMITIVE, false);
    143143        assertFalse(op.applies(genEnv(node0)));
     
    152152     */
    153153    @Test
    154     public void testKeyValueRegex() {
     154    void testKeyValueRegex() {
    155155        Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.REGEX, Context.PRIMITIVE, false);
    156156        assertFalse(op.applies(genEnv(node0)));
     
    165165     */
    166166    @Test
    167     public void testKeyValueNregex() {
     167    void testKeyValueNregex() {
    168168        Condition op = ConditionFactory.createKeyValueCondition("r1", "(ab){2}", Op.NREGEX, Context.PRIMITIVE, false);
    169169        assertTrue(op.applies(genEnv(node0)));
     
    178178     */
    179179    @Test
    180     public void testKeyValueOneOf() {
     180    void testKeyValueOneOf() {
    181181        Condition op = ConditionFactory.createKeyValueCondition("one", "a", Op.ONE_OF, Context.PRIMITIVE, false);
    182182        assertFalse(op.applies(genEnv(node0)));
     
    191191     */
    192192    @Test
    193     public void testKeyValueBeginsWith() {
     193    void testKeyValueBeginsWith() {
    194194        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.BEGINS_WITH, Context.PRIMITIVE, false);
    195195        assertFalse(op.applies(genEnv(node0)));
     
    204204     */
    205205    @Test
    206     public void testKeyValueEndsWith() {
     206    void testKeyValueEndsWith() {
    207207        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.ENDS_WITH, Context.PRIMITIVE, false);
    208208        assertFalse(op.applies(genEnv(node0)));
     
    217217     */
    218218    @Test
    219     public void testKeyValueContains() {
     219    void testKeyValueContains() {
    220220        Condition op = ConditionFactory.createKeyValueCondition("c1", "xy", Op.CONTAINS, Context.PRIMITIVE, false);
    221221        assertFalse(op.applies(genEnv(node0)));
     
    230230     */
    231231    @Test
    232     public void testRegexpKeyValueRegexpCondition() {
     232    void testRegexpKeyValueRegexpCondition() {
    233233        Condition op = ConditionFactory.createRegexpKeyRegexpValueCondition("^k", "\\da", Op.REGEX);
    234234        assertFalse(op.applies(genEnv(node0)));
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ExpressionFactoryTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    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 of {@link ExpressionFactory}.
    1313 */
    14 public class ExpressionFactoryTest {
     14class ExpressionFactoryTest {
    1515
    1616    /**
    1717     * Setup rule
    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(Functions.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/FunctionsTest.java

    r16590 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    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.OsmPrimitiveType.NODE;
    77
    88import java.util.Collections;
    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.OsmPrimitive;
     
    2525 * Unit tests of {@link Functions}.
    2626 */
    27 public class FunctionsTest {
     27class FunctionsTest {
    2828
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    6060     */
    6161    @Test
    62     public void testOsmUserName() {
     62    void testOsmUserName() {
    6363        assertEquals("<anonymous>", Functions.osm_user_name(new EnvBuilder(NODE).setUser(User.getAnonymous()).build()));
    6464    }
     
    6868     */
    6969    @Test
    70     public void testOsmUserId() {
     70    void testOsmUserId() {
    7171        assertEquals(-1, Functions.osm_user_id(new EnvBuilder(NODE).setUser(User.getAnonymous()).build()));
    7272    }
     
    7676     */
    7777    @Test
    78     public void testOsmVersion() {
     78    void testOsmVersion() {
    7979        assertEquals(0, Functions.osm_version(new EnvBuilder(NODE).build()));
    8080    }
     
    8484     */
    8585    @Test
    86     public void testOsmChangesetId() {
     86    void testOsmChangesetId() {
    8787        assertEquals(0, Functions.osm_changeset_id(new EnvBuilder(NODE).build()));
    8888    }
     
    9292     */
    9393    @Test
    94     public void testOsmTimestamp() {
     94    void testOsmTimestamp() {
    9595        assertEquals(0, Functions.osm_timestamp(new EnvBuilder(NODE).build()));
    9696    }
     
    100100     */
    101101    @Test
    102     public void testParseFunctions() {
     102    void testParseFunctions() {
    103103        assertTrue(Functions.to_boolean("true"));
    104104        assertEquals(1, Functions.to_byte("1"));
     
    114114     */
    115115    @Test
    116     public void testPref() {
     116    void testPref() {
    117117        String key = "Functions.JOSM_pref";
    118118        Config.getPref().put(key, null);
     
    135135     */
    136136    @Test
    137     public void testPrefColor() {
     137    void testPrefColor() {
    138138        String key = "Functions.JOSM_pref";
    139139        String colorKey = NamedColorProperty.NAMED_COLOR_PREFIX + NamedColorProperty.COLOR_CATEGORY_MAPPAINT + ".unknown." + key;
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyConditionTest.java

    r14064 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    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.coor.LatLon;
    1212import org.openstreetmap.josm.data.osm.DataSet;
     
    2626 * Unit tests of {@link KeyCondition}.
    2727 */
    28 public class KeyConditionTest {
     28class KeyConditionTest {
    2929
    3030    private DataSet ds;
     
    3333     * Setup rule
    3434     */
    35     @Rule
     35    @RegisterExtension
    3636    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3737    public JOSMTestRules test = new JOSMTestRules().projection();
     
    4040     * Setup test
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        ds = new DataSet();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/KeyValueConditionTest.java

    r14064 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.io.StringReader;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.data.coor.LatLon;
    1414import org.openstreetmap.josm.data.osm.DataSet;
     
    3030 * Unit tests of {@link KeyValueCondition}.
    3131 */
    32 public class KeyValueConditionTest {
     32class KeyValueConditionTest {
    3333
    3434    private DataSet ds;
     
    3737     * Setup rule
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules().projection();
     
    4444     * Setup test
    4545     */
    46     @Before
     46    @BeforeEach
    4747    public void setUp() {
    4848        ds = new DataSet();
     
    114114
    115115    @Test
    116     public void testKeyRegexValueRegex() throws Exception {
     116    void testKeyRegexValueRegex() throws Exception {
    117117        Selector selPos = new MapCSSParser(new StringReader("*[/^source/ =~ /.*,.*/]")).selector();
    118118        Selector selNeg = new MapCSSParser(new StringReader("*[/^source/ !~ /.*,.*/]")).selector();
     
    129129
    130130    @Test
    131     public void testValueFive() throws Exception {
     131    void testValueFive() throws Exception {
    132132        // ticket #5985
    133133        Selector sel = new MapCSSParser(new StringReader("*[width=5]")).selector();
     
    137137
    138138    @Test
    139     public void testValueZero() throws Exception {
     139    void testValueZero() throws Exception {
    140140        // ticket #12267
    141141        Selector sel = new MapCSSParser(new StringReader("*[frequency=0]")).selector();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTest.java

    r16909 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    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;
    910import static org.openstreetmap.josm.gui.mappaint.mapcss.Condition.Context.PRIMITIVE;
    1011
     
    1516
    1617import org.junit.Assert;
    17 import org.junit.Rule;
    18 import org.junit.Test;
     18import org.junit.jupiter.api.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    1920import org.openstreetmap.josm.TestUtils;
    2021import org.openstreetmap.josm.data.coor.LatLon;
     
    4647 * Unit tests of {@link MapCSSParser}.
    4748 */
    48 public class MapCSSParserTest {
     49class MapCSSParserTest {
    4950
    5051    protected static Environment getEnvironment(String key, String value) {
     
    5960     * Setup rule
    6061     */
    61     @Rule
     62    @RegisterExtension
    6263    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6364    public JOSMTestRules test = new JOSMTestRules().projection();
    6465
    6566    @Test
    66     public void testDeclarations() throws Exception {
     67    void testDeclarations() throws Exception {
    6768        getParser("{ opacity: 0.5; color: rgb(1.0, 0.0, 0.0); }").declaration();
    6869        getParser("{ set tag=value; }").declaration(); //set a tag
     
    7374
    7475    @Test
    75     public void testClassCondition() throws Exception {
     76    void testClassCondition() throws Exception {
    7677        List<Condition> conditions = ((Selector.GeneralSelector) getParser("way[name=X].highway:closed").selector()).conds;
    7778        assertTrue(conditions.get(0) instanceof SimpleKeyValueCondition);
     
    8384
    8485    @Test
    85     public void testPseudoClassCondition() throws Exception {
     86    void testPseudoClassCondition() throws Exception {
    8687        Condition c1 = ((Selector.GeneralSelector) getParser("way!:area-style").selector()).conds.get(0);
    8788        Condition c2 = ((Selector.GeneralSelector) getParser("way!:areaStyle").selector()).conds.get(0);
     
    9394
    9495    @Test
    95     public void testClassMatching() throws Exception {
     96    void testClassMatching() throws Exception {
    9697        MapCSSStyleSource css = new MapCSSStyleSource(
    9798                "way[highway=footway] { set .path; color: #FF6644; width: 2; }\n" +
     
    117118
    118119    @Test
    119     public void testEqualCondition() throws Exception {
     120    void testEqualCondition() throws Exception {
    120121        Condition condition = getParser("[surface=paved]").condition(PRIMITIVE);
    121122        assertTrue(condition instanceof SimpleKeyValueCondition);
     
    127128
    128129    @Test
    129     public void testNotEqualCondition() throws Exception {
     130    void testNotEqualCondition() throws Exception {
    130131        KeyValueCondition condition = (KeyValueCondition) getParser("[surface!=paved]").condition(PRIMITIVE);
    131132        assertEquals(Op.NEQ, condition.op);
     
    135136
    136137    @Test
    137     public void testRegexCondition() throws Exception {
     138    void testRegexCondition() throws Exception {
    138139        KeyValueCondition condition = (KeyValueCondition) getParser("[surface=~/paved|unpaved/]").condition(PRIMITIVE);
    139140        assertEquals(Op.REGEX, condition.op);
     
    143144
    144145    @Test
    145     public void testRegexConditionParenthesis() throws Exception {
     146    void testRegexConditionParenthesis() throws Exception {
    146147        KeyValueCondition condition = (KeyValueCondition) getParser("[name =~ /^\\(foo\\)/]").condition(PRIMITIVE);
    147148        assertTrue(condition.applies(getEnvironment("name", "(foo)")));
     
    151152
    152153    @Test
    153     public void testNegatedRegexCondition() throws Exception {
     154    void testNegatedRegexCondition() throws Exception {
    154155        KeyValueCondition condition = (KeyValueCondition) getParser("[surface!~/paved|unpaved/]").condition(PRIMITIVE);
    155156        assertEquals(Op.NREGEX, condition.op);
     
    159160
    160161    @Test
    161     public void testBeginsEndsWithCondition() throws Exception {
     162    void testBeginsEndsWithCondition() throws Exception {
    162163        KeyValueCondition condition = (KeyValueCondition) getParser("[foo ^= bar]").condition(PRIMITIVE);
    163164        assertEquals(Op.BEGINS_WITH, condition.op);
     
    173174
    174175    @Test
    175     public void testOneOfCondition() throws Exception {
     176    void testOneOfCondition() throws Exception {
    176177        Condition condition = getParser("[vending~=stamps]").condition(PRIMITIVE);
    177178        assertTrue(condition.applies(getEnvironment("vending", "stamps")));
     
    182183
    183184    @Test
    184     public void testStandardKeyCondition() throws Exception {
     185    void testStandardKeyCondition() throws Exception {
    185186        KeyCondition c1 = (KeyCondition) getParser("[ highway ]").condition(PRIMITIVE);
    186187        assertEquals(KeyMatchType.EQ, c1.matchType);
     
    194195
    195196    @Test
    196     public void testYesNoKeyCondition() throws Exception {
     197    void testYesNoKeyCondition() throws Exception {
    197198        KeyCondition c1 = (KeyCondition) getParser("[oneway?]").condition(PRIMITIVE);
    198199        KeyCondition c2 = (KeyCondition) getParser("[oneway?!]").condition(PRIMITIVE);
     
    217218
    218219    @Test
    219     public void testRegexKeyCondition() throws Exception {
     220    void testRegexKeyCondition() throws Exception {
    220221        KeyCondition c1 = (KeyCondition) getParser("[/.*:(backward|forward)$/]").condition(PRIMITIVE);
    221222        assertEquals(KeyMatchType.REGEX, c1.matchType);
     
    227228
    228229    @Test
    229     public void testRegexKeyValueRegexpCondition() throws Exception {
     230    void testRegexKeyValueRegexpCondition() throws Exception {
    230231        RegexpKeyValueRegexpCondition c1 = (RegexpKeyValueRegexpCondition) getParser("[/^name/=~/Test/]").condition(PRIMITIVE);
    231232        assertEquals("^name", c1.keyPattern.pattern());
     
    236237
    237238    @Test
    238     public void testNRegexKeyConditionSelector() throws Exception {
     239    void testNRegexKeyConditionSelector() throws Exception {
    239240        Selector s1 = getParser("*[sport][tourism != hotel]").selector();
    240241        assertTrue(s1.matches(new Environment(OsmUtils.createPrimitive("node sport=foobar"))));
     
    247248
    248249    @Test
    249     public void testKeyKeyCondition() throws Exception {
     250    void testKeyKeyCondition() throws Exception {
    250251        KeyValueCondition c1 = (KeyValueCondition) getParser("[foo = *bar]").condition(PRIMITIVE);
    251252        Way w1 = new Way();
     
    270271     */
    271272    @Test
    272     public void testTagRegex() throws Exception {
     273    void testTagRegex() throws Exception {
    273274        DataSet ds = new DataSet();
    274275        Way way1 = TestUtils.newWay("old_ref=A1 ref=A2", new Node(new LatLon(1, 1)), new Node(new LatLon(2, 2)));
     
    300301
    301302    @Test
    302     public void testParentTag() throws Exception {
     303    void testParentTag() throws Exception {
    303304        Selector c1 = getParser("way[foo] > node[tag(\"foo\")=parent_tag(\"foo\")] {}").child_selector();
    304305        DataSet ds = new DataSet();
     
    330331     */
    331332    @Test
    332     public void testTrimList() {
     333    void testTrimList() {
    333334        List<String> trimmed = Functions.trim_list(Arrays.asList(" A1 ", "A2", " A3", "A4 ", ""));
    334335        assertEquals(4, trimmed.size());
     
    340341
    341342    @Test
    342     public void testTicket8568() throws Exception {
     343    void testTicket8568() throws Exception {
    343344        MapCSSStyleSource sheet = new MapCSSStyleSource(
    344345                "way { width: 5; }\n" +
     
    357358
    358359    @Test
    359     public void testTicket8071() throws Exception {
     360    void testTicket8071() throws Exception {
    360361        MapCSSStyleSource sheet = new MapCSSStyleSource(
    361362                "*[rcn_ref], *[name] {text: concat(tag(rcn_ref), \" \", tag(name)); }");
     
    377378
    378379    @Test
    379     public void testColorNameTicket9191() throws Exception {
     380    void testColorNameTicket9191() throws Exception {
    380381        Environment e = new Environment(null, new MultiCascade(), Environment.DEFAULT_LAYER, null);
    381382        getParser("{color: testcolour1#88DD22}").declaration().instructions.get(0).execute(e);
     
    385386
    386387    @Test
    387     public void testColorNameTicket9191Alpha() throws Exception {
     388    void testColorNameTicket9191Alpha() throws Exception {
    388389        Environment e = new Environment(null, new MultiCascade(), Environment.DEFAULT_LAYER, null);
    389390        getParser("{color: testcolour2#12345678}").declaration().instructions.get(0).execute(e);
     
    393394
    394395    @Test
    395     public void testColorParsing() throws Exception {
     396    void testColorParsing() throws Exception {
    396397        assertEquals(new Color(0x12, 0x34, 0x56, 0x78), ColorHelper.html2color("#12345678"));
    397398    }
    398399
    399400    @Test
    400     public void testChildSelectorGreaterThanSignIsOptional() throws Exception {
     401    void testChildSelectorGreaterThanSignIsOptional() throws Exception {
    401402        assertEquals(
    402403                getParser("relation[type=route] way[highway]").child_selector().toString(),
     
    405406
    406407    @Test
    407     public void testSiblingSelector() throws Exception {
     408    void testSiblingSelector() throws Exception {
    408409        ChildOrParentSelector s1 = (Selector.ChildOrParentSelector) getParser(
    409410                "*[a?][parent_tag(\"highway\")=\"unclassified\"] + *[b?]").child_selector();
     
    431432
    432433    @Test
    433     public void testParentTags() throws Exception {
     434    void testParentTags() throws Exception {
    434435        DataSet ds = new DataSet();
    435436        Node n = new Node(new LatLon(1, 2));
     
    458459
    459460    @Test
    460     public void testSort() throws Exception {
     461    void testSort() throws Exception {
    461462        assertEquals(Arrays.asList(new String[] {"alpha", "beta"}), Functions.sort("beta", "alpha"));
    462463        Way way1 = TestUtils.newWay("highway=residential name=Alpha alt_name=Beta ref=\"A9;A8\"", new Node(new LatLon(0.001, 0.001)),
     
    480481
    481482    @Test
    482     public void testUniqueValues() throws Exception {
     483    void testUniqueValues() throws Exception {
    483484        assertEquals(Arrays.asList(new String[] {"alpha", "beta"}),
    484485                Functions.uniq("alpha", "alpha", "alpha", "beta"));
     
    488489
    489490    @Test
    490     public void testCountRoles() throws Exception {
     491    void testCountRoles() throws Exception {
    491492        DataSet ds = new DataSet();
    492493        Way way1 = TestUtils.newWay("highway=residential name=1",
     
    538539
    539540    @Test
    540     public void testSiblingSelectorInterpolation() throws Exception {
     541    void testSiblingSelectorInterpolation() throws Exception {
    541542        ChildOrParentSelector s1 = (Selector.ChildOrParentSelector) getParser(
    542543                "*[tag(\"addr:housenumber\") > child_tag(\"addr:housenumber\")][regexp_test(\"even|odd\", parent_tag(\"addr:interpolation\"))]" +
     
    568569
    569570    @Test
    570     public void testInvalidBaseSelector() throws Exception {
     571    void testInvalidBaseSelector() throws Exception {
    571572        MapCSSStyleSource css = new MapCSSStyleSource("invalid_base[key=value] {}");
    572573        css.loadStyleSource();
     
    576577
    577578    @Test
    578     public void testMinMaxFunctions() throws Exception {
     579    void testMinMaxFunctions() throws Exception {
    579580        MapCSSStyleSource sheet = new MapCSSStyleSource("* {" +
    580581                "min_value: min(tag(x), tag(y), tag(z)); " +
     
    600601     */
    601602    @Test
    602     public void testTicket12549() throws ParseException {
     603    void testTicket12549() throws ParseException {
    603604        Condition condition = getParser("[name =~ /^(?i)(?u)fóo$/]").condition(PRIMITIVE);
    604605        assertTrue(condition.applies(getEnvironment("name", "fóo")));
     
    615616     */
    616617    @Test
    617     public void testTicket17053() {
     618    void testTicket17053() {
    618619        MapCSSStyleSource sheet = new MapCSSStyleSource(
    619620            "way {\n" +
     
    625626            "}");
    626627        sheet.loadStyleSource();
    627         assertTrue(sheet.getErrors().toString(), sheet.getErrors().isEmpty());
     628        assertTrue(sheet.getErrors().isEmpty(), sheet.getErrors()::toString);
    628629    }
    629630
     
    633634     */
    634635    @Test
    635     public void testZoom() throws ParseException {
     636    void testZoom() throws ParseException {
    636637        assertNotNull(getParser("|z12").zoom());
    637638        assertNotNull(getParser("|z12-").zoom());
     
    642643    /**
    643644     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/18759">Bug #18759</a>.
    644      * @throws ParseException if a parsing error occurs
    645      */
    646     @Test(expected = IllegalArgumentException.class)
    647     public void testZoomIAE() throws ParseException {
    648         assertNotNull(getParser("|z16-15").zoom());
     645     */
     646    @Test
     647    void testZoomIAE() {
     648        assertThrows(IllegalArgumentException.class, () -> getParser("|z16-15").zoom());
    649649    }
    650650
     
    653653     */
    654654    @Test
    655     public void testTicket16183() {
     655    void testTicket16183() {
    656656        MapCSSStyleSource sheet = new MapCSSStyleSource(
    657657                "area:closed:areaStyle ⧉ area:closed:areaStyle {throwOther: \"xxx\";}");
     
    666666     */
    667667    @Test
    668     public void testTicket19685() {
     668    void testTicket19685() {
    669669        MapCSSStyleSource sheet = new MapCSSStyleSource("node:connection:foobar {}");
    670670        sheet.loadStyleSource();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParserTestIT.java

    r14746 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    33
    4 import org.junit.Ignore;
    5 import org.junit.Rule;
    6 import org.junit.Test;
     4import org.junit.jupiter.api.Disabled;
     5import org.junit.jupiter.api.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
    77import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1313 * Integration tests of {@link MapCSSParser}.
    1414 */
    15 public class MapCSSParserTestIT {
     15class MapCSSParserTestIT {
    1616
    1717    /**
    1818     * Setup rule
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().https().projection();
     
    2626     */
    2727    @Test
    28     @Ignore("parsing fails")
    29     public void testKothicStylesheets() {
     28    @Disabled("parsing fails")
     29    void testKothicStylesheets() {
    3030        new MapCSSStyleSource("https://raw.githubusercontent.com/kothic/kothic/master/src/styles/default.mapcss").loadStyleSource();
    3131        new MapCSSStyleSource("https://raw.githubusercontent.com/kothic/kothic/master/src/styles/mapink.mapcss").loadStyleSource();
  • trunk/test/unit/org/openstreetmap/josm/gui/mappaint/mapcss/ParsingLinkSelectorTest.java

    r14064 r17275  
    22package org.openstreetmap.josm.gui.mappaint.mapcss;
    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 {@code ParsingLinkSelector}.
    1414 */
    15 public class ParsingLinkSelectorTest {
     15class ParsingLinkSelectorTest {
    1616
    1717    /**
    1818     * Setup rule
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().projection();
  • trunk/test/unit/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBoxTest.java

    r10989 r17275  
    22package org.openstreetmap.josm.gui.oauth;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.ListCellRenderer;
    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 AuthorizationProcedureComboBox} class.
    1616 */
    17 public class AuthorizationProcedureComboBoxTest {
     17class AuthorizationProcedureComboBoxTest {
    1818
    1919    /**
    2020     * Setup tests
    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 testAuthorizationProcedureComboBox() {
     30    void testAuthorizationProcedureComboBox() {
    3131        ListCellRenderer<? super AuthorizationProcedure> r = new AuthorizationProcedureComboBox().getRenderer();
    3232        for (AuthorizationProcedure procedure : AuthorizationProcedure.values()) {
  • trunk/test/unit/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUITest.java

    r12634 r17275  
    22package org.openstreetmap.josm.gui.oauth;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.gui.MainApplication;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link FullyAutomaticAuthorizationUI} class.
    1515 */
    16 public class FullyAutomaticAuthorizationUITest {
     16class FullyAutomaticAuthorizationUITest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testFullyAutomaticAuthorizationUI() {
     29    void testFullyAutomaticAuthorizationUI() {
    3030        assertNotNull(new FullyAutomaticAuthorizationUI("", MainApplication.worker));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/oauth/FullyAutomaticPropertiesPanelTest.java

    r11202 r17275  
    22package org.openstreetmap.josm.gui.oauth;
    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 * Unit tests of {@link FullyAutomaticPropertiesPanel} class.
    1414 */
    15 public class FullyAutomaticPropertiesPanelTest {
     15class FullyAutomaticPropertiesPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testFullyAutomaticPropertiesPanel() {
     28    void testFullyAutomaticPropertiesPanel() {
    2929        assertTrue(new FullyAutomaticPropertiesPanel().getComponentCount() > 0);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUITest.java

    r12634 r17275  
    22package org.openstreetmap.josm.gui.oauth;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.gui.MainApplication;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link ManualAuthorizationUI} class.
    1515 */
    16 public class ManualAuthorizationUITest {
     16class ManualAuthorizationUITest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testManualAuthorizationUI() {
     29    void testManualAuthorizationUI() {
    3030        assertNotNull(new ManualAuthorizationUI("", MainApplication.worker));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUITest.java

    r12634 r17275  
    22package org.openstreetmap.josm.gui.oauth;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.gui.MainApplication;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link SemiAutomaticAuthorizationUI} class.
    1515 */
    16 public class SemiAutomaticAuthorizationUITest {
     16class SemiAutomaticAuthorizationUITest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testSemiAutomaticAuthorizationUI() {
     29    void testSemiAutomaticAuthorizationUI() {
    3030        assertNotNull(new SemiAutomaticAuthorizationUI("", MainApplication.worker));
    3131    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/PreferencesTestUtils.java

    r16979 r17275  
    22package org.openstreetmap.josm.gui.preferences;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66/**
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/ToolbarPreferencesTest.java

    r10758 r17275  
    1212
    1313import org.junit.Assert;
    14 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.actions.ActionParameter;
    1616import org.openstreetmap.josm.actions.ActionParameter.StringActionParameter;
     
    2222 * Unit tests of {@link ToolbarPreferences} class.
    2323 */
    24 public class ToolbarPreferencesTest {
     24class ToolbarPreferencesTest {
    2525
    2626    private static class TestAction extends AbstractAction implements ParameterizedAction {
     
    5858
    5959    @Test
    60     public void testCase1() {
     60    void testCase1() {
    6161        Map<String, Action> actions = new HashMap<>();
    6262        actions.put("action", new TestAction());
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/AdvancedPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.advanced;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link AdvancedPreference} class.
    1313 */
    14 public class AdvancedPreferenceTest {
     14class AdvancedPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testAdvancedPreference() {
     28    void testAdvancedPreference() {
    2929        assertNotNull(new AdvancedPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new AdvancedPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ExportProfileActionTest.java

    r16159 r17275  
    66import javax.swing.JOptionPane;
    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.Preferences;
     
    1818 * Unit tests of {@link ExportProfileAction} class.
    1919 */
    20 public class ExportProfileActionTest {
     20class ExportProfileActionTest {
    2121    /**
    2222     * Setup tests
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
     
    3030     */
    3131    @Test
    32     public void testAction() {
     32    void testAction() {
    3333        TestUtils.assumeWorkingJMockit();
    3434        new JOptionPaneSimpleMocker(Collections.singletonMap(
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/ListEditorTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.advanced;
    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.util.Arrays;
    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;
    1313import org.openstreetmap.josm.gui.preferences.advanced.ListEditor.ListSettingTableModel;
     
    1616 * Unit tests of {@link ListEditor} class.
    1717 */
    18 public class ListEditorTest {
     18class ListEditorTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @BeforeClass
     23    @BeforeAll
    2424    public static void setUpBeforeClass() {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3030     */
    3131    @Test
    32     public void testListSettingTableModel() {
     32    void testListSettingTableModel() {
    3333        ListSettingTableModel model = new ListSettingTableModel(null);
    3434        assertNotNull(model.getData());
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PrefEntryTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.gui.preferences.advanced;
    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.BeforeClass;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.JOSMFixture;
    1111import org.openstreetmap.josm.TestUtils;
     
    1717 * Unit tests of {@link PrefEntry} class.
    1818 */
    19 public class PrefEntryTest {
     19class PrefEntryTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUpBeforeClass() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3131     */
    3232    @Test
    33     public void testPrefEntry() {
     33    void testPrefEntry() {
    3434        String key = "key";
    3535        StringSetting val = new StringSetting("value");
     
    5555     */
    5656    @Test
    57     public void testEqualsContract() {
     57    void testEqualsContract() {
    5858        TestUtils.assumeWorkingEqualsVerifier();
    5959        EqualsVerifier.forClass(PrefEntry.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/advanced/PreferencesTableTest.java

    r16160 r17275  
    22package org.openstreetmap.josm.gui.preferences.advanced;
    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;
     
    1111import javax.swing.JOptionPane;
    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.gui.ExtendedDialog;
     
    2626 * Unit tests of {@link PreferencesTable} class.
    2727 */
    28 public class PreferencesTableTest {
     28class PreferencesTableTest {
    2929    /**
    3030     * Setup tests
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
     
    4848     */
    4949    @Test
    50     public void testPreferencesTable() {
     50    void testPreferencesTable() {
    5151        TestUtils.assumeWorkingJMockit();
    5252        final JOptionPaneSimpleMocker mocker = new JOptionPaneSimpleMocker();
     
    7575     */
    7676    @Test
    77     public void testAllSettingsTableModel() {
     77    void testAllSettingsTableModel() {
    7878        AllSettingsTableModel model = (AllSettingsTableModel) newTable().getModel();
    7979        assertEquals(1, model.getRowCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/audio/AudioPreferenceTest.java

    r12849 r17275  
    22package org.openstreetmap.josm.gui.preferences.audio;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1313 * Unit tests of {@link AudioPreference} class.
    1414 */
    15 public class AudioPreferenceTest {
     15class AudioPreferenceTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @BeforeClass
     20    @BeforeAll
    2121    public static void setUpBeforeClass() {
    2222        JOSMFixture.createUnitTestFixture().init();
     
    2727     */
    2828    @Test
    29     public void testAudioPreference() {
     29    void testAudioPreference() {
    3030        assertNotNull(new AudioPreference.Factory().createPreferenceSetting());
    3131    }
     
    3535     */
    3636    @Test
    37     public void testAddGui() {
     37    void testAddGui() {
    3838        Config.getPref().putBoolean("audio.menuinvisible", true);
    3939        PreferencesTestUtils.doTestPreferenceSettingAddGui(new AudioPreference.Factory(), null);
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/ColorPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link ColorPreference} class.
    1313 */
    14 public class ColorPreferenceTest {
     14class ColorPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testColorPreference() {
     28    void testColorPreference() {
    2929        assertNotNull(new ColorPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ColorPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DisplayPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link DisplayPreference} class.
    1313 */
    14 public class DisplayPreferenceTest {
     14class DisplayPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testDisplayPreference() {
     28    void testDisplayPreference() {
    2929        assertNotNull(new DisplayPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new DisplayPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/DrawingPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link DrawingPreference} class.
    1313 */
    14 public class DrawingPreferenceTest {
     14class DrawingPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testDrawingPreference() {
     28    void testDrawingPreference() {
    2929        assertNotNull(new DrawingPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new DrawingPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/GPXPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link GPXPreference} class.
    1313 */
    14 public class GPXPreferenceTest {
     14class GPXPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testGPXPreference() {
     28    void testGPXPreference() {
    2929        assertNotNull(new GPXPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new GPXPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/LafPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link LafPreference} class.
    1313 */
    14 public class LafPreferenceTest {
     14class LafPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testLafPreference() {
     28    void testLafPreference() {
    2929        assertNotNull(new LafPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new LafPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/display/LanguagePreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.display;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link LanguagePreference} class.
    1313 */
    14 public class LanguagePreferenceTest {
     14class LanguagePreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testLanguagePreference() {
     28    void testLanguagePreference() {
    2929        assertNotNull(new LanguagePreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new LanguagePreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddTMSLayerPanelTest.java

    r10977 r17275  
    22package org.openstreetmap.josm.gui.preferences.imagery;
    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.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 of {@link AddTMSLayerPanel} class.
    1515 */
    16 public class AddTMSLayerPanelTest {
     16class AddTMSLayerPanelTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testAddTMSLayerPanel() {
     29    void testAddTMSLayerPanel() {
    3030        AddTMSLayerPanel panel = new AddTMSLayerPanel();
    3131        assertEquals("", panel.getImageryInfo().getUrl());
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddWMSLayerPanelTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.preferences.imagery;
    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 * Unit tests of {@link AddWMSLayerPanel} class.
    1414 */
    15 public class AddWMSLayerPanelTest {
     15class AddWMSLayerPanelTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testAddWMSLayerPanel() {
     28    void testAddWMSLayerPanel() {
    2929        AddWMSLayerPanel panel = new AddWMSLayerPanel();
    3030        assertFalse(panel.isImageryValid());
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/AddWMTSLayerPanelTest.java

    r10977 r17275  
    22package org.openstreetmap.josm.gui.preferences.imagery;
    33
    4 import static org.junit.Assert.assertFalse;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertThrows;
    56
    6 import org.junit.Rule;
    7 import org.junit.Test;
     7import org.junit.jupiter.api.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
    89import org.openstreetmap.josm.testutils.JOSMTestRules;
    910
     
    1314 * Unit tests of {@link AddWMTSLayerPanel} class.
    1415 */
    15 public class AddWMTSLayerPanelTest {
     16class AddWMTSLayerPanelTest {
    1617
    1718    /**
    1819     * Setup tests
    1920     */
    20     @Rule
     21    @RegisterExtension
    2122    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2223    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2627     */
    2728    @Test
    28     public void testAddWMTSLayerPanel() {
     29    void testAddWMTSLayerPanel() {
    2930        AddWMTSLayerPanel panel = new AddWMTSLayerPanel();
    3031        assertFalse(panel.isImageryValid());
     
    3435     * Unit test of {@link AddWMTSLayerPanel#getImageryInfo}.
    3536     */
    36     @Test(expected = IllegalArgumentException.class)
    37     public void testGetImageryInfo() {
    38         new AddWMTSLayerPanel().getImageryInfo();
     37    @Test
     38    void testGetImageryInfo() {
     39        assertThrows(IllegalArgumentException.class, () -> new AddWMTSLayerPanel().getImageryInfo());
    3940    }
    4041}
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.preferences.imagery;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.File;
    77import java.util.Arrays;
    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.gui.preferences.PreferencesTestUtils;
     
    1919 * Unit tests of {@link ImageryPreference} class.
    2020 */
    21 public class ImageryPreferenceTest {
     21class ImageryPreferenceTest {
    2222
    2323    /**
    2424     * Setup tests
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().main();
     
    3232     */
    3333    @Test
    34     public void testImageryPreference() {
     34    void testImageryPreference() {
    3535        assertNotNull(new ImageryPreference.Factory().createPreferenceSetting());
    3636    }
     
    4040     */
    4141    @Test
    42     public void testAddGui() {
     42    void testAddGui() {
    4343        String fileUrl = new File(TestUtils.getTestDataRoot()+"__files/imagery/maps.xml").toURI().toString();
    4444        Config.getPref().putList("imagery.layers.sites", Arrays.asList(fileUrl));
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r16824 r17275  
    396396    @ParameterizedTest(name = "{0}")
    397397    @MethodSource("data")
    398     public void testImageryEntryValidity(String id, ImageryInfo info) {
     398    void testImageryEntryValidity(String id, ImageryInfo info) {
    399399        checkEntry(info);
    400400        assertTrue(errors.isEmpty(), format(errors));
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/BackupPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link BackupPreference} class.
    1313 */
    14 public class BackupPreferenceTest {
     14class BackupPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testBackupPreference() {
     28    void testBackupPreference() {
    2929        assertNotNull(new BackupPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new BackupPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link MapPaintPreference} class.
    1313 */
    14 public class MapPaintPreferenceTest {
     14class MapPaintPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testMapPaintPreference() {
     28    void testMapPaintPreference() {
    2929        assertNotNull(new MapPaintPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new MapPaintPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPaintPreferenceTestIT.java

    r15101 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertTrue;
    54import static org.junit.Assume.assumeFalse;
    65import static org.junit.Assume.assumeTrue;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.IOException;
     
    1010import java.util.List;
    1111
    12 import org.junit.BeforeClass;
    1312import org.junit.ClassRule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
    1515import org.junit.runner.RunWith;
    1616import org.junit.runners.Parameterized.Parameters;
     
    3535 */
    3636@RunWith(ParallelParameterized.class)
    37 public class MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
     37class MapPaintPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
    3838
    3939    /**
     
    4848     * @throws IOException in case of I/O error
    4949     */
    50     @BeforeClass
     50    @BeforeAll
    5151    public static void beforeClass() throws IOException {
    5252        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(MapPaintPreferenceTestIT.class));
     
    7070     * @param source source entry to test
    7171     */
    72     public MapPaintPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
     72    MapPaintPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
    7373        super(source);
    7474    }
     
    7979     */
    8080    @Test
    81     public void testStyleValidity() throws Exception {
     81    void testStyleValidity() throws Exception {
    8282        assumeFalse(isIgnoredSubstring(source.url));
    8383        StyleSource style = MapPaintStyles.addStyle(source);
     
    108108        warnings.removeAll(ignoredErrors);
    109109
    110         assertTrue(errors.toString() + '\n' + warnings.toString(), errors.isEmpty() && warnings.isEmpty());
     110        assertTrue(errors.isEmpty() && warnings.isEmpty(), errors.toString() + '\n' + warnings.toString());
    111111        assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty());
    112112    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/MapPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link MapPreference} class.
    1313 */
    14 public class MapPreferenceTest {
     14class MapPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testMapPreference() {
     28    void testMapPreference() {
    2929        assertNotNull(new MapPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new MapPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link TaggingPresetPreference} class.
    1313 */
    14 public class TaggingPresetPreferenceTest {
     14class TaggingPresetPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testTaggingPresetPreference() {
     28    void testTaggingPresetPreference() {
    2929        assertNotNull(new TaggingPresetPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new TaggingPresetPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/map/TaggingPresetPreferenceTestIT.java

    r16768 r17275  
    22package org.openstreetmap.josm.gui.preferences.map;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertTrue;
    64import static org.junit.Assume.assumeFalse;
    75import static org.junit.Assume.assumeTrue;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.io.IOException;
     
    1515import java.util.Set;
    1616
    17 import org.junit.BeforeClass;
    1817import org.junit.ClassRule;
    19 import org.junit.Test;
     18import org.junit.jupiter.api.BeforeAll;
     19import org.junit.jupiter.api.Test;
    2020import org.junit.runner.RunWith;
    2121import org.junit.runners.Parameterized;
     
    4141 */
    4242@RunWith(Parameterized.class)
    43 public class TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
     43class TaggingPresetPreferenceTestIT extends AbstractExtendedSourceEntryTestCase {
    4444
    4545    /**
     
    5454     * @throws IOException in case of I/O error
    5555     */
    56     @BeforeClass
     56    @BeforeAll
    5757    public static void beforeClass() throws IOException {
    5858        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(TaggingPresetPreferenceTestIT.class));
     
    8181     * @param source source entry to test
    8282     */
    83     public TaggingPresetPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
     83    TaggingPresetPreferenceTestIT(String displayName, String url, ExtendedSourceEntry source) {
    8484        super(source);
    8585    }
     
    9090     */
    9191    @Test
    92     public void testPresetsValidity() throws Exception {
     92    void testPresetsValidity() throws Exception {
    9393        assumeFalse(isIgnoredSubstring(source.url));
    9494        Set<String> errors = new HashSet<>();
     
    106106            handleException(e, errors);
    107107        }
    108         assertTrue(errors.toString(), errors.isEmpty());
     108        assertTrue(errors.isEmpty(), errors::toString);
    109109        assumeTrue(ignoredErrors.toString(), ignoredErrors.isEmpty());
    110110    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferenceTest.java

    r16160 r17275  
    22package org.openstreetmap.josm.gui.preferences.plugin;
    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
    77import java.io.File;
     
    1010import java.util.Collections;
    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.gui.preferences.PreferencesTestUtils;
     
    1818import org.openstreetmap.josm.plugins.PluginException;
    1919import org.openstreetmap.josm.plugins.PluginInformation;
     20import org.openstreetmap.josm.testutils.JOSMTestRules;
    2021import org.openstreetmap.josm.testutils.mockers.HelpAwareOptionPaneMocker;
    21 import org.openstreetmap.josm.testutils.JOSMTestRules;
    2222
    2323import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    3030     * Setup test.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences().assertionsInEDT();
     
    3838     */
    3939    @Test
    40     public void testPluginPreference() {
     40    void testPluginPreference() {
    4141        assertNotNull(new PluginPreference.Factory().createPreferenceSetting());
    4242    }
     
    5757     */
    5858    @Test
    59     public void testBuildDownloadSummary() throws Exception {
     59    void testBuildDownloadSummary() throws Exception {
    6060        final PluginInformation dummy = getDummyPluginInformation();
    6161        assertEquals("", PluginPreference.buildDownloadSummary(
     
    8989     */
    9090    @Test
    91     public void testNotifyDownloadResults() {
     91    void testNotifyDownloadResults() {
    9292        final HelpAwareOptionPaneMocker mocker = new HelpAwareOptionPaneMocker();
    9393        mocker.getMockResultMap().put("<html></html>", "OK");  // (buildDownloadSummary() output was empty)
     
    103103     */
    104104    @Test
    105     public void testAddGui() {
     105    void testAddGui() {
    106106        PreferencesTestUtils.doTestPreferenceSettingAddGui(new PluginPreference.Factory(), null);
    107107    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/projection/ProjectionPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.projection;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link ProjectionPreference} class.
    1313 */
    14 public class ProjectionPreferenceTest {
     14class ProjectionPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testProjectionPreference() {
     28    void testProjectionPreference() {
    2929        assertNotNull(new ProjectionPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ProjectionPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/remotecontrol/RemoteControlPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.remotecontrol;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link RemoteControlPreference} class.
    1313 */
    14 public class RemoteControlPreferenceTest {
     14class RemoteControlPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testRemoteControlPreference() {
     28    void testRemoteControlPreference() {
    2929        assertNotNull(new RemoteControlPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new RemoteControlPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ProxyPreferenceTest.java

    r17179 r17275  
    22package org.openstreetmap.josm.gui.preferences.server;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.gui.preferences.PreferencesTestUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link ProxyPreference} class.
    1515 */
    16 public class ProxyPreferenceTest {
     16class ProxyPreferenceTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testProxyPreference() {
     29    void testProxyPreference() {
    3030        assertNotNull(new ProxyPreference.Factory().createPreferenceSetting());
    3131    }
     
    3535     */
    3636    @Test
    37     public void testAddGui() {
     37    void testAddGui() {
    3838        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ProxyPreference.Factory(), null);
    3939    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/server/ServerAccessPreferenceTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.gui.preferences.server;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    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.gui.preferences.PreferencesTestUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link ServerAccessPreference} class.
    1515 */
    16 public class ServerAccessPreferenceTest {
     16class ServerAccessPreferenceTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testServerAccessPreference() {
     29    void testServerAccessPreference() {
    3030        assertNotNull(new ServerAccessPreference.Factory().createPreferenceSetting());
    3131    }
     
    3535     */
    3636    @Test
    37     public void testAddGui() {
     37    void testAddGui() {
    3838        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ServerAccessPreference.Factory(), null);
    3939    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/shortcut/ShortcutPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.shortcut;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link ShortcutPreference} class.
    1313 */
    14 public class ShortcutPreferenceTest {
     14class ShortcutPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testShortcutPreference() {
     28    void testShortcutPreference() {
    2929        assertNotNull(new ShortcutPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ShortcutPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.validator;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link ValidatorPreference} class.
    1313 */
    14 public class ValidatorPreferenceTest {
     14class ValidatorPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testValidatorPreference() {
     28    void testValidatorPreference() {
    2929        assertNotNull(new ValidatorPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ValidatorPreference.Factory(), null);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTagCheckerRulesPreferenceTestIT.java

    r14719 r17275  
    22package org.openstreetmap.josm.gui.preferences.validator;
    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.io.IOException;
     
    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.preferences.sources.ExtendedSourceEntry;
    1414import org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker;
     
    2121 * Integration tests of {@link ValidatorTagCheckerRulesPreference} class.
    2222 */
    23 public class ValidatorTagCheckerRulesPreferenceTestIT {
     23class ValidatorTagCheckerRulesPreferenceTestIT {
    2424
    2525    /**
    2626     * Setup rule
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().https().timeout(20_000);
     
    3535     */
    3636    @Test
    37     public void testValidityOfAvailableRules() throws Exception {
     37    void testValidityOfAvailableRules() throws Exception {
    3838        Collection<ExtendedSourceEntry> sources = new ValidatorTagCheckerRulesPreference.TagCheckerRulesSourceEditor()
    3939                .loadAndGetAvailableSources();
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/validator/ValidatorTestsPreferenceTest.java

    r10378 r17275  
    22package org.openstreetmap.josm.gui.preferences.validator;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99import org.openstreetmap.josm.gui.preferences.PreferencesTestUtils;
     
    1212 * Unit tests of {@link ValidatorTestsPreference} class.
    1313 */
    14 public class ValidatorTestsPreferenceTest {
     14class ValidatorTestsPreferenceTest {
    1515
    1616    /**
    1717     * Setup test.
    1818     */
    19     @BeforeClass
     19    @BeforeAll
    2020    public static void setUpBeforeClass() {
    2121        JOSMFixture.createUnitTestFixture().init();
     
    2626     */
    2727    @Test
    28     public void testValidatorTestsPreference() {
     28    void testValidatorTestsPreference() {
    2929        assertNotNull(new ValidatorTestsPreference.Factory().createPreferenceSetting());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testAddGui() {
     36    void testAddGui() {
    3737        PreferencesTestUtils.doTestPreferenceSettingAddGui(new ValidatorTestsPreference.Factory(), ValidatorPreference.class);
    3838    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/TagEditorModelTest.java

    r9816 r17275  
    22package org.openstreetmap.josm.gui.tagging;
    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 {@link TagEditorModel} class.
    1010 */
    11 public class TagEditorModelTest {
     11class TagEditorModelTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testTagEditorModel() {
     17    void testTagEditorModel() {
    1818        TagEditorModel tem = new TagEditorModel();
    1919        tem.add(null, null);
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/TagModelTest.java

    r9816 r17275  
    22package org.openstreetmap.josm.gui.tagging;
    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;
    88
    99/**
    1010 * Unit tests of {@link TagModel} class.
    1111 */
    12 public class TagModelTest {
     12class TagModelTest {
    1313
    1414    /**
     
    1616     */
    1717    @Test
    18     public void testTagModelSingleValue() {
     18    void testTagModelSingleValue() {
    1919        TagModel tm = new TagModel();
    2020        assertEquals("", tm.getName());
     
    4343     */
    4444    @Test
    45     public void testTagModelMultipleValues() {
     45    void testTagModelMultipleValues() {
    4646        TagModel tm = new TagModel("key2", "val2");
    4747        assertEquals("key2", tm.getName());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManagerTest.java

    r14503 r17275  
    22package org.openstreetmap.josm.gui.tagging.ac;
    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.DataSet;
     
    1717 * Unit tests of {@link AutoCompletionManager} class.
    1818 */
    19 public class AutoCompletionManagerTest {
     19class AutoCompletionManagerTest {
    2020
    2121    /**
    2222     * Setup rule
    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 testTicket17064() {
     32    void testTicket17064() {
    3333        DataSet ds = new DataSet();
    3434        OsmDataLayer layer = new OsmDataLayer(ds, "testTicket17064", null);
     
    4242     */
    4343    @Test
    44     public void testEqualsContract() {
     44    void testEqualsContract() {
    4545        TestUtils.assumeWorkingEqualsVerifier();
    4646        EqualsVerifier.forClass(UserInputTag.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/PresetClassificationsTest.java

    r10638 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets;
    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.io.IOException;
     
    1212import java.util.stream.Collectors;
    1313
    14 import org.junit.BeforeClass;
    15 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeAll;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.JOSMFixture;
    1717import org.openstreetmap.josm.data.osm.Node;
     
    2626 * Unit tests of {@link PresetClassifications} class.
    2727 */
    28 public class PresetClassificationsTest {
     28class PresetClassificationsTest {
    2929
    3030    static final PresetClassifications classifications = new PresetClassifications();
     
    3535     * @throws IOException if any I/O error occurs
    3636     */
    37     @BeforeClass
     37    @BeforeAll
    3838    public static void setUp() throws IOException, SAXException {
    3939        JOSMFixture.createUnitTestFixture().init();
     
    5555     */
    5656    @Test
    57     public void testBuilding() {
     57    void testBuilding() {
    5858        final Way w = new Way();
    5959        final Node n1 = new Node();
     
    6161        w.addNode(new Node());
    6262        w.addNode(new Node());
    63         assertFalse("unclosed way should not match building preset", getMatchingPresetNames("building", w).contains("Building"));
     63        assertFalse(getMatchingPresetNames("building", w).contains("Building"), "unclosed way should not match building preset");
    6464        w.addNode(n1);
    65         assertTrue("closed way should match building preset", getMatchingPresetNames("building", w).contains("Building"));
     65        assertTrue(getMatchingPresetNames("building", w).contains("Building"), "closed way should match building preset");
    6666    }
    6767
     
    7070     */
    7171    @Test
    72     public void testRelationsForTram() {
     72    void testRelationsForTram() {
    7373        final OsmPrimitive tram = OsmUtils.createPrimitive("way railway=tram");
    74         assertTrue("railway=tram should match 'Railway Route' for relation creation", getMatchingPresetNames("route", tram)
    75                 .contains("Railway Route"));
    76         assertTrue("railway=tram should match 'Public Transport Route (Rail)' for relation creation", getMatchingPresetNames("route", tram)
    77                 .contains("Public Transport Route (Rail)"));
    78         assertFalse("railway=tram should not match 'Bus'", getMatchingPresetNames("route", tram).toString().contains("Bus"));
     74        assertTrue(getMatchingPresetNames("route", tram).contains("Railway Route"),
     75                "railway=tram should match 'Railway Route' for relation creation");
     76        assertTrue(getMatchingPresetNames("route", tram).contains("Public Transport Route (Rail)"),
     77                "railway=tram should match 'Public Transport Route (Rail)' for relation creation");
     78        assertFalse(getMatchingPresetNames("route", tram).toString().contains("Bus"),
     79                "railway=tram should not match 'Bus'");
    7980    }
    8081}
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReaderTest.java

    r16618 r17275  
    44import static org.CustomMatchers.hasSize;
    55import static org.hamcrest.MatcherAssert.assertThat;
    6 import static org.junit.Assert.assertEquals;
    7 import static org.junit.Assert.assertTrue;
    8 import static org.junit.Assert.fail;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
    99
    1010import java.io.IOException;
     
    1414
    1515import org.junit.Assert;
    16 import org.junit.Rule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.Test;
     17import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.gui.tagging.presets.items.Check;
     
    2727 * Unit tests of {@link TaggingPresetReader} class.
    2828 */
    29 public class TaggingPresetReaderTest {
     29class TaggingPresetReaderTest {
    3030
    3131    /**
    3232     * Setup rule
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules test = new JOSMTestRules();
     
    4242     */
    4343    @Test
    44     public void testTicket8954() throws SAXException, IOException {
     44    void testTicket8954() throws SAXException, IOException {
    4545        String presetfile = TestUtils.getRegressionDataFile(8954, "preset.xml");
    4646        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, false);
     
    5858     */
    5959    @Test
    60     public void testNestedChunks() throws SAXException, IOException {
     60    void testNestedChunks() throws SAXException, IOException {
    6161        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_chunk.xml", true);
    6262        assertThat(presets, hasSize(1));
     
    7070     * Test external entity resolving.
    7171     * See #19286
     72     * @throws IOException in case of I/O error
    7273     */
    7374    @Test
    74     public void testExternalEntityResolving() throws IOException {
     75    void testExternalEntityResolving() throws IOException {
    7576        try {
    7677            TaggingPresetReader.readAll(TestUtils.getTestDataRoot() + "preset_external_entity.xml", true);
     
    8990     */
    9091    @Test
    91     public void testReadDefaulPresets() throws SAXException, IOException {
     92    void testReadDefaulPresets() throws SAXException, IOException {
    9293        String presetfile = "resource://data/defaultpresets.xml";
    9394        final Collection<TaggingPreset> presets = TaggingPresetReader.readAll(presetfile, true);
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetSelectorTest.java

    r13836 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets;
    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.Rule;
    8 import org.junit.Test;
     7import org.junit.jupiter.api.extension.RegisterExtension;
     8import org.junit.jupiter.api.Test;
    99import org.openstreetmap.josm.gui.tagging.presets.TaggingPresetSelector.PresetClassification;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1515 * Unit tests of {@link TaggingPresetSelector} class.
    1616 */
    17 public class TaggingPresetSelectorTest {
     17class TaggingPresetSelectorTest {
    1818
    1919    /**
    2020     * Setup rule
    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 testIsMatching() {
     30    void testIsMatching() {
    3131        TaggingPreset preset = new TaggingPreset();
    3232        preset.name = "estação de bombeiros"; // fire_station in brazilian portuguese
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetsTest.java

    r16768 r17275  
    88import java.util.concurrent.TimeoutException;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
    1212import org.openstreetmap.josm.testutils.JOSMTestRules;
    1313import org.openstreetmap.josm.tools.Logging;
     
    2424     * Setup rule
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules();
     
    3333     */
    3434    @Test
    35     public void testUtilityClass() throws ReflectiveOperationException {
     35    void testUtilityClass() throws ReflectiveOperationException {
    3636        UtilityClassTestUtil.assertUtilityClassWellDefined(TaggingPresets.class);
    3737    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckGroupTest.java

    r16042 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1818 * Unit tests of {@link CheckGroup} class.
    1919 */
    20 public class CheckGroupTest {
     20class CheckGroupTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @BeforeClass
     25    @BeforeAll
    2626    public static void setUp() {
    2727        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        CheckGroup cg = new CheckGroup();
    3636        JPanel p = new JPanel();
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/CheckTest.java

    r16282 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    99import javax.swing.JPanel;
    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.OsmPrimitive;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1919 * Unit tests of {@link Check} class.
    2020 */
    21 public class CheckTest {
     21class CheckTest {
    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().main();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ComboTest.java

    r16693 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.JPanel;
    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.OsmPrimitive;
    1616import org.openstreetmap.josm.data.osm.OsmUtils;
     
    2222 * Unit tests of {@link Combo} class.
    2323 */
    24 public class ComboTest {
     24class ComboTest {
    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().main().i18n("de");
     
    3535     */
    3636    @Test
    37     public void testAddToPanel() {
     37    void testAddToPanel() {
    3838        JPanel p = new JPanel();
    3939        assertEquals(0, p.getComponentCount());
     
    4646     */
    4747    @Test
    48     public void testUseLastAsDefault() {
     48    void testUseLastAsDefault() {
    4949        Combo combo = new Combo();
    5050        combo.key = "addr:country";
     
    8383
    8484    @Test
    85     public void testColor() {
     85    void testColor() {
    8686        Combo combo = new Combo();
    8787        combo.key = "colour";
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/ItemSeparatorTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1818 * Unit tests of {@link ItemSeparator} class.
    1919 */
    20 public class ItemSeparatorTest {
     20class ItemSeparatorTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @BeforeClass
     25    @BeforeAll
    2626    public static void setUp() {
    2727        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/KeyTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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
    77import java.util.Collections;
     
    99import javax.swing.JPanel;
    1010
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1717 * Unit tests of {@link Key} class.
    1818 */
    19 public class KeyTest {
     19class KeyTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUp() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3131     */
    3232    @Test
    33     public void testAddToPanel() {
     33    void testAddToPanel() {
    3434        JPanel p = new JPanel();
    3535        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LabelTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    99import javax.swing.JPanel;
    1010
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1717 * Unit tests of {@link Label} class.
    1818 */
    19 public class LabelTest {
     19class LabelTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUp() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3131     */
    3232    @Test
    33     public void testAddToPanel() {
     33    void testAddToPanel() {
    3434        JPanel p = new JPanel();
    3535        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/LinkTest.java

    r14119 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1919 * Unit tests of {@link Link} class.
    2020 */
    21 public class LinkTest {
     21class LinkTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @BeforeClass
     26    @BeforeAll
    2727    public static void setUp() {
    2828        JOSMFixture.createUnitTestFixture().init();
     
    3333     */
    3434    @Test
    35     public void testAddToPanel() {
     35    void testAddToPanel() {
    3636        Link l = new Link();
    3737        JPanel p = new JPanel();
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/MultiSelectTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    99import javax.swing.JPanel;
    1010
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.JOSMFixture;
    1414import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1717 * Unit tests of {@link MultiSelect} class.
    1818 */
    19 public class MultiSelectTest {
     19class MultiSelectTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUp() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3131     */
    3232    @Test
    33     public void testAddToPanel() {
     33    void testAddToPanel() {
    3434        JPanel p = new JPanel();
    3535        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/OptionalTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1818 * Unit tests of {@link Optional} class.
    1919 */
    20 public class OptionalTest {
     20class OptionalTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @BeforeClass
     25    @BeforeAll
    2626    public static void setUp() {
    2727        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetLinkTest.java

    r12568 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    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.data.osm.OsmPrimitive;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2020 * Unit tests of {@link PresetLink} class.
    2121 */
    22 public class PresetLinkTest {
     22class PresetLinkTest {
    2323
    2424    /**
    2525     * Setup test.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules rule = new JOSMTestRules().presets();
     
    3333     */
    3434    @Test
    35     public void testAddToPanel() {
     35    void testAddToPanel() {
    3636        PresetLink l = new PresetLink();
    3737        l.preset_name = "River";
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntryTest.java

    r16690 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.BeforeClass;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.BeforeAll;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.JOSMFixture;
    99
     
    1111 * Unit tests of {@link PresetListEntry} class.
    1212 */
    13 public class PresetListEntryTest {
     13class PresetListEntryTest {
    1414
    1515    /**
    1616     * Setup test.
    1717     */
    18     @BeforeClass
     18    @BeforeAll
    1919    public static void setUp() {
    2020        JOSMFixture.createUnitTestFixture().init();
     
    2525     */
    2626    @Test
    27     public void testTicket12416() {
     27    void testTicket12416() {
    2828        assertEquals("&nbsp;", new PresetListEntry("").getListDisplay());
    2929    }
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/RolesTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1818 * Unit tests of {@link Roles} class.
    1919 */
    20 public class RolesTest {
     20class RolesTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @BeforeClass
     25    @BeforeAll
    2626    public static void setUp() {
    2727        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/SpaceTest.java

    r9996 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    1818 * Unit tests of {@link Space} class.
    1919 */
    20 public class SpaceTest {
     20class SpaceTest {
    2121
    2222    /**
    2323     * Setup test.
    2424     */
    25     @BeforeClass
     25    @BeforeAll
    2626    public static void setUp() {
    2727        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/tagging/presets/items/TextTest.java

    r16282 r17275  
    22package org.openstreetmap.josm.gui.tagging.presets.items;
    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.Collections;
     
    99import javax.swing.JPanel;
    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.OsmPrimitive;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1919 * Unit tests of {@link Text} class.
    2020 */
    21 public class TextTest {
     21class TextTest {
    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().main();
     
    3232     */
    3333    @Test
    34     public void testAddToPanel() {
     34    void testAddToPanel() {
    3535        JPanel p = new JPanel();
    3636        assertEquals(0, p.getComponentCount());
  • trunk/test/unit/org/openstreetmap/josm/gui/util/FileFilterAllFilesTest.java

    r11202 r17275  
    22package org.openstreetmap.josm.gui.util;
    33
    4 import static org.junit.Assert.assertNotNull;
    5 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    66
    77import java.io.File;
    88
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    1010
    1111/**
    1212 * Unit tests of {@link FileFilterAllFiles} class.
    1313 */
    14 public class FileFilterAllFilesTest {
     14class FileFilterAllFilesTest {
    1515
    1616    /**
     
    1818     */
    1919    @Test
    20     public void testFileFilterAllFiles() {
     20    void testFileFilterAllFiles() {
    2121        assertTrue(FileFilterAllFiles.getInstance().accept(new File(".")));
    2222        assertNotNull(FileFilterAllFiles.getInstance().getDescription());
  • trunk/test/unit/org/openstreetmap/josm/gui/util/MultiLineFlowLayoutTest.java

    r16034 r17275  
    22package org.openstreetmap.josm.gui.util;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.awt.Dimension;
     
    1010import javax.swing.JPanel;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
    1616
     
    2121 * @author Michael Zangl
    2222 */
    23 public class MultiLineFlowLayoutTest {
     23class MultiLineFlowLayoutTest {
    2424    /**
    2525     * No special rules.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    3535     * Prepare test container.
    3636     */
    37     @Before
     37    @BeforeEach
    3838    public void setUp() {
    3939        JPanel parent = new JPanel();
     
    4848     */
    4949    @Test
    50     public void testOneLine() {
     50    void testOneLine() {
    5151        fillOneLine();
    5252
     
    6565     */
    6666    @Test
    67     public void testInsets() {
     67    void testInsets() {
    6868        fillOneLine();
    6969
     
    8686     */
    8787    @Test
    88     public void testGaps() {
     88    void testGaps() {
    8989        fillOneLine();
    9090
     
    100100     */
    101101    @Test
    102     public void testSameAsFlowLayout() {
     102    void testSameAsFlowLayout() {
    103103        fillOneLine();
    104104        JPanel childx = new JPanel();
  • trunk/test/unit/org/openstreetmap/josm/gui/util/WindowGeometryTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.gui.util;
    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;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.awt.Dimension;
     
    1415import javax.swing.JPanel;
    1516
    16 import org.junit.Rule;
    17 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1819import org.openstreetmap.josm.TestUtils;
    1920import org.openstreetmap.josm.gui.util.WindowGeometry.WindowGeometryException;
     
    2829 * Unit tests of {@link WindowGeometry} class.
    2930 */
    30 public class WindowGeometryTest {
     31class WindowGeometryTest {
    3132    /**
    3233     * Some of this depends on preferences.
    3334     */
    34     @Rule
     35    @RegisterExtension
    3536    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3637    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    4041     */
    4142    @Test
    42     public void testCenterInWindow() {
     43    void testCenterInWindow() {
    4344        assertNotNull(WindowGeometry.centerInWindow(null, null));
    4445        assertNotNull(WindowGeometry.centerInWindow(new JPanel(), null));
     
    4950     */
    5051    @Test
    51     public void testCenterOnScreen() {
     52    void testCenterOnScreen() {
    5253        Dimension dim = new Dimension(200, 100);
    5354        assertEquals(new WindowGeometry(new Point(0, 0), dim), WindowGeometry.centerOnScreen(dim));
     
    6061    /**
    6162     * Test of {@link WindowGeometry.WindowGeometryException} class.
    62      * @throws WindowGeometryException always
    6363     */
    64     @Test(expected = WindowGeometryException.class)
    65     public void testWindowGeometryException1() throws WindowGeometryException {
     64    @Test
     65    void testWindowGeometryException1() {
    6666        Config.getPref().put("test", null);
    67         new WindowGeometry("test");
     67        assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test"));
    6868    }
    6969
    7070    /**
    7171     * Test of {@link WindowGeometry.WindowGeometryException} class.
    72      * @throws WindowGeometryException always
    7372     */
    74     @Test(expected = WindowGeometryException.class)
    75     public void testWindowGeometryException2() throws WindowGeometryException {
     73    @Test
     74    void testWindowGeometryException2() {
    7675        Config.getPref().put("test", "");
    77         new WindowGeometry("test");
     76        assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test"));
    7877    }
    7978
    8079    /**
    8180     * Test of {@link WindowGeometry.WindowGeometryException} class.
    82      * @throws WindowGeometryException always
    8381     */
    84     @Test(expected = WindowGeometryException.class)
    85     public void testWindowGeometryException3() throws WindowGeometryException {
     82    @Test
     83    void testWindowGeometryException3() {
    8684        Config.getPref().put("test", "x=not_a_number");
    87         new WindowGeometry("test");
     85        assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test"));
    8886    }
    8987
    9088    /**
    9189     * Test of {@link WindowGeometry.WindowGeometryException} class.
    92      * @throws WindowGeometryException always
    9390     */
    94     @Test(expected = WindowGeometryException.class)
    95     public void testWindowGeometryException4() throws WindowGeometryException {
     91    @Test
     92    void testWindowGeometryException4() {
    9693        Config.getPref().put("test", "wrong_pattern");
    97         new WindowGeometry("test");
     94        assertThrows(WindowGeometryException.class, () -> new WindowGeometry("test"));
    9895    }
    9996
     
    103100     */
    104101    @Test
    105     public void testWindowGeometryException5() throws WindowGeometryException {
     102    void testWindowGeometryException5() throws WindowGeometryException {
    106103        Config.getPref().put("test", "x=15,y=55,width=200,height=100");
    107104        assertNotNull(new WindowGeometry("test"));
     
    112109     */
    113110    @Test
    114     public void testIsBugInMaximumWindowBounds() {
     111    void testIsBugInMaximumWindowBounds() {
    115112        assertFalse(WindowGeometry.isBugInMaximumWindowBounds(new Rectangle(10, 10)));
    116113        assertTrue(WindowGeometry.isBugInMaximumWindowBounds(new Rectangle(10, 0)));
     
    122119     */
    123120    @Test
    124     public void testGetVirtualScreenBounds() {
     121    void testGetVirtualScreenBounds() {
    125122        assertNotNull(WindowGeometry.getVirtualScreenBounds());
    126123    }
     
    130127     */
    131128    @Test
    132     public void testGetMaxDimensionOnScreen() {
     129    void testGetMaxDimensionOnScreen() {
    133130        assertNotNull(WindowGeometry.getMaxDimensionOnScreen(new JLabel()));
    134131    }
     
    138135     */
    139136    @Test
    140     public void testToString() {
     137    void testToString() {
    141138        assertEquals("WindowGeometry{topLeft=java.awt.Point[x=0,y=0],extent=java.awt.Dimension[width=0,height=0]}",
    142139                new WindowGeometry(new Rectangle()).toString());
     
    147144     */
    148145    @Test
    149     public void testEqualsContract() {
     146    void testEqualsContract() {
    150147        TestUtils.assumeWorkingEqualsVerifier();
    151148        EqualsVerifier.forClass(WindowGeometry.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/gui/widgets/AutoAdjustingSplitPaneTest.java

    r11772 r17275  
    22package org.openstreetmap.josm.gui.widgets;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.beans.PropertyChangeEvent;
     
    88import javax.swing.JSplitPane;
    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 of {@link AutoAdjustingSplitPane} class.
    1818 */
    19 public class AutoAdjustingSplitPaneTest {
     19class AutoAdjustingSplitPaneTest {
    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 testAutoAdjustingSplitPane() {
     32    void testAutoAdjustingSplitPane() {
    3333        AutoAdjustingSplitPane pane = new AutoAdjustingSplitPane(JSplitPane.VERTICAL_SPLIT);
    3434        assertEquals(-1, pane.getDividerLocation());
  • trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java

    r17212 r17275  
    22package org.openstreetmap.josm.io;
    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;
     
    1111import java.util.Collections;
    1212
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.xml.sax.InputSource;
     
    1818 * Unit tests of {@link Capabilities} class.
    1919 */
    20 public class CapabilitiesTest {
     20class CapabilitiesTest {
    2121
    2222    /**
     
    2626     */
    2727    @Test
    28     public void testCapabilities() throws Exception {
     28    void testCapabilities() throws Exception {
    2929        final Path path = Paths.get(TestUtils.getTestDataRoot(), "__files/api/0.6/capabilities");
    3030        final Capabilities capabilities;
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.io;
    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 of {@link CertificateAmendment} class.
    1313 */
    14 public class CertificateAmendmentTest {
     14class CertificateAmendmentTest {
    1515
    1616    /**
    1717     * Setup rule
    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(CertificateAmendment.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java

    r15509 r17275  
    1313
    1414import org.junit.Assert;
    15 import org.junit.BeforeClass;
    1615import org.junit.ClassRule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.BeforeAll;
     17import org.junit.jupiter.api.Test;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2424 * Integration tests of {@link CertificateAmendment} class.
    2525 */
    26 public class CertificateAmendmentTestIT {
     26class CertificateAmendmentTestIT {
    2727
    2828    /**
     
    3939     * @throws IOException in case of I/O error
    4040     */
    41     @BeforeClass
     41    @BeforeAll
    4242    public static void beforeClass() throws IOException {
    4343        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(CertificateAmendmentTestIT.class));
     
    4949     */
    5050    @Test
    51     public void testDefault() throws IOException {
     51    void testDefault() throws IOException {
    5252        // something that is not embedded
    5353        connect("https://www.bing.com", true);
     
    5959     */
    6060    @Test
    61     public void testLetsEncrypt() throws IOException {
     61    void testLetsEncrypt() throws IOException {
    6262        // signed by letsencrypt's own ISRG root
    6363        connect("https://valid-isrgrootx1.letsencrypt.org", true);
     
    7373     */
    7474    @Test
    75     public void testOverpass() throws IOException {
     75    void testOverpass() throws IOException {
    7676        connect("https://overpass-api.de", true);
    7777    }
     
    8282     */
    8383    @Test
    84     public void testDutchGovernment() throws IOException {
     84    void testDutchGovernment() throws IOException {
    8585        connect("https://geodata.nationaalgeoregister.nl", true);
    8686    }
     
    9191     */
    9292    @Test
    93     public void testTaiwanGovernment() throws IOException {
     93    void testTaiwanGovernment() throws IOException {
    9494        connect("https://grca.nat.gov.tw", true);
    9595    }
  • trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.java

    r14068 r17275  
    22package org.openstreetmap.josm.io;
    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;
    8 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.assertTrue;
     8import static org.junit.jupiter.api.Assertions.fail;
    99
    1010import java.time.OffsetDateTime;
     
    1212import java.util.Arrays;
    1313
    14 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException;
    1616import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlParser;
     
    2020 * Unit tests of {@link ChangesetQueryUrlParser} class
    2121 */
    22 public class ChangesetQueryUrlParserTest {
     22class ChangesetQueryUrlParserTest {
    2323
    2424    /**
     
    2727     */
    2828    @Test
    29     public void testParseBasic() throws ChangesetQueryUrlException {
     29    void testParseBasic() throws ChangesetQueryUrlException {
    3030        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    3131
     
    5656     */
    5757    @Test
    58     public void testUid() throws ChangesetQueryUrlException {
     58    void testUid() throws ChangesetQueryUrlException {
    5959        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    6060        ChangesetQuery q;
     
    7474     */
    7575    @Test
    76     public void testDisplayName() throws ChangesetQueryUrlException {
     76    void testDisplayName() throws ChangesetQueryUrlException {
    7777        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    7878        ChangesetQuery q;
     
    8989     */
    9090    @Test
    91     public void testOpen() throws ChangesetQueryUrlException {
     91    void testOpen() throws ChangesetQueryUrlException {
    9292        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    9393        ChangesetQuery q;
     
    112112     */
    113113    @Test
    114     public void testClosed() throws ChangesetQueryUrlException {
     114    void testClosed() throws ChangesetQueryUrlException {
    115115        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    116116        ChangesetQuery q;
     
    134134     */
    135135    @Test
    136     public void testUidAndDisplayName() {
     136    void testUidAndDisplayName() {
    137137        shouldFail("uid=1&display_name=abcd");
    138138    }
     
    143143     */
    144144    @Test
    145     public void testTime() throws ChangesetQueryUrlException {
     145    void testTime() throws ChangesetQueryUrlException {
    146146        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    147147        ChangesetQuery q;
     
    169169     */
    170170    @Test
    171     public void testBbox() throws ChangesetQueryUrlException {
     171    void testBbox() throws ChangesetQueryUrlException {
    172172        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    173173        ChangesetQuery q;
     
    191191     */
    192192    @Test
    193     public void testChangesetIds() throws ChangesetQueryUrlException {
     193    void testChangesetIds() throws ChangesetQueryUrlException {
    194194        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    195195        ChangesetQuery q;
  • trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.java

    r14046 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.util.Arrays;
     
    1010import java.util.Set;
    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.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.osm.Changeset;
     
    3131 * Unit tests of {@link DiffResultProcessor}
    3232 */
    33 public class DiffResultProcessorTest {
     33class DiffResultProcessorTest {
    3434
    3535    /**
    3636     * Setup rule
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules();
     
    5353     */
    5454    @Test
    55     public void testConstructor() {
     55    void testConstructor() {
    5656        Node n = new Node(1);
    5757        // these calls should not fail
     
    6666     */
    6767    @Test
    68     public void testParse_NOK_Cases() {
     68    void testParse_NOK_Cases() {
    6969        shouldFail(null);
    7070        shouldFail("");
     
    7777     */
    7878    @Test
    79     public void testParse_OK_Cases() throws XmlParsingException {
     79    void testParse_OK_Cases() throws XmlParsingException {
    8080        DiffResultProcessor processor = new DiffResultProcessor(null);
    8181        String doc =
     
    112112     */
    113113    @Test
    114     public void testPostProcess_Invocation_Variants() throws XmlParsingException {
     114    void testPostProcess_Invocation_Variants() throws XmlParsingException {
    115115        DiffResultProcessor processor = new DiffResultProcessor(null);
    116116        String doc =
     
    136136     */
    137137    @Test
    138     public void testPostProcess_OK() throws XmlParsingException {
     138    void testPostProcess_OK() throws XmlParsingException {
    139139
    140140        Node n = new Node();
     
    171171     */
    172172    @Test
    173     public void testPostProcess_ForCreatedElement() throws XmlParsingException {
     173    void testPostProcess_ForCreatedElement() throws XmlParsingException {
    174174
    175175        Node n = new Node();
     
    193193     */
    194194    @Test
    195     public void testPostProcess_ForModifiedElement() throws XmlParsingException {
     195    void testPostProcess_ForModifiedElement() throws XmlParsingException {
    196196
    197197        Node n = new Node(1);
     
    218218     */
    219219    @Test
    220     public void testPostProcess_ForDeletedElement() throws XmlParsingException {
     220    void testPostProcess_ForDeletedElement() throws XmlParsingException {
    221221
    222222        Node n = new Node(1);
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java

    r17185 r17275  
    22package org.openstreetmap.josm.io;
    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.junit.jupiter.api.Assertions.assertThrows;
    99
     
    1919import java.util.stream.IntStream;
    2020
    21 import org.junit.Rule;
    22 import org.junit.Test;
     21import org.junit.jupiter.api.extension.RegisterExtension;
     22import org.junit.jupiter.api.Test;
    2323import org.openstreetmap.josm.TestUtils;
    2424import org.openstreetmap.josm.data.coor.LatLon;
     
    3232 * Unit tests of {@link GeoJSONReader}.
    3333 */
    34 public class GeoJSONReaderTest {
     34class GeoJSONReaderTest {
    3535
    3636    /**
    3737     * Setup test.
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    public JOSMTestRules rules = new JOSMTestRules();
    4141
     
    4545     */
    4646    @Test
    47     public void testReadGeoJson() throws Exception {
     47    void testReadGeoJson() throws Exception {
    4848        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geo.json"))) {
    4949            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    6060     */
    6161    @Test
    62     public void testReadLineByLineGeoJSON() throws Exception {
     62    void testReadLineByLineGeoJSON() throws Exception {
    6363        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geoLineByLine.json"))) {
    6464            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    150150     */
    151151    @Test
    152     public void testReadGeoJsonNamedCrs() throws Exception {
     152    void testReadGeoJsonNamedCrs() throws Exception {
    153153        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geocrs.json"))) {
    154154            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    165165     */
    166166    @Test
    167     public void testReadGeoJsonWithoutType() {
     167    void testReadGeoJsonWithoutType() {
    168168        assertThrows(IllegalDataException.class, () ->
    169169                new GeoJSONReader().doParseDataSet(new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)), null));
     
    193193     */
    194194    @Test
    195     public void testTicket19822() throws Exception {
     195    void testTicket19822() throws Exception {
    196196        try (InputStream in = TestUtils.getRegressionDataStream(19822, "data.geojson")) {
    197197            final List<OsmPrimitive> primitives = new ArrayList<>(
     
    207207     */
    208208    @Test
    209     public void testTicket19822Nested() throws Exception {
     209    void testTicket19822Nested() throws Exception {
    210210        try (InputStream in = TestUtils.getRegressionDataStream(19822, "problem3.geojson")) {
    211211            final List<OsmPrimitive> primitives = new ArrayList<>(
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java

    r16936 r17275  
    22package org.openstreetmap.josm.io;
    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;
     
    1010import java.util.Arrays;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.TestUtils;
     
    2222 * Unit tests of {@link GeoJSONWriter} class.
    2323 */
    24 public class GeoJSONWriterTest {
     24class GeoJSONWriterTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @BeforeClass
     29    @BeforeAll
    3030    public static void setUp() {
    3131        JOSMFixture.createUnitTestFixture().init();
     
    3636     */
    3737    @Test
    38     public void testPoint() {
     38    void testPoint() {
    3939        final Node node = new Node(new LatLon(12.3, 4.56));
    4040        node.put("name", "foo");
     
    7575     */
    7676    @Test
    77     public void testLineString() {
     77    void testLineString() {
    7878        final DataSet ds = new DataSet();
    7979        final Node n1 = new Node(new LatLon(12.3, 4.56));
     
    119119     */
    120120    @Test
    121     public void testMultipolygon() throws Exception {
     121    void testMultipolygon() throws Exception {
    122122        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) {
    123123            DataSet ds = OsmReader.parseDataSet(in, null);
     
    132132     */
    133133    @Test
    134     public void testMultipolygonRobustness() throws Exception {
     134    void testMultipolygonRobustness() throws Exception {
    135135        try (InputStream in = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm"))) {
    136136            DataSet ds = OsmReader.parseDataSet(in, null);
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io;
    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;
     6import static org.junit.jupiter.api.Assertions.assertThrows;
    67
    78import java.io.ByteArrayInputStream;
     
    1415import java.util.Map;
    1516
    16 import org.junit.Rule;
    17 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1819import org.openstreetmap.josm.TestUtils;
    1920import org.openstreetmap.josm.data.Bounds;
     
    3435     * Setup rule
    3536     */
    36     @Rule
     37    @RegisterExtension
    3738    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3839    public JOSMTestRules test = new JOSMTestRules();
     
    6061     */
    6162    @Test
    62     public void testMunich() throws Exception {
     63    void testMunich() throws Exception {
    6364        final GpxData result = parseGpxData("nodist/data/munich.gpx");
    6465        assertEquals(2762, result.getTracks().size());
     
    7677     */
    7778    @Test
    78     public void testLayerPrefs() throws Exception {
     79    void testLayerPrefs() throws Exception {
    7980        final GpxData data = parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks-layerprefs.gpx");
    8081        Map<String, String> e = new HashMap<>();
     
    9394     * @throws Exception always SAXException
    9495     */
    95     @Test(expected = SAXException.class)
    96     public void testException() throws Exception {
    97         new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true);
     96    @Test
     97    void testException() throws Exception {
     98        assertThrows(SAXException.class,
     99                () -> new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true));
    98100    }
    99101
     
    104106     */
    105107    @Test
    106     public void testTicket15634() throws IOException, SAXException {
     108    void testTicket15634() throws IOException, SAXException {
    107109        assertEquals(new Bounds(53.7229357, -7.9135019, 53.9301103, -7.59656),
    108110                GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(15634, "drumlish.gpx")).getMetaBounds());
  • trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java

    r17149 r17275  
    1515import java.util.function.Consumer;
    1616
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    3737     * Setup rule
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules();
     
    6868     */
    6969    @Test
    70     public void testTicket16550() throws IOException {
     70    void testTicket16550() throws IOException {
    7171        // Checks that time stored as date is correctly written into XML timestamp
    7272        testSingleWaypoint(
     
    8080     */
    8181    @Test
    82     public void testTicket16725() throws IOException {
     82    void testTicket16725() throws IOException {
    8383        // Checks that sat, hdop, pdop, vdop are correctly exported
    8484        testSingleWaypoint(
     
    100100     */
    101101    @Test
    102     public void testExtensions() throws IOException {
     102    void testExtensions() throws IOException {
    103103        GpxData data = new GpxData();
    104104        // only namespace, no location printed
  • trunk/test/unit/org/openstreetmap/josm/io/MultiFetchOverpassObjectReaderTest.java

    r16612 r17275  
    22package org.openstreetmap.josm.io;
    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.data.osm.Node;
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2020 * Unit tests of {@link MultiFetchOverpassObjectReader}.
    2121 */
    22 public class MultiFetchOverpassObjectReaderTest {
     22class MultiFetchOverpassObjectReaderTest {
    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().preferences();
     
    3333     */
    3434    @Test
    35     public void testBuildRequestNodesString() {
     35    void testBuildRequestNodesString() {
    3636        List<OsmPrimitive> objects = Arrays.asList(new Node(123), new Node(126), new Node(130));
    3737        String requestString;
     
    6161     */
    6262    @Test
    63     public void testBuildRequestWaysString() {
     63    void testBuildRequestWaysString() {
    6464        List<OsmPrimitive> objects = Arrays.asList(new Way(123), new Way(126), new Way(130));
    6565        String requestString;
     
    8686     */
    8787    @Test
    88     public void testBuildRequestRelationsString() {
     88    void testBuildRequestRelationsString() {
    8989        List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130));
    9090        String requestString;
     
    112112     */
    113113    @Test
    114     public void testBuildComplexString() {
     114    void testBuildComplexString() {
    115115        List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130), new Way(88), new Way(99),
    116116                new Node(1));
  • trunk/test/unit/org/openstreetmap/josm/io/NameFinderTest.java

    r14015 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.StringReader;
     
    88import java.util.stream.Collectors;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111
    1212/**
    1313 * Unit tests of {@link NameFinder} class.
    1414 */
    15 public class NameFinderTest {
     15class NameFinderTest {
    1616
    1717    // CHECKSTYLE.OFF: LineLength
     
    4141     */
    4242    @Test
    43     public void testParseSearchResults() throws Exception {
     43    void testParseSearchResults() throws Exception {
    4444        try (StringReader reader = new StringReader(SAMPLE)) {
    4545            assertEquals(Arrays.asList(
  • trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java

    r16426 r17275  
    22package org.openstreetmap.josm.io;
    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.net.MalformedURLException;
     
    1010import java.util.Map;
    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.JOSMTestRules;
    1515
     
    1919 * Unit tests of {@link NetworkManager} class.
    2020 */
    21 public class NetworkManagerTest {
     21class NetworkManagerTest {
    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().https().devAPI().main().projection();
     
    3535     */
    3636    @Test
    37     public void testNetworkErrors() throws MalformedURLException {
     37    void testNetworkErrors() throws MalformedURLException {
    3838        NetworkManager.clearNetworkErrors();
    3939        assertTrue(NetworkManager.getNetworkErrors().isEmpty());
     
    5252     */
    5353    @Test
    54     public void testOfflineResources() {
     54    void testOfflineResources() {
    5555        NetworkManager.setOnline(OnlineResource.ALL);
    5656        assertFalse(NetworkManager.isOffline("http://www.example.com/"));
  • trunk/test/unit/org/openstreetmap/josm/io/NoteReaderTest.java

    r10134 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
    77import java.util.List;
    88
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.notes.Note;
     
    2020 * Unit tests of {@link NoteReader} class.
    2121 */
    22 public class NoteReaderTest {
     22class NoteReaderTest {
    2323
    2424    /**
     
    2828     */
    2929    @Test
    30     public void testNoteReader() throws SAXException, IOException {
     30    void testNoteReader() throws SAXException, IOException {
    3131        List<Note> list = new NoteReader(
    3232            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
     
    8989     */
    9090    @Test
    91     public void testTicket12393() throws Exception {
     91    void testTicket12393() throws Exception {
    9292        // CHECKSTYLE.OFF: LineLength
    9393        new NoteReader(
  • trunk/test/unit/org/openstreetmap/josm/io/OsmApiExceptionTest.java

    r14810 r17275  
    22package org.openstreetmap.josm.io;
    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.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 of {@link OsmApiException} class.
    1515 */
    16 public class OsmApiExceptionTest {
     16class OsmApiExceptionTest {
    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().preferences();
     
    2727     */
    2828    @Test
    29     public void testTicket17328() {
     29    void testTicket17328() {
    3030        assertFalse(new OsmApiException(503, "foo", "bar").isHtml());
    3131        assertTrue(new OsmApiException(503, null, "<h2>This website is under heavy load (queue full)</h2><p>Sorry...</p>").isHtml());
  • trunk/test/unit/org/openstreetmap/josm/io/OsmApiTest.java

    r10051 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.ByteArrayInputStream;
    77import java.nio.charset.StandardCharsets;
    88
    9 import org.junit.BeforeClass;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.BeforeAll;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.JOSMFixture;
    1212import org.openstreetmap.josm.data.osm.Changeset;
     
    1717 * Unit tests of {@link OsmApi} class.
    1818 */
    19 public class OsmApiTest {
     19class OsmApiTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUp() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testTicket12675() throws IllegalDataException {
     34    void testTicket12675() throws IllegalDataException {
    3535        OsmApi api = OsmApi.getOsmApi();
    3636        Changeset cs = new Changeset();
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.java

    r14048 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.fail;
    66
    77import java.util.Arrays;
    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.data.coor.LatLon;
    1212import org.openstreetmap.josm.data.osm.Changeset;
     
    2020 * Unit tests of {@link OsmChangeBuilder}
    2121 */
    22 public class OsmChangeBuilderTest {
     22class OsmChangeBuilderTest {
    2323
    2424    /**
    2525     * Setup rule
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    4242     */
    4343    @Test
    44     public void testConstructor() {
     44    void testConstructor() {
    4545        Changeset cs = new Changeset(1);
    4646        // should not fail
     
    5757     */
    5858    @Test
    59     public void testSequenceOfMethodCalls() {
     59    void testSequenceOfMethodCalls() {
    6060        Changeset cs = new Changeset(1);
    6161        OsmChangeBuilder csBuilder = new OsmChangeBuilder(cs);
     
    9393     */
    9494    @Test
    95     public void testDocumentWithNewNode() {
     95    void testDocumentWithNewNode() {
    9696        Changeset cs = new Changeset(1);
    9797        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    114114     */
    115115    @Test
    116     public void testDocumentWithModifiedNode() {
     116    void testDocumentWithModifiedNode() {
    117117        Changeset cs = new Changeset(1);
    118118        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    137137     */
    138138    @Test
    139     public void testDocumentWithDeletedNode() {
     139    void testDocumentWithDeletedNode() {
    140140        Changeset cs = new Changeset(1);
    141141        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    160160     */
    161161    @Test
    162     public void testMixed() {
     162    void testMixed() {
    163163        Changeset cs = new Changeset(1);
    164164        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangeReaderTest.java

    r14314 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.ByteArrayInputStream;
     
    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.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.notes.Note;
     
    2525 * Unit tests of {@link OsmChangeReader}.
    2626 */
    27 public class OsmChangeReaderTest {
     27class OsmChangeReaderTest {
    2828
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    5454     */
    5555    @Test
    56     public void testNotes() throws Exception {
     56    void testNotes() throws Exception {
    5757        NoteData nd = parse(
    5858                "<create>\r\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java

    r14201 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
    7 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.io.ByteArrayInputStream;
     
    1212import java.util.Arrays;
    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.data.osm.ChangesetDataSet;
    1717import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType;
     
    3131 * Unit tests of {@link OsmChangesetContentParser}.
    3232 */
    33 public class OsmChangesetContentParserTest {
     33class OsmChangesetContentParserTest {
    3434
    3535    /**
    3636     * Setup rule
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules();
     
    5454    @Test
    5555    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL")
    56     public void test_Constructor() {
     56    void test_Constructor() {
    5757
    5858        // should be OK
     
    7373     */
    7474    @Test
    75     public void test_parse_arguments() throws XmlParsingException {
     75    void test_parse_arguments() throws XmlParsingException {
    7676        OsmChangesetContentParser parser;
    7777
     
    9696     */
    9797    @Test
    98     public void test_OK_OneCreatedNode() throws XmlParsingException {
     98    void test_OK_OneCreatedNode() throws XmlParsingException {
    9999        OsmChangesetContentParser parser;
    100100
     
    126126     */
    127127    @Test
    128     public void test_OK_OneUpdatedNode() throws XmlParsingException {
     128    void test_OK_OneUpdatedNode() throws XmlParsingException {
    129129        OsmChangesetContentParser parser;
    130130
     
    156156     */
    157157    @Test
    158     public void test_OK_OneDeletedNode() throws XmlParsingException {
     158    void test_OK_OneDeletedNode() throws XmlParsingException {
    159159        OsmChangesetContentParser parser;
    160160
     
    186186     */
    187187    @Test
    188     public void test_OK_ComplexTestCase() throws XmlParsingException {
     188    void test_OK_ComplexTestCase() throws XmlParsingException {
    189189        OsmChangesetContentParser parser;
    190190
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetParserTest.java

    r14231 r17275  
    22package org.openstreetmap.josm.io;
    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;
     
    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.osm.Changeset;
    1414import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    2020 * Unit tests of {@link OsmChangesetParser} class.
    2121 */
    22 public class OsmChangesetParserTest {
     22class OsmChangesetParserTest {
    2323
    2424    private static final String BEGIN =
     
    5858     * Setup test.
    5959     */
    60     @Rule
     60    @RegisterExtension
    6161    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6262    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    7171     */
    7272    @Test
    73     public void testParseWithoutDiscussion() throws IllegalDataException {
     73    void testParseWithoutDiscussion() throws IllegalDataException {
    7474        // http://api.openstreetmap.org/api/0.6/changeset/36749147
    7575        Changeset cs = parse(BEGIN + END).iterator().next();
     
    8484     */
    8585    @Test
    86     public void testParseWithDiscussion() throws IllegalDataException {
     86    void testParseWithDiscussion() throws IllegalDataException {
    8787        // http://api.openstreetmap.org/api/0.6/changeset/36749147?include_discussion=true
    8888        Changeset cs = parse(BEGIN + DISCUSSION + END).iterator().next();
  • trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java

    r17232 r17275  
    22package org.openstreetmap.josm.io;
    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.ByteArrayInputStream;
     
    1111import java.util.Iterator;
    1212
    13 import org.junit.BeforeClass;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.coor.LatLon;
    1717import org.openstreetmap.josm.data.osm.DataSet;
     
    2929 * Unit tests of {@link OsmReader} class.
    3030 */
    31 public class OsmJsonReaderTest {
     31class OsmJsonReaderTest {
    3232
    3333    /**
    3434     * Setup rule
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules();
     
    4141     * Setup test
    4242     */
    43     @BeforeClass
     43    @BeforeAll
    4444    public static void setUp() {
    4545        DateUtils.newIsoDateTimeFormat().setTimeZone(DateUtils.UTC);
     
    8989     */
    9090    @Test
    91     public void testHeader() throws Exception {
     91    void testHeader() throws Exception {
    9292        DataSet ds = parse("");
    9393        assertEquals("0.6", ds.getVersion());
     
    9999     */
    100100    @Test
    101     public void testNodeSpatialData() throws Exception {
     101    void testNodeSpatialData() throws Exception {
    102102        DataSet ds = parse("{\n" +
    103103                "  \"type\": \"node\",\n" +
     
    116116     */
    117117    @Test
    118     public void testNodeMetaData() throws Exception {
     118    void testNodeMetaData() throws Exception {
    119119        DataSet ds = parse("{\n" +
    120120                "  \"type\": \"node\",\n" +
     
    143143     */
    144144    @Test
    145     public void testNodeTags() throws Exception {
     145    void testNodeTags() throws Exception {
    146146        DataSet ds = parse("{\n" +
    147147                "  \"type\": \"node\",\n" +
     
    167167     */
    168168    @Test
    169     public void testWay() throws Exception {
     169    void testWay() throws Exception {
    170170        DataSet ds = parse("{\n" +
    171171                "  \"type\": \"way\",\n" +
     
    199199     */
    200200    @Test
    201     public void testRelation() throws Exception {
     201    void testRelation() throws Exception {
    202202        DataSet ds = parse("{\n" +
    203203                "  \"type\": \"relation\",\n" +
     
    244244     */
    245245    @Test
    246     public void testEmptyRelation() throws Exception {
     246    void testEmptyRelation() throws Exception {
    247247        DataSet ds = parse("{\n" +
    248248                "  \"type\": \"relation\",\n" +
     
    260260     */
    261261    @Test
    262     public void testRemark() throws Exception {
     262    void testRemark() throws Exception {
    263263        DataSet ds = parse("", "," +
    264264                "  \"remark\": \"runtime error: Query ran out of memory in \\\"query\\\" at line 5.\"\n");
  • trunk/test/unit/org/openstreetmap/josm/io/OsmReaderTest.java

    r17169 r17275  
    55import static org.hamcrest.CoreMatchers.is;
    66import static org.hamcrest.MatcherAssert.assertThat;
    7 import static org.junit.Assert.assertEquals;
    8 import static org.junit.Assert.assertFalse;
    9 import static org.junit.Assert.assertNull;
    10 import static org.junit.Assert.assertTrue;
    11 import static org.junit.Assert.fail;
     7import static org.junit.jupiter.api.Assertions.assertEquals;
     8import static org.junit.jupiter.api.Assertions.assertFalse;
     9import static org.junit.jupiter.api.Assertions.assertNull;
     10import static org.junit.jupiter.api.Assertions.assertTrue;
     11import static org.junit.jupiter.api.Assertions.fail;
    1212
    1313import java.io.ByteArrayInputStream;
     
    1818import java.util.Arrays;
    1919
    20 import org.junit.Rule;
    21 import org.junit.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
     21import org.junit.jupiter.api.Test;
    2222import org.openstreetmap.josm.TestUtils;
    2323import org.openstreetmap.josm.data.osm.DataSet;
     
    3434 * Unit tests of {@link OsmReader} class.
    3535 */
    36 public class OsmReaderTest {
     36class OsmReaderTest {
    3737
    3838    /**
    3939     * Setup rule
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules();
     
    6666     */
    6767    @Test
    68     public void testPostProcessors() throws Exception {
     68    void testPostProcessors() throws Exception {
    6969        PostProcessorStub registered = new PostProcessorStub();
    7070        PostProcessorStub unregistered = new PostProcessorStub();
     
    9696     */
    9797    @Test
    98     public void testUnknownRoot() throws Exception {
     98    void testUnknownRoot() throws Exception {
    9999        for (Options[] options : options()) {
    100100            testUnknown("<nonosm/>", options);
     
    107107     */
    108108    @Test
    109     public void testUnknownMeta() throws Exception {
     109    void testUnknownMeta() throws Exception {
    110110        for (Options[] options : options()) {
    111111            testUnknown("<osm version='0.6'><meta osm_base='2017-03-29T19:04:03Z'/></osm>", options);
     
    118118     */
    119119    @Test
    120     public void testUnknownNote() throws Exception {
     120    void testUnknownNote() throws Exception {
    121121        for (Options[] options : options()) {
    122122            testUnknown("<osm version='0.6'><note>The data included in this document is from www.openstreetmap.org.</note></osm>", options);
     
    129129     */
    130130    @Test
    131     public void testUnknownTag() throws Exception {
     131    void testUnknownTag() throws Exception {
    132132        for (Options[] options : options()) {
    133133            testUnknown("<osm version='0.6'><foo>bar</foo></osm>", options);
     
    170170     */
    171171    @Test
    172     public void testInvalidUid() throws Exception {
     172    void testInvalidUid() throws Exception {
    173173        testInvalidData("<osm version='0.6'><node id='1' uid='nan'/></osm>",
    174174                "Illegal value for attribute 'uid'. Got 'nan'. (at line 1, column 82). 82 bytes have been read");
     
    180180     */
    181181    @Test
    182     public void testMissingId() throws Exception {
     182    void testMissingId() throws Exception {
    183183        testInvalidData("<osm version='0.6'><node/></osm>",
    184184                "Missing required attribute 'id'. (at line 1, column 65). 64 bytes have been read");
     
    190190     */
    191191    @Test
    192     public void testMissingRef() throws Exception {
     192    void testMissingRef() throws Exception {
    193193        testInvalidData("<osm version='0.6'><way id='1' version='1'><nd/></way></osm>",
    194194                "Missing mandatory attribute 'ref' on <nd> of way 1. (at line 1, column 87). 88 bytes have been read");
     
    202202     */
    203203    @Test
    204     public void testIllegalRef() throws Exception {
     204    void testIllegalRef() throws Exception {
    205205        testInvalidData("<osm version='0.6'><way id='1' version='1'><nd ref='0'/></way></osm>",
    206206                "Illegal value of attribute 'ref' of element <nd>. Got 0. (at line 1, column 95). 96 bytes have been read");
     
    219219     */
    220220    @Test
    221     public void testMissingType() throws Exception {
     221    void testMissingType() throws Exception {
    222222        testInvalidData("<osm version='0.6'><relation id='1' version='1'><member ref='1'/></relation></osm>",
    223223                "Missing attribute 'type' on member 1 in relation 1. (at line 1, column 104). 109 bytes have been read");
     
    229229     */
    230230    @Test
    231     public void testIllegalType() throws Exception {
     231    void testIllegalType() throws Exception {
    232232        testInvalidData("<osm version='0.6'><relation id='1' version='1'><member type='foo' ref='1'/></relation></osm>",
    233233                "Illegal value for attribute 'type' on member 1 in relation 1. Got foo. (at line 1, column 115). 120 bytes have been read");
     
    239239     */
    240240    @Test
    241     public void testMissingKeyValue() throws Exception {
     241    void testMissingKeyValue() throws Exception {
    242242        testInvalidData("<osm version='0.6'><node id='1' version='1'><tag/></node></osm>",
    243243                "Missing key or value attribute in tag. (at line 1, column 89). 89 bytes have been read");
     
    253253     */
    254254    @Test
    255     public void testMissingVersion() throws Exception {
     255    void testMissingVersion() throws Exception {
    256256        testInvalidData("<osm/>",
    257257                "Missing mandatory attribute 'version'. (at line 1, column 45). 44 bytes have been read");
     
    265265     */
    266266    @Test
    267     public void testUnsupportedVersion() throws Exception {
     267    void testUnsupportedVersion() throws Exception {
    268268        testInvalidData("<osm version='0.1'/>",
    269269                "Unsupported version: 0.1 (at line 1, column 59). 58 bytes have been read");
     
    275275     */
    276276    @Test
    277     public void testIllegalVersion() throws Exception {
     277    void testIllegalVersion() throws Exception {
    278278        testInvalidData("<osm version='0.6'><node id='1' version='nan'/></osm>",
    279279                "Illegal value for attribute 'version' on OSM primitive with ID 1. Got nan. (at line 1, column 86). 86 bytes have been read");
     
    285285     */
    286286    @Test
    287     public void testIllegalChangeset() throws Exception {
     287    void testIllegalChangeset() throws Exception {
    288288        testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='nan'/></osm>",
    289289                "Illegal value for attribute 'changeset'. Got nan. (at line 1, column 100). 100 bytes have been read");
     
    297297     */
    298298    @Test
    299     public void testGdprChangeset() throws Exception {
     299    void testGdprChangeset() throws Exception {
    300300        String gdprChangeset = "<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>";
    301301        for (Options[] options : options()) {
     
    309309     */
    310310    @Test
    311     public void testInvalidBounds() throws Exception {
     311    void testInvalidBounds() throws Exception {
    312312        testInvalidData("<osm version='0.6'><bounds/></osm>",
    313313                "Missing mandatory attributes on element 'bounds'. " +
     
    329329     */
    330330    @Test
    331     public void testTicket14199() throws Exception {
     331    void testTicket14199() throws Exception {
    332332        try (InputStream in = TestUtils.getRegressionDataStream(14199, "emptytag.osm")) {
    333333            Way w = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE).getWays().iterator().next();
     
    343343     */
    344344    @Test
    345     public void testTicket14754() throws Exception {
     345    void testTicket14754() throws Exception {
    346346        try (InputStream in = TestUtils.getRegressionDataStream(14754, "malformed_for_14754.osm")) {
    347347            OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     
    361361     */
    362362    @Test
    363     public void testTicket14788() throws Exception {
     363    void testTicket14788() throws Exception {
    364364        try (InputStream in = TestUtils.getRegressionDataStream(14788, "remove_sign_test_4.osm")) {
    365365            OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     
    379379     */
    380380    @Test
    381     public void testRemark() throws Exception {
     381    void testRemark() throws Exception {
    382382        String query = "<osm version=\"0.6\" generator=\"Overpass API 0.7.55.4 3079d8ea\">\r\n" +
    383383                "<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>\r\n" +
     
    396396     */
    397397    @Test
    398     public void testUnknownAttributeTags() throws Exception {
     398    void testUnknownAttributeTags() throws Exception {
    399399        String testData = "<osm version=\"0.6\" generator=\"fake generator\">"
    400400                + "<node id='1' version='1' visible='true' changeset='82' randomkey='randomvalue'></node>" + "</osm>";
  • trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java

    r16663 r17275  
    22package org.openstreetmap.josm.io;
    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.io.ByteArrayOutputStream;
     
    1616import java.util.List;
    1717
    18 import org.junit.Test;
     18import org.junit.jupiter.api.Test;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.osm.Changeset;
     
    2828 * Unit tests of {@link OsmWriter} class.
    2929 */
    30 public class OsmWriterTest {
     30class OsmWriterTest {
    3131
    3232    /**
     
    3434     */
    3535    @Test
    36     public void testByIdComparator() {
     36    void testByIdComparator() {
    3737
    3838        final List<NodeData> ids = new ArrayList<>();
     
    5656     */
    5757    @Test
    58     public void testHeader() throws IOException {
     58    void testHeader() throws IOException {
    5959        doTestHeader(null, null,
    6060                "<osm version='0.6' generator='JOSM'>");
     
    8282     */
    8383    @Test
    84     public void testWriteLock() throws IOException {
     84    void testWriteLock() throws IOException {
    8585        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    8686        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(baos, StandardCharsets.UTF_8));
     
    101101     */
    102102    @Test
    103     public void testChangeset() throws IOException {
     103    void testChangeset() throws IOException {
    104104        Changeset cs = new Changeset();
    105105        cs.setUser(User.getAnonymous());
  • trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.java

    r14040 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.io.ByteArrayInputStream;
     
    1111import java.nio.charset.StandardCharsets;
    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.DataSet;
    1616import org.openstreetmap.josm.data.osm.Node;
     
    2525 * Additional unit tests for {@link OsmReader}.
    2626 */
    27 public class ParseWithChangesetReaderTest {
     27class ParseWithChangesetReaderTest {
    2828
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    5454     */
    5555    @Test
    56     public void test_1() throws Exception {
     56    void test_1() throws Exception {
    5757        String doc =
    5858            "<osm version=\"0.6\">\n" +
     
    7373     */
    7474    @Test
    75     public void test_11() throws Exception {
     75    void test_11() throws Exception {
    7676        String doc =
    7777        "<osm version=\"0.6\">\n" +
     
    9292     */
    9393    @Test
    94     public void test_12() throws Exception {
     94    void test_12() throws Exception {
    9595        String doc =
    9696        "<osm version=\"0.6\">\n" +
     
    111111     */
    112112    @Test
    113     public void test_13() throws Exception {
     113    void test_13() throws Exception {
    114114        String doc =
    115115        "<osm version=\"0.6\">\n" +
     
    131131     */
    132132    @Test
    133     public void test_14() throws Exception {
     133    void test_14() throws Exception {
    134134        String doc =
    135135        "<osm version=\"0.6\">\n" +
     
    152152     */
    153153    @Test
    154     public void test_2() throws Exception {
     154    void test_2() throws Exception {
    155155        String doc =
    156156        "<osm version=\"0.6\">\n" +
     
    171171     */
    172172    @Test
    173     public void test_3() throws Exception {
     173    void test_3() throws Exception {
    174174        String doc =
    175175        "<osm version=\"0.6\">\n" +
     
    190190     */
    191191    @Test
    192     public void test_4() throws IOException {
     192    void test_4() throws IOException {
    193193        String doc =
    194194        "<osm version=\"0.6\">\n" +
     
    205205     */
    206206    @Test
    207     public void test_5() throws IOException {
     207    void test_5() throws IOException {
    208208        String doc =
    209209        "<osm version=\"0.6\">\n" +
     
    220220     */
    221221    @Test
    222     public void test_6() throws IOException {
     222    void test_6() throws IOException {
    223223        String doc =
    224224            "<osm version=\"0.6\">\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/UrlPatternsTest.java

    r15784 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    66import java.util.Arrays;
     
    88import java.util.regex.Pattern;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212
     
    1414 * Unit tests of {@link UrlPatterns}.
    1515 */
    16 public class UrlPatternsTest {
     16class UrlPatternsTest {
    1717
    1818    private static final List<Class<? extends Enum<?>>> patterns = Arrays.asList(
     
    2727     */
    2828    @Test
    29     public void testUrlPatternEnums() {
     29    void testUrlPatternEnums() {
    3030        patterns.forEach(TestUtils::superficialEnumCodeCoverage);
    3131    }
     
    3535     */
    3636    @Test
    37     public void testUrlPatterns() {
     37    void testUrlPatterns() {
    3838        assertTrue(patterns.stream().flatMap(c -> Arrays.stream(c.getEnumConstants())).map(t -> ((UrlPattern) t).pattern())
    3939                .map(Pattern::compile).count() > 0);
  • trunk/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java

    r15755 r17275  
    22package org.openstreetmap.josm.io.audio;
    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;
     6import static org.junit.jupiter.api.Assertions.assertTimeout;
    67
    78import java.io.File;
    89import java.net.MalformedURLException;
    910import java.net.URL;
     11import java.time.Duration;
    1012
    11 import org.junit.BeforeClass;
    12 import org.junit.Ignore;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Disabled;
     15import org.junit.jupiter.api.Test;
    1416import org.openstreetmap.josm.JOSMFixture;
    1517import org.openstreetmap.josm.TestUtils;
     
    1921 * Unit tests of {@link AudioPlayer} class.
    2022 */
    21 @Ignore("unresolved sporadic deadlock - see #13809")
    22 public class AudioPlayerTest {
     23@Disabled("unresolved sporadic deadlock - see #13809")
     24class AudioPlayerTest {
    2325
    2426    // We play wav files of about 4 seconds + pause, so define timeout at 16 seconds
     
    2830     * Setup test.
    2931     */
    30     @BeforeClass
     32    @BeforeAll
    3133    public static void setUp() {
    3234        JOSMFixture.createUnitTestFixture().init();
     
    3840     * @throws MalformedURLException wrong URL
    3941     */
    40     @Test(timeout = 4*MAX_DURATION)
    41     public void testPlay() throws MalformedURLException, Exception {
    42         File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
    43         File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav"));
     42    @Test
     43    void testPlay() throws MalformedURLException, Exception {
     44        assertTimeout(Duration.ofMillis(4*MAX_DURATION), () -> {
     45            File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
     46            File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav"));
    4447
    45         for (File w : new File[] {wav1, wav2}) {
    46             System.out.println("Playing " + w.toPath());
    47             URL url = w.toURI().toURL();
    48             final Stopwatch stopwatch = Stopwatch.createStarted();
    49             AudioPlayer.play(url);
    50             assertTrue(AudioPlayer.playing());
    51             assertFalse(AudioPlayer.paused());
    52             AudioPlayer.pause();
    53             assertFalse(AudioPlayer.playing());
    54             assertTrue(AudioPlayer.paused());
    55             AudioPlayer.play(url, AudioPlayer.position());
    56             while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) {
    57                 Thread.sleep(500);
     48            for (File w : new File[] {wav1, wav2}) {
     49                System.out.println("Playing " + w.toPath());
     50                URL url = w.toURI().toURL();
     51                final Stopwatch stopwatch = Stopwatch.createStarted();
     52                AudioPlayer.play(url);
     53                assertTrue(AudioPlayer.playing());
     54                assertFalse(AudioPlayer.paused());
     55                AudioPlayer.pause();
     56                assertFalse(AudioPlayer.playing());
     57                assertTrue(AudioPlayer.paused());
     58                AudioPlayer.play(url, AudioPlayer.position());
     59                while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) {
     60                    Thread.sleep(500);
     61                }
     62                System.out.println("Play finished after " + stopwatch);
     63                assertTrue(stopwatch.elapsed() < MAX_DURATION);
     64                AudioPlayer.reset();
     65                Thread.sleep(1000); // precaution, see #13809
    5866            }
    59             System.out.println("Play finished after " + stopwatch);
    60             assertTrue(stopwatch.elapsed() < MAX_DURATION);
    61             AudioPlayer.reset();
    62             Thread.sleep(1000); // precaution, see #13809
    63         }
     67        });
    6468    }
    6569}
  • trunk/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java

    r12327 r17275  
    22package org.openstreetmap.josm.io.audio;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.File;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.JOSMFixture;
    1111import org.openstreetmap.josm.TestUtils;
     
    1414 * Unit tests of {@link AudioUtil} class.
    1515 */
    16 public class AudioUtilTest {
     16class AudioUtilTest {
    1717
    1818    private static final double EPSILON = 1e-11;
     
    2121     * Setup test.
    2222     */
    23     @BeforeClass
     23    @BeforeAll
    2424    public static void setUp() {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3030     */
    3131    @Test
    32     public void testGetCalibratedDuration() {
     32    void testGetCalibratedDuration() {
    3333        assertEquals(0.0, AudioUtil.getCalibratedDuration(new File("invalid_file")), EPSILON);
    3434        File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
  • trunk/test/unit/org/openstreetmap/josm/io/auth/CredentialsAgentExceptionTest.java

    r11102 r17275  
    22package org.openstreetmap.josm.io.auth;
    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 CredentialsAgentException} class.
    1414 */
    15 public class CredentialsAgentExceptionTest {
     15class CredentialsAgentExceptionTest {
    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 testCredentialsAgentException() {
     28    void testCredentialsAgentException() {
    2929        String msg = "test1";
    3030        Exception cause = new Exception("test2");
  • trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io.nmea;
    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.ByteArrayInputStream;
     
    1717import java.util.TimeZone;
    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.TestUtils;
    2323import org.openstreetmap.josm.data.coor.LatLon;
     
    3737 * Unit tests of {@link NmeaReader} class.
    3838 */
    39 public class NmeaReaderTest {
     39class NmeaReaderTest {
    4040    /**
    4141     * Set the timezone and timeout.
    4242     */
    43     @Rule
     43    @RegisterExtension
    4444    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4545    public JOSMTestRules test = new JOSMTestRules();
     
    5050     * Forces the timezone.
    5151     */
    52     @Before
     52    @BeforeEach
    5353    public void setUp() {
    5454        iso8601.setTimeZone(DateUtils.UTC);
     
    6060     */
    6161    @Test
    62     public void testReader() throws Exception {
     62    void testReader() throws Exception {
    6363        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
    6464        final NmeaReader in = new NmeaReader(Files.newInputStream(Paths.get("nodist/data/btnmeatrack_2016-01-25.nmea")));
     
    116116     */
    117117    @Test
    118     public void testIsSentence() {
     118    void testIsSentence() {
    119119        assertTrue(NmeaReader.isSentence("$GPVTG", Sentence.VTG));
    120120        assertTrue(NmeaReader.isSentence("$GAVTG", Sentence.VTG));
     
    130130     */
    131131    @Test
    132     public void testTicket1433() throws Exception {
     132    void testTicket1433() throws Exception {
    133133        compareWithReference(1433, "2008-08-14-16-04-58", 1241);
    134134    }
     
    139139     */
    140140    @Test
    141     public void testTicket1853() throws Exception {
     141    void testTicket1853() throws Exception {
    142142        compareWithReference(1853, "PosData-20081216-115434", 1285);
    143143    }
     
    148148     */
    149149    @Test
    150     public void testTicket2147() throws Exception {
     150    void testTicket2147() throws Exception {
    151151        compareWithReference(2147, "WG20080203171807.log", 487);
    152152    }
     
    157157     */
    158158    @Test
    159     public void testTicket14924() throws Exception {
     159    void testTicket14924() throws Exception {
    160160        compareWithReference(14924, "input", 0);
    161161    }
     
    184184     */
    185185    @Test
    186     public void testTicket16496() throws Exception {
     186    void testTicket16496() throws Exception {
    187187        assertEquals("2018-05-30T16:28:59.400Z", iso8601.format(
    188188                readDate("$GNRMC,162859.400,A,4543.03388,N,00058.19870,W,45.252,209.07,300518,,,D,V*13")));
     
    198198     */
    199199    @Test
    200     public void testTicket16554() throws Exception {
     200    void testTicket16554() throws Exception {
    201201        assertEquals(63.2420959, readSpeed(
    202202                  "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26"), 1e-7);
  • trunk/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java

    r10931 r17275  
    22package org.openstreetmap.josm.io.protocols.data;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.IOException;
     
    88import java.net.URLConnection;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.testutils.JOSMTestRules;
    1414
     
    1616 * Unit tests of {@link Handler} class.
    1717 */
    18 public class HandlerTest {
     18class HandlerTest {
    1919
    2020    /**
    2121     * Use the test rules to remove any layers and reset state.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    public final JOSMTestRules rules = new JOSMTestRules();
    2525
     
    2727     * Setup test.
    2828     */
    29     @Before
     29    @BeforeEach
    3030    public void setUp() {
    3131        Handler.install();
     
    3737     */
    3838    @Test
    39     public void testBase64Image() throws IOException {
     39    void testBase64Image() throws IOException {
    4040        // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML
    4141        URLConnection connection = new Handler().openConnection(new URL("data:image/png;base64," +
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/AddTagsDialogTest.java

    r16328 r17275  
    22package org.openstreetmap.josm.io.remotecontrol;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Map;
    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 AddTagsDialog}.
    1616 */
    17 public class AddTagsDialogTest {
     17class AddTagsDialogTest {
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2727     */
    2828    @Test
    29     public void testParseUrlTagsToKeyValues() {
     29    void testParseUrlTagsToKeyValues() {
    3030        Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("wikipedia:de=Residenzschloss Dresden|name:en=Dresden Castle");
    3131        assertEquals(2, strings.size());
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java

    r16436 r17275  
    22package org.openstreetmap.josm.io.remotecontrol;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.BufferedReader;
     
    1515import java.util.stream.Collectors;
    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.TestUtils;
    2222import org.openstreetmap.josm.spi.preferences.Config;
     
    3232 * Unit tests for Remote Control
    3333 */
    34 public class RemoteControlTest {
     34class RemoteControlTest {
    3535
    3636    private String httpBase;
     
    4646     * Setup test.
    4747     */
    48     @Rule
     48    @RegisterExtension
    4949    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5050    public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT();
     
    5454     * @throws GeneralSecurityException if a security error occurs
    5555     */
    56     @Before
     56    @BeforeEach
    5757    public void setUp() throws GeneralSecurityException {
    5858        if (PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR"))) {
     
    6969     * Stops Remote control after testing requests.
    7070     */
    71     @After
     71    @AfterEach
    7272    public void tearDown() {
    7373        RemoteControl.stop();
     
    7979     */
    8080    @Test
    81     public void testHttpListOfCommands() throws Exception {
     81    void testHttpListOfCommands() throws Exception {
    8282        testListOfCommands(httpBase);
    8383    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RequestProcessorTest.java

    r16825 r17275  
    1313 * @author Taylor Smock
    1414 */
    15 public class RequestProcessorTest {
     15class RequestProcessorTest {
    1616    /**
    1717     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19436">#19436</a>
    1818     */
    1919    @Test
    20     public void testFeaturesDoesNotThrowNPE() {
     20    void testFeaturesDoesNotThrowNPE() {
    2121        assertTrue(RequestProcessor.getHandlersInfo(Arrays.asList("add_node", "/add_node", "", null))
    2222                .noneMatch(Objects::isNull));
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.DataSet;
    1111import org.openstreetmap.josm.gui.MainApplication;
     
    1919 * Unit tests of {@link AddNodeHandler} class.
    2020 */
    21 public class AddNodeHandlerTest {
     21class AddNodeHandlerTest {
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
     
    3838     */
    3939    @Test
    40     public void testBadRequestNoLayer() {
     40    void testBadRequestNoLayer() {
    4141        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle());
    4242        assertEquals("There is no layer opened to add node", e.getMessage());
     
    4747     */
    4848    @Test
    49     public void testBadRequestNoParam() {
     49    void testBadRequestNoParam() {
    5050        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    5151        MainApplication.getLayerManager().addLayer(layer);
     
    5858     */
    5959    @Test
    60     public void testBadRequestInvalidUrl() {
     60    void testBadRequestInvalidUrl() {
    6161        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    6262        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     
    6767     */
    6868    @Test
    69     public void testBadRequestIncompleteUrl() {
     69    void testBadRequestIncompleteUrl() {
    7070        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7171        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     
    7676     */
    7777    @Test
    78     public void testNominalRequest() {
     78    void testNominalRequest() {
    7979        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    8080        MainApplication.getLayerManager().addLayer(layer);
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.DataSet;
    1111import org.openstreetmap.josm.gui.MainApplication;
     
    1919 * Unit tests of {@link AddWayHandler} class.
    2020 */
    21 public class AddWayHandlerTest {
     21class AddWayHandlerTest {
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3838     */
    3939    @Test
    40     public void testBadRequestNoLayer() {
     40    void testBadRequestNoLayer() {
    4141        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?way=0,0;1,1").handle());
    4242        assertEquals("There is no layer opened to add way", e.getMessage());
     
    4747     */
    4848    @Test
    49     public void testBadRequestNoParam() {
     49    void testBadRequestNoParam() {
    5050        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    5151        try {
     
    6262     */
    6363    @Test
    64     public void testBadRequestInvalidUrl() {
     64    void testBadRequestInvalidUrl() {
    6565        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    6666        assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage());
     
    7171     */
    7272    @Test
    73     public void testBadRequestIncompleteUrl() {
     73    void testBadRequestIncompleteUrl() {
    7474        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7575        assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage());
     
    8080     */
    8181    @Test
    82     public void testNominalRequest() {
     82    void testNominalRequest() {
    8383        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    8484        try {
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java

    r16739 r17275  
    44import static org.hamcrest.CoreMatchers.hasItem;
    55import static org.hamcrest.MatcherAssert.assertThat;
    6 import static org.junit.Assert.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
    77import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    88import static org.junit.jupiter.api.Assertions.assertThrows;
     
    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.data.imagery.ImageryInfo;
    1616import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    2222 * Unit tests of {@link ImageryHandler} class.
    2323 */
    24 public class ImageryHandlerTest {
     24class ImageryHandlerTest {
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules();
     
    4141     */
    4242    @Test
    43     public void testBadRequestNoParam() {
     43    void testBadRequestNoParam() {
    4444        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    4545        assertEquals("Parameter must not be null", e.getMessage());
     
    5151     */
    5252    @Test
    53     public void testBadRequestInvalidUrl() {
     53    void testBadRequestInvalidUrl() {
    5454        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    5555        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    6060     */
    6161    @Test
    62     public void testBadRequestIncompleteUrl() {
     62    void testBadRequestIncompleteUrl() {
    6363        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    6464        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    6969     */
    7070    @Test
    71     public void testNominalRequest() {
     71    void testNominalRequest() {
    7272        assertDoesNotThrow(() -> newHandler("https://localhost?url=foo").handle());
    7373    }
     
    7878     */
    7979    @Test
    80     public void testOptionalParams() throws Exception {
     80    void testOptionalParams() throws Exception {
    8181        List<String> optionalParams = Arrays.asList(newHandler("").getOptionalParams());
    8282        assertThat(optionalParams, hasItem("type"));
     
    9191     */
    9292    @Test
    93     public void testBuildImageryInfo() throws Exception {
     93    void testBuildImageryInfo() throws Exception {
    9494        String url = "https://localhost/imagery?title=osm"
    9595                + "&type=tms&min_zoom=3&max_zoom=23&category=osmbasedmap&country_code=XA"
     
    110110     */
    111111    @Test
    112     public void testTicket19483() throws Exception {
     112    void testTicket19483() throws Exception {
    113113        String url = "https://localhost/imagery?url=" +
    114114                "tms[3-7]%3Ahttps%3A%2F%2Fservices.digitalglobe.com%2Fearthservice%2Ftmsaccess%2F" +
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java

    r16618 r17275  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    66import static org.junit.jupiter.api.Assertions.assertThrows;
     
    88import java.io.File;
    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.gui.MainApplication;
     
    2222 * Unit tests of {@link ImportHandler} class.
    2323 */
    24 public class ImportHandlerTest {
     24class ImportHandlerTest {
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main();
     
    4242     */
    4343    @Test
    44     public void testTicket7434() throws Exception {
     44    void testTicket7434() throws Exception {
    4545        ImportHandler req = newHandler("http://localhost:8111/import?url=http://localhost:8888/relations?relations=19711&mode=recursive");
    4646        assertEquals("http://localhost:8888/relations?relations=19711&mode=recursive", req.args.get("url"));
     
    5252     */
    5353    @Test
    54     public void testBadRequestNoParam() throws Exception {
     54    void testBadRequestNoParam() throws Exception {
    5555        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    5656        assertEquals("MalformedURLException: null", e.getMessage());
     
    6262     */
    6363    @Test
    64     public void testBadRequestInvalidUrl() throws Exception {
     64    void testBadRequestInvalidUrl() throws Exception {
    6565        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle());
    6666        assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage());
     
    7272     */
    7373    @Test
    74     public void testBadRequestIncompleteUrl() throws Exception {
     74    void testBadRequestIncompleteUrl() throws Exception {
    7575        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7676        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    8282     */
    8383    @Test
    84     public void testNominalRequest() throws Exception {
     84    void testNominalRequest() throws Exception {
    8585        String url = new File(TestUtils.getRegressionDataFile(11957, "data.osm")).toURI().toURL().toExternalForm();
    8686        try {
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link LoadAndZoomHandler} class.
    1717 */
    18 public class LoadAndZoomHandlerTest {
     18class LoadAndZoomHandlerTest {
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testBadRequestNoParam() throws Exception {
     38    void testBadRequestNoParam() throws Exception {
    3939        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    4040        assertEquals("NumberFormatException (empty String)", e.getMessage());
     
    4646     */
    4747    @Test
    48     public void testBadRequestInvalidUrl() throws Exception {
     48    void testBadRequestInvalidUrl() throws Exception {
    4949        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    5050        assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage());
     
    5656     */
    5757    @Test
    58     public void testBadRequestIncompleteUrl() throws Exception {
     58    void testBadRequestIncompleteUrl() throws Exception {
    5959        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    6060        assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage());
     
    6666     */
    6767    @Test
    68     public void testNominalRequest() throws Exception {
     68    void testNominalRequest() throws Exception {
    6969        assertDoesNotThrow(() -> newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle());
    7070    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link LoadObjectHandler} class.
    1717 */
    18 public class LoadObjectHandlerTest {
     18class LoadObjectHandlerTest {
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    3535     */
    3636    @Test
    37     public void testBadRequestNoParam() {
     37    void testBadRequestNoParam() {
    3838        assertDoesNotThrow(() -> newHandler(null).handle());
    3939    }
     
    4343     */
    4444    @Test
    45     public void testBadRequestInvalidUrl() {
     45    void testBadRequestInvalidUrl() {
    4646        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    4747        assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage());
     
    5252     */
    5353    @Test
    54     public void testBadRequestIncompleteUrl() {
     54    void testBadRequestIncompleteUrl() {
    5555        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    5656        assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage());
     
    6161     */
    6262    @Test
    63     public void testNominalRequest() {
     63    void testNominalRequest() {
    6464        assertDoesNotThrow(() -> newHandler("https://localhost?objects=foo,bar").handle());
    6565    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java

    r12558 r17275  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    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
    67import java.util.Collections;
     
    89import java.util.Map;
    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.io.remotecontrol.PermissionPrefWithDefault;
    1314import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    1920 * Unit tests of {@link RequestHandler} class.
    2021 */
    21 public class RequestHandlerTest {
     22class RequestHandlerTest {
    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();
     
    6263     */
    6364    @Test
    64     public void testRequestParameter1() throws RequestHandlerBadRequestException {
     65    void testRequestParameter1() throws RequestHandlerBadRequestException {
    6566        final Map<String, String> expected = new HashMap<>();
    6667        expected.put("query", "a");
     
    7475     */
    7576    @Test
    76     public void testRequestParameter2() throws RequestHandlerBadRequestException {
     77    void testRequestParameter2() throws RequestHandlerBadRequestException {
    7778        assertEquals(Collections.singletonMap("query", "a&b==c"),
    7879                getRequestParameter("http://example.com/?query=a%26b==c"));
     
    8485     */
    8586    @Test
    86     public void testRequestParameter3() throws RequestHandlerBadRequestException {
     87    void testRequestParameter3() throws RequestHandlerBadRequestException {
    8788        assertEquals(Collections.singleton("blue+light blue"),
    8889                getRequestParameter("http://example.com/blue+light%20blue?blue%2Blight+blue").keySet());
     
    9697     */
    9798    @Test
    98     public void testRequestParameter4() throws RequestHandlerBadRequestException {
     99    void testRequestParameter4() throws RequestHandlerBadRequestException {
    99100        assertEquals(Collections.singletonMap("/?:@-._~!$'()* ,;", "/?:@-._~!$'()* ,;=="), getRequestParameter(
    100101            "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$'()*+,;=/?:@-._~!$'()*+,;==#/?:@-._~!$&'()*+,;="
     
    107108     */
    108109    @Test
    109     public void testRequestParameter5() throws RequestHandlerBadRequestException {
     110    void testRequestParameter5() throws RequestHandlerBadRequestException {
    110111        final Map<String, String> expected = new HashMap<>();
    111112        expected.put("space", " ");
     
    119120     */
    120121    @Test
    121     public void testRequestParameter6() throws RequestHandlerBadRequestException {
     122    void testRequestParameter6() throws RequestHandlerBadRequestException {
    122123        final Map<String, String> expected = new HashMap<>();
    123124        expected.put("addtags", "wikipedia:de=Weiße_Gasse|maxspeed=5");
     
    135136    /**
    136137     * Test request parameter - invalid case
    137      * @throws RequestHandlerBadRequestException always
    138138     */
    139     @Test(expected = RequestHandlerBadRequestException.class)
    140     public void testRequestParameterInvalid() throws RequestHandlerBadRequestException {
    141         getRequestParameter("http://localhost:8111/load_and_zoom"+
     139    @Test
     140    void testRequestParameterInvalid() {
     141        assertThrows(RequestHandlerBadRequestException.class,
     142                () -> getRequestParameter("http://localhost:8111/load_and_zoom"+
    142143                "?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5"+
    143144                "&select=way23071688,way23076176,way23076177,"+
    144                 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325");
     145                "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325"));
    145146    }
    146147}
  • trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io.rtklib;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
     
    1212import java.util.TimeZone;
    1313
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.data.coor.LatLon;
    1818import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    2727 * Unit tests of {@link RtkLibPosReader} class.
    2828 */
    29 public class RtkLibPosReaderTest {
     29class RtkLibPosReaderTest {
    3030    /**
    3131     * Set the timezone and timeout.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    4040     * Forces the timezone.
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        iso8601.setTimeZone(DateUtils.UTC);
     
    5757     */
    5858    @Test
    59     public void testReader() throws Exception {
     59    void testReader() throws Exception {
    6060        RtkLibPosReader in = read("nodist/data/rtklib_example.pos");
    6161        assertEquals(137, in.getNumberOfCoordinates());
     
    8383     */
    8484    @Test
    85     public void testReader2() throws Exception {
     85    void testReader2() throws Exception {
    8686        RtkLibPosReader in = read("nodist/data/rtklib_example2.pos");
    8787        assertEquals(6, in.getNumberOfCoordinates());
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r15070 r17275  
    22package org.openstreetmap.josm.io.session;
    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.io.ByteArrayInputStream;
     
    1313import java.util.List;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.coor.EastNorth;
     
    3333 * Unit tests for Session reading.
    3434 */
    35 public class SessionReaderTest {
     35class SessionReaderTest {
    3636
    3737    /**
    3838     * Setup tests.
    3939     */
    40     @Rule
     40    @RegisterExtension
    4141    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4242    public JOSMTestRules test = new JOSMTestRules().projection();
     
    6060     */
    6161    @Test
    62     public void testReadEmpty() throws IOException, IllegalDataException {
     62    void testReadEmpty() throws IOException, IllegalDataException {
    6363        assertTrue(testRead("empty.jos").isEmpty());
    6464        assertTrue(testRead("empty.joz").isEmpty());
     
    7171     */
    7272    @Test
    73     public void testReadOsm() throws IOException, IllegalDataException {
     73    void testReadOsm() throws IOException, IllegalDataException {
    7474        for (String file : new String[]{"osm.jos", "osm.joz"}) {
    7575            List<Layer> layers = testRead(file);
     
    8787     */
    8888    @Test
    89     public void testReadGpx() throws IOException, IllegalDataException {
     89    void testReadGpx() throws IOException, IllegalDataException {
    9090        for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) {
    9191            List<Layer> layers = testRead(file);
     
    103103     */
    104104    @Test
    105     public void testReadGpxAndMarker() throws IOException, IllegalDataException {
     105    void testReadGpxAndMarker() throws IOException, IllegalDataException {
    106106        List<Layer> layers = testRead("gpx_markers.joz");
    107107        assertEquals(layers.size(), 2);
     
    127127     */
    128128    @Test
    129     public void testReadImage() throws IOException, IllegalDataException {
     129    void testReadImage() throws IOException, IllegalDataException {
    130130        final List<Layer> layers = testRead("bing.jos");
    131131        assertEquals(layers.size(), 1);
     
    144144     */
    145145    @Test
    146     public void testReadNotes() throws IOException, IllegalDataException {
     146    void testReadNotes() throws IOException, IllegalDataException {
    147147        if (MainApplication.isDisplayingMapView()) {
    148148            for (NoteLayer nl : MainApplication.getLayerManager().getLayersOfType(NoteLayer.class)) {
     
    163163     */
    164164    @Test
    165     public void testTicket17701() throws Exception {
     165    void testTicket17701() throws Exception {
    166166        try (InputStream in = new ByteArrayInputStream(("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    167167                "<josm-session version=\"0.1\">\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r14138 r17275  
    1010import java.util.Map;
    1111
    12 import org.junit.Before;
    13 import org.junit.Rule;
    14 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeEach;
     13import org.junit.jupiter.api.Test;
     14import org.junit.jupiter.api.extension.RegisterExtension;
    1515import org.openstreetmap.josm.data.coor.LatLon;
    1616import org.openstreetmap.josm.data.gpx.GpxData;
     
    3838 * Unit tests for Session writing.
    3939 */
    40 public class SessionWriterTest {
     40class SessionWriterTest {
    4141
    4242    protected static final class OsmHeadlessJosExporter extends OsmDataSessionExporter {
     
    8787     * Setup tests.
    8888     */
    89     @Rule
     89    @RegisterExtension
    9090    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    9191    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    9494     * Setup tests.
    9595     */
    96     @Before
     96    @BeforeEach
    9797    public void setUp() {
    9898        MainApplication.getLayerManager().addLayer(createOsmLayer());
     
    157157     */
    158158    @Test
    159     public void testWriteEmptyJos() throws IOException {
     159    void testWriteEmptyJos() throws IOException {
    160160        testWrite(Collections.<Layer>emptyList(), false);
    161161    }
     
    166166     */
    167167    @Test
    168     public void testWriteEmptyJoz() throws IOException {
     168    void testWriteEmptyJoz() throws IOException {
    169169        testWrite(Collections.<Layer>emptyList(), true);
    170170    }
     
    175175     */
    176176    @Test
    177     public void testWriteOsmJos() throws IOException {
     177    void testWriteOsmJos() throws IOException {
    178178        testWrite(Collections.<Layer>singletonList(createOsmLayer()), false);
    179179    }
     
    184184     */
    185185    @Test
    186     public void testWriteOsmJoz() throws IOException {
     186    void testWriteOsmJoz() throws IOException {
    187187        testWrite(Collections.<Layer>singletonList(createOsmLayer()), true);
    188188    }
     
    193193     */
    194194    @Test
    195     public void testWriteGpxJos() throws IOException {
     195    void testWriteGpxJos() throws IOException {
    196196        testWrite(Collections.<Layer>singletonList(createGpxLayer()), false);
    197197    }
     
    202202     */
    203203    @Test
    204     public void testWriteGpxJoz() throws IOException {
     204    void testWriteGpxJoz() throws IOException {
    205205        testWrite(Collections.<Layer>singletonList(createGpxLayer()), true);
    206206    }
     
    211211     */
    212212    @Test
    213     public void testWriteGpxAndMarkerJoz() throws IOException {
     213    void testWriteGpxAndMarkerJoz() throws IOException {
    214214        GpxLayer gpx = createGpxLayer();
    215215        testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true);
     
    221221     */
    222222    @Test
    223     public void testWriteImageryLayer() throws IOException {
     223    void testWriteImageryLayer() throws IOException {
    224224        final Layer layer = createImageryLayer();
    225225        testWrite(Collections.singletonList(layer), true);
     
    231231     */
    232232    @Test
    233     public void testWriteNoteLayer() throws IOException {
     233    void testWriteNoteLayer() throws IOException {
    234234        final Layer layer = createNoteLayer();
    235235        testWrite(Collections.singletonList(layer), true);
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginDownloadExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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 PluginDownloadException} class.
    1414 */
    15 public class PluginDownloadExceptionTest {
     15class PluginDownloadExceptionTest {
    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 testPluginDownloadException() {
     28    void testPluginDownloadException() {
    2929        PluginDownloadException ex = new PluginDownloadException("foo");
    3030        assertEquals("foo", ex.getMessage());
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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 PluginException} class.
    1414 */
    15 public class PluginExceptionTest {
     15class PluginExceptionTest {
    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 testPluginDownloadException() {
     28    void testPluginDownloadException() {
    2929        PluginException ex = new PluginException("foo");
    3030        assertEquals("foo", ex.getMessage());
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTest.java

    r16159 r17275  
    22package org.openstreetmap.josm.plugins;
    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.ArrayList;
     
    1717import javax.swing.JScrollPane;
    1818
    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.TestUtils;
    2222import org.openstreetmap.josm.gui.MainApplication;
     
    3535 * Unit tests of {@link PluginHandler} class.
    3636 */
    37 public class PluginHandlerTest {
     37class PluginHandlerTest {
    3838
    3939    /**
    4040     * Setup test.
    4141     */
    42     @Rule
     42    @RegisterExtension
    4343    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4444    public JOSMTestRules test = new JOSMTestRules();
     
    4848     */
    4949    @Test
    50     public void testEqualsContract() {
     50    void testEqualsContract() {
    5151        TestUtils.assumeWorkingEqualsVerifier();
    5252        EqualsVerifier.forClass(DeprecatedPlugin.class).usingGetClass().verify();
     
    5757     */
    5858    @Test
    59     public void testBuildListOfPluginsToLoad() {
     59    void testBuildListOfPluginsToLoad() {
    6060        TestUtils.assumeWorkingJMockit();
    6161        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
     
    100100     */
    101101    @Test
    102     public void testFilterDeprecatedPlugins() {
     102    void testFilterDeprecatedPlugins() {
    103103        TestUtils.assumeWorkingJMockit();
    104104        final JOptionPaneSimpleMocker jopsMocker = new JOptionPaneSimpleMocker(
     
    125125     */
    126126    @Test
    127     public void testFilterUnmaintainedPlugins() {
     127    void testFilterUnmaintainedPlugins() {
    128128        TestUtils.assumeWorkingJMockit();
    129129        final HelpAwareOptionPaneMocker haMocker = new HelpAwareOptionPaneMocker(
     
    152152     */
    153153    @Test
    154     public void testPluginInformationAction() throws PluginException {
     154    void testPluginInformationAction() throws PluginException {
    155155        TestUtils.assumeWorkingJMockit();
    156156        final String expectedText = "Ant-Version: Apache Ant 1.9.6\n" +
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginHandlerTestIT.java

    r17129 r17275  
    22package org.openstreetmap.josm.plugins;
    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.GraphicsEnvironment;
     
    2121import java.util.stream.Collectors;
    2222
    23 import org.junit.BeforeClass;
    2423import org.junit.ClassRule;
    25 import org.junit.Test;
     24import org.junit.jupiter.api.BeforeAll;
     25import org.junit.jupiter.api.Test;
    2626import org.openstreetmap.josm.TestUtils;
    2727import org.openstreetmap.josm.data.Preferences;
     
    5959     * @throws IOException in case of I/O error
    6060     */
    61     @BeforeClass
     61    @BeforeAll
    6262    public static void beforeClass() throws IOException {
    6363        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(PluginHandlerTestIT.class));
     
    6868     */
    6969    @Test
    70     public void testValidityOfAvailablePlugins() {
     70    void testValidityOfAvailablePlugins() {
    7171        loadAllPlugins();
    7272
     
    109109                Arrays.toString(layerExceptions.entrySet().toArray()) + '\n'
    110110                + Arrays.toString(noRestartExceptions.entrySet().toArray());
    111         assertTrue(msg, invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty());
     111        assertTrue(invalidManifestEntries.isEmpty() && loadingExceptions.isEmpty() && layerExceptions.isEmpty(), msg);
    112112    }
    113113
     
    254254        // Restore default timeout
    255255        Config.getPref().putInt("socket.timeout.read", defTimeout);
    256         assertTrue(pluginDownloadTask.getFailedPlugins().toString(), pluginDownloadTask.getFailedPlugins().isEmpty());
     256        assertTrue(pluginDownloadTask.getFailedPlugins().isEmpty(), pluginDownloadTask.getFailedPlugins()::toString);
    257257        assertEquals(plugins.size(), pluginDownloadTask.getDownloadedPlugins().size());
    258258
  • trunk/test/unit/org/openstreetmap/josm/plugins/PluginListParseExceptionTest.java

    r12754 r17275  
    22package org.openstreetmap.josm.plugins;
    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 PluginListParseException} class.
    1414 */
    15 public class PluginListParseExceptionTest {
     15class PluginListParseExceptionTest {
    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 testPluginListParseException() {
     28    void testPluginListParseException() {
    2929        NullPointerException npe = new NullPointerException();
    3030        PluginListParseException ex = new PluginListParseException(npe);
  • trunk/test/unit/org/openstreetmap/josm/spi/lifecycle/LifecycleTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.spi.lifecycle;
    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.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 of {@link Lifecycle} class.
    1515 */
    16 public class LifecycleTest {
     16class LifecycleTest {
    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().https().devAPI().main().projection();
     
    4444     */
    4545    @Test
    46     public void testSetInitStatusListener() {
     46    void testSetInitStatusListener() {
    4747        InitStatusListenerStub listener = new InitStatusListenerStub();
    4848        Lifecycle.setInitStatusListener(listener);
  • trunk/test/unit/org/openstreetmap/josm/spi/preferences/ListListSettingTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.spi.preferences;
    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 * Test {@link ListListSetting}.
    1414 */
    15 public class ListListSettingTest {
     15class ListListSettingTest {
    1616    /**
    1717     * This is a preference test
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testEqualsContract() {
     27    void testEqualsContract() {
    2828        TestUtils.assumeWorkingEqualsVerifier();
    2929        EqualsVerifier.forClass(ListListSetting.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/spi/preferences/ListSettingTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.spi.preferences;
    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 * Test {@link ListSetting}.
    1414 */
    15 public class ListSettingTest {
     15class ListSettingTest {
    1616    /**
    1717     * This is a preference test
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testEqualsContract() {
     27    void testEqualsContract() {
    2828        TestUtils.assumeWorkingEqualsVerifier();
    2929        EqualsVerifier.forClass(ListSetting.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/spi/preferences/MapListSettingTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.spi.preferences;
    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 * Test {@link MapListSetting}.
    1414 */
    15 public class MapListSettingTest {
     15class MapListSettingTest {
    1616    /**
    1717     * This is a preference test
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testEqualsContract() {
     27    void testEqualsContract() {
    2828        TestUtils.assumeWorkingEqualsVerifier();
    2929        EqualsVerifier.forClass(MapListSetting.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/spi/preferences/StringSettingTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.spi.preferences;
    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 * Test {@link StringSetting}.
    1414 */
    15 public class StringSettingTest {
     15class StringSettingTest {
    1616    /**
    1717     * This is a preference test
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2525     */
    2626    @Test
    27     public void testEqualsContract() {
     27    void testEqualsContract() {
    2828        TestUtils.assumeWorkingEqualsVerifier();
    2929        EqualsVerifier.forClass(StringSetting.class).usingGetClass()
  • trunk/test/unit/org/openstreetmap/josm/testutils/ImagePatternMatching.java

    r13181 r17275  
    22package org.openstreetmap.josm.testutils;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.image.BufferedImage;
  • trunk/test/unit/org/openstreetmap/josm/testutils/mockers/ExtendedDialogMocker.java

    r17090 r17275  
    22package org.openstreetmap.josm.testutils.mockers;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.Component;
  • trunk/test/unit/org/openstreetmap/josm/testutils/mockers/HelpAwareOptionPaneMocker.java

    r14332 r17275  
    22package org.openstreetmap.josm.testutils.mockers;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.Component;
  • trunk/test/unit/org/openstreetmap/josm/testutils/mockers/JOptionPaneSimpleMocker.java

    r16160 r17275  
    22package org.openstreetmap.josm.testutils.mockers;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.Component;
  • trunk/test/unit/org/openstreetmap/josm/tools/AlphanumComparatorTest.java

    r11405 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
     
    88import java.util.List;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111
    1212/**
    1313 * Unit tests of {@link AlphanumComparator}.
    1414 */
    15 public class AlphanumComparatorTest {
     15class AlphanumComparatorTest {
    1616
    1717    /**
     
    1919     */
    2020    @Test
    21     public void testNumeric() {
     21    void testNumeric() {
    2222        List<String> lst = Arrays.asList("1", "20", "-1", "00999", "100");
    2323        Collections.sort(lst, AlphanumComparator.getInstance());
     
    2929     */
    3030    @Test
    31     public void testMixed() {
     31    void testMixed() {
    3232        List<String> lst = Arrays.asList("b1", "b20", "a5", "a00999", "a100");
    3333        Collections.sort(lst, AlphanumComparator.getInstance());
  • trunk/test/unit/org/openstreetmap/josm/tools/CheckParameterUtilTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.tools;
    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 of {@link CheckParameterUtil} class.
    1313 */
    14 public class CheckParameterUtilTest {
     14class CheckParameterUtilTest {
    1515
    1616    /**
    1717     * Setup rule.
    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(CheckParameterUtil.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/tools/ColorHelperTest.java

    r16319 r17275  
    22package org.openstreetmap.josm.tools;
    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;
    88
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    1010
    1111/**
    1212 * Unit tests for class {@link ColorHelper}.
    1313 */
    14 public class ColorHelperTest {
     14class ColorHelperTest {
    1515
    1616    /**
     
    1818     */
    1919    @Test
    20     public void testHtml2color() {
     20    void testHtml2color() {
    2121        assertNull(ColorHelper.html2color(""));
    2222        assertNull(ColorHelper.html2color("xyz"));
     
    3333     */
    3434    @Test
    35     public void testColor2html() {
     35    void testColor2html() {
    3636        assertNull(ColorHelper.color2html(null));
    3737        assertEquals("#FF0000", ColorHelper.color2html(Color.RED));
     
    4646     */
    4747    @Test
    48     public void testGetForegroundColor() {
     48    void testGetForegroundColor() {
    4949        assertNull(ColorHelper.getForegroundColor(null));
    5050        assertEquals(Color.WHITE, ColorHelper.getForegroundColor(Color.BLACK));
     
    5959     */
    6060    @Test
    61     public void testColorFloat2int() {
     61    void testColorFloat2int() {
    6262        assertNull(ColorHelper.float2int(null));
    6363        assertEquals(255, (int) ColorHelper.float2int(-1.0f));
     
    7474     */
    7575    @Test
    76     public void testColorInt2float() {
     76    void testColorInt2float() {
    7777        assertNull(ColorHelper.int2float(null));
    7878        assertEquals(1.0f, ColorHelper.int2float(-1), 1e-3);
     
    8989     */
    9090    @Test
    91     public void testAlphaMultiply() {
     91    void testAlphaMultiply() {
    9292        final Color color = new Color(0x12345678, true);
    9393        assertEquals(new Color(0x12345678, true), ColorHelper.alphaMultiply(color, 1f));
     
    9999     */
    100100    @Test
    101     public void testComplement() {
     101    void testComplement() {
    102102        assertEquals(Color.cyan, ColorHelper.complement(Color.red));
    103103        assertEquals(Color.red, ColorHelper.complement(Color.cyan));
  • trunk/test/unit/org/openstreetmap/josm/tools/ColorScaleTest.java

    r9669 r17275  
    22package org.openstreetmap.josm.tools;
    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;
    88
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    1010
    1111/**
    1212 * Unit tests for class {@link ColorScale}.
    1313 */
    14 public class ColorScaleTest {
     14class ColorScaleTest {
    1515
    1616    /**
     
    1818     */
    1919    @Test
    20     public void testHSBScale() {
     20    void testHSBScale() {
    2121        final ColorScale scale = ColorScale.createHSBScale(256);
    2222        assertEquals(new Color(255, 0, 0), scale.getColor(0));
  • trunk/test/unit/org/openstreetmap/josm/tools/ExceptionUtilTest.java

    r16407 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
     
    1111import java.util.TimeZone;
    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.io.ChangesetClosedException;
    1717import org.openstreetmap.josm.io.IllegalDataException;
     
    3131 * Unit tests of {@link ExceptionUtil} class.
    3232 */
    33 public class ExceptionUtilTest {
     33class ExceptionUtilTest {
    3434
    3535    /**
    3636     * Setup rule.
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules().preferences().fakeAPI();
     
    4949     * @throws Exception in case of error
    5050     */
    51     @Before
     51    @BeforeEach
    5252    public void setUp() throws Exception {
    5353        OsmApi api = OsmApi.getOsmApi();
     
    6363     */
    6464    @Test
    65     public void testExplainBadRequest() {
     65    void testExplainBadRequest() {
    6666        assertEquals("<html>The OSM server '"+baseUrl+"' reported a bad request.<br></html>",
    6767                ExceptionUtil.explainBadRequest(new OsmApiException("")));
     
    9494     */
    9595    @Test
    96     public void testExplainBandwidthLimitExceeded() {
     96    void testExplainBandwidthLimitExceeded() {
    9797        assertEquals("<html>Communication with the OSM server '"+baseUrl+"'failed. "+
    9898                "The server replied<br>the following error code and the following error message:<br>"+
     
    105105     */
    106106    @Test
    107     public void testExplainChangesetClosedException() {
     107    void testExplainChangesetClosedException() {
    108108        assertEquals("<html>Failed to upload to changeset <strong>0</strong><br>because it has already been closed on ?.",
    109109                ExceptionUtil.explainChangesetClosedException(new ChangesetClosedException("")));
     
    117117     */
    118118    @Test
    119     public void testExplainClientTimeout() {
     119    void testExplainClientTimeout() {
    120120        assertEquals("<html>Communication with the OSM server '"+baseUrl+"' timed out. Please retry later.</html>",
    121121                ExceptionUtil.explainClientTimeout(new OsmApiException("")));
     
    126126     */
    127127    @Test
    128     public void testExplainConflict() {
     128    void testExplainConflict() {
    129129        int code = HttpURLConnection.HTTP_CONFLICT;
    130130        assertEquals("<html>The server reported that it has detected a conflict.</html>",
     
    146146     */
    147147    @Test
    148     public void testExplainException() {
     148    void testExplainException() {
    149149        assertEquals("ResponseCode=0",
    150150                ExceptionUtil.explainException(new OsmApiException("")));
     
    161161     */
    162162    @Test
    163     public void testExplainFailedAuthorisation() {
     163    void testExplainFailedAuthorisation() {
    164164        assertEquals("<html>Authorisation at the OSM server failed.<br>The server reported the following error:<br>"+
    165165                "'The server replied an error with code 0.'</html>",
     
    183183     */
    184184    @Test
    185     public void testExplainFailedOAuthAuthorisation() {
     185    void testExplainFailedOAuthAuthorisation() {
    186186        assertEquals("<html>Authorisation at the OSM server with the OAuth token 'null' failed.<br>"+
    187187                "The token is not authorised to access the protected resource<br>'unknown'.<br>"+
     
    198198     */
    199199    @Test
    200     public void testExplainFailedBasicAuthentication() {
     200    void testExplainFailedBasicAuthentication() {
    201201        assertEquals("<html>Authentication at the OSM server with the username '"+user+"' failed.<br>"+
    202202                "Please check the username and the password in the JOSM preferences.</html>",
     
    208208     */
    209209    @Test
    210     public void testExplainFailedOAuthAuthentication() {
     210    void testExplainFailedOAuthAuthentication() {
    211211        assertEquals("<html>Authentication at the OSM server with the OAuth token 'null' failed.<br>"+
    212212                "Please launch the preferences dialog and retrieve another OAuth token.</html>",
     
    218218     */
    219219    @Test
    220     public void testExplainGenericOsmApiException() {
     220    void testExplainGenericOsmApiException() {
    221221        assertEquals("<html>Communication with the OSM server '"+baseUrl+"'failed. The server replied<br>"+
    222222                "the following error code and the following error message:<br><strong>Error code:<strong> 0<br>"+
     
    239239     */
    240240    @Test
    241     public void testExplainGoneForUnknownPrimitive() {
     241    void testExplainGoneForUnknownPrimitive() {
    242242        assertEquals("<html>The server reports that an object is deleted.<br>"+
    243243                "<strong>Uploading failed</strong> if you tried to update or delete this object.<br> "+
     
    251251     */
    252252    @Test
    253     public void testExplainInternalServerError() {
     253    void testExplainInternalServerError() {
    254254        assertEquals("<html>The OSM server<br>'"+baseUrl+"'<br>reported an internal server error.<br>"+
    255255                "This is most likely a temporary problem. Please try again later.</html>",
     
    261261     */
    262262    @Test
    263     public void testExplainMissingOAuthAccessTokenException() {
     263    void testExplainMissingOAuthAccessTokenException() {
    264264        assertEquals("<html>Failed to authenticate at the OSM server 'http://fake.xxx/api'.<br>"+
    265265                "You are using OAuth to authenticate but currently there is no<br>OAuth Access Token configured.<br>"+
     
    272272     */
    273273    @Test
    274     public void testExplainNestedIllegalDataException() {
     274    void testExplainNestedIllegalDataException() {
    275275        assertEquals("<html>Failed to download data. Its format is either unsupported, ill-formed, and/or inconsistent.<br><br>"+
    276276                "Details (untranslated): null</html>",
     
    286286     */
    287287    @Test
    288     public void testExplainNestedIOException() {
     288    void testExplainNestedIOException() {
    289289        assertEquals("<html>Failed to upload data to or download data from<br>'"+baseUrl+"'<br>"+
    290290                "due to a problem with transferring data.<br>Details (untranslated): null</html>",
     
    300300     */
    301301    @Test
    302     public void testExplainNestedSocketException() {
     302    void testExplainNestedSocketException() {
    303303        assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'.<br>"+
    304304                "Please check your internet connection.</html>",
     
    310310     */
    311311    @Test
    312     public void testExplainNestedUnknownHostException() {
     312    void testExplainNestedUnknownHostException() {
    313313        assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'.<br>"+
    314314                "Host name '"+host+"' could not be resolved. <br>"+
     
    321321     */
    322322    @Test
    323     public void testExplainNotFound() {
     323    void testExplainNotFound() {
    324324        assertEquals("<html>The OSM server '"+baseUrl+"' does not know about an object<br>"+
    325325                "you tried to read, update, or delete. Either the respective object<br>"+
     
    333333     */
    334334    @Test
    335     public void testExplainOfflineAccessException() {
     335    void testExplainOfflineAccessException() {
    336336        assertEquals("<html>Failed to download data.<br><br>Details: null</html>",
    337337                ExceptionUtil.explainOfflineAccessException(new OsmApiException("")));
     
    344344     */
    345345    @Test
    346     public void testExplainOsmApiInitializationException() {
     346    void testExplainOsmApiInitializationException() {
    347347        assertEquals("<html>Failed to initialize communication with the OSM server "+serverUrl+".<br>"+
    348348                "Check the server URL in your preferences and your internet connection.</html>",
     
    354354     */
    355355    @Test
    356     public void testExplainOsmTransferException() {
     356    void testExplainOsmTransferException() {
    357357        assertEquals("<html>Failed to open a connection to the remote server<br>'"+baseUrl+"'<br>"+
    358358                "for security reasons. This is most likely because you are running<br>"+
     
    410410     */
    411411    @Test
    412     public void testExplainPreconditionFailed() {
     412    void testExplainPreconditionFailed() {
    413413        int code = HttpURLConnection.HTTP_PRECON_FAILED;
    414414        assertEquals("<html>Uploading to the server <strong>failed</strong> because your current<br>dataset violates a precondition.<br>"+
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.tools;
    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
    77import java.io.File;
     
    1212import java.util.Date;
    1313
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.coor.LatLon;
     
    2727 * @since 6209
    2828 */
    29 public class ExifReaderTest {
     29class ExifReaderTest {
    3030    /**
    3131     * Set the timezone and timeout.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    4040     * Setup test
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        directionSampleFile = new File("nodist/data/exif-example_direction.jpg");
     
    5151     */
    5252    @Test
    53     public void testReadTime() throws ParseException {
     53    void testReadTime() throws ParseException {
    5454        Date date = ExifReader.readTime(directionSampleFile);
    5555        doTest("2010-05-15T17:12:05.000", date);
     
    6161     */
    6262    @Test
    63     public void testReadTimeSubSecond1() throws ParseException {
     63    void testReadTimeSubSecond1() throws ParseException {
    6464        Date date = ExifReader.readTime(new File("nodist/data/IMG_20150711_193419.jpg"));
    6565        doTest("2015-07-11T19:34:19.100", date);
     
    7878     */
    7979    @Test
    80     public void testReadOrientation() {
     80    void testReadOrientation() {
    8181        Integer orientation = ExifReader.readOrientation(orientationSampleFile);
    8282        assertEquals(Integer.valueOf(6), orientation);
     
    8787     */
    8888    @Test
    89     public void testReadLatLon() {
     89    void testReadLatLon() {
    9090        LatLon latlon = ExifReader.readLatLon(directionSampleFile);
    9191        assertNotNull(latlon);
     
    9999     */
    100100    @Test
    101     public void testReadDirection() {
     101    void testReadDirection() {
    102102        assertEquals(Double.valueOf(46.5), ExifReader.readDirection(directionSampleFile));
    103103    }
     
    107107     */
    108108    @Test
    109     public void testReadSpeed() {
     109    void testReadSpeed() {
    110110        assertEquals(Double.valueOf(12.3), ExifReader.readSpeed(new File("nodist/data/exif-example_speed_ele.jpg")));
    111111    }
     
    115115     */
    116116    @Test
    117     public void testReadElevation() {
     117    void testReadElevation() {
    118118        assertEquals(Double.valueOf(23.4), ExifReader.readElevation(new File("nodist/data/exif-example_speed_ele.jpg")));
    119119    }
     
    124124     */
    125125    @Test
    126     public void testTicket11685() throws IOException {
     126    void testTicket11685() throws IOException {
    127127        doTestFile("2015-11-08T15:33:27.500", 11685, "2015-11-08_15-33-27-Xiaomi_YI-Y0030832.jpg");
    128128    }
     
    133133     */
    134134    @Test
    135     public void testTicket14209() throws IOException {
     135    void testTicket14209() throws IOException {
    136136        doTestFile("2017-01-16T18:27:00.000", 14209, "0MbEfj1S--.1.jpg");
    137137        doTestFile("2016-08-13T19:51:13.000", 14209, "7VWFOryj--.1.jpg");
  • trunk/test/unit/org/openstreetmap/josm/tools/FontsManagerTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    55
    66import java.awt.Font;
    77import java.awt.GraphicsEnvironment;
    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
     
    1717 * Unit tests of {@link FontsManager} class.
    1818 */
    19 public class FontsManagerTest {
     19class FontsManagerTest {
    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 testFontsManager() {
     32    void testFontsManager() {
    3333        FontsManager.initialize();
    3434        boolean found = false;
     
    4949     */
    5050    @Test
    51     public void testUtilityClass() throws ReflectiveOperationException {
     51    void testUtilityClass() throws ReflectiveOperationException {
    5252        UtilityClassTestUtil.assertUtilityClassWellDefined(FontsManager.class);
    5353    }
  • trunk/test/unit/org/openstreetmap/josm/tools/GeoUrlToBoundsTest.java

    r16618 r17275  
    55import static org.hamcrest.MatcherAssert.assertThat;
    66import static org.hamcrest.core.Is.is;
     7import static org.junit.jupiter.api.Assertions.assertThrows;
    78
    8 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    910
    1011/**
    1112 * Unit tests of {@link GeoUrlToBoundsTest} class.
    1213 */
    13 public class GeoUrlToBoundsTest {
     14class GeoUrlToBoundsTest {
    1415
    1516    /**
     
    1718     */
    1819    @Test
    19     public void testParse() {
     20    void testParse() {
    2021        assertThat(
    2122                GeoUrlToBounds.parse("geo:12.34,56.78?z=9"),
     
    2829     */
    2930    @Test
    30     public void testParseWithoutZoom() {
     31    void testParseWithoutZoom() {
    3132        assertThat(
    3233                GeoUrlToBounds.parse("geo:12.34,56.78"),
     
    4344     */
    4445    @Test
    45     public void testParseCrsUncertainty() {
     46    void testParseCrsUncertainty() {
    4647        assertThat(
    4748                GeoUrlToBounds.parse("geo:60.00000,17.000000;crs=wgs84"),
     
    6263     */
    6364    @Test
    64     public void testInvalid() {
     65    void testInvalid() {
    6566        assertThat(GeoUrlToBounds.parse("geo:foo"), nullValue());
    6667        assertThat(GeoUrlToBounds.parse("geo:foo,bar"), nullValue());
     
    7071     * Tests parsing null.
    7172     */
    72     @Test(expected = IllegalArgumentException.class)
    73     public void testNull() {
    74         GeoUrlToBounds.parse(null);
     73    @Test
     74    void testNull() {
     75        assertThrows(IllegalArgumentException.class, () -> GeoUrlToBounds.parse(null));
    7576    }
    7677}
  • trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java

    r15069 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotEquals;
    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.assertNotEquals;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.io.InputStream;
     
    1515
    1616import org.junit.Assert;
    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.EastNorth;
     
    3535 * Unit tests of {@link Geometry} class.
    3636 */
    37 public class GeometryTest {
     37class GeometryTest {
    3838    /**
    3939     * Primitives need preferences and projection.
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     
    4747     */
    4848    @Test
    49     public void testLineLineIntersection() {
     49    void testLineLineIntersection() {
    5050        EastNorth p1 = new EastNorth(-9477809.106349014, 1.5392960539974203E7);
    5151        EastNorth p2 = new EastNorth(-9477813.789091509, 1.5392954297092048E7);
     
    8181     */
    8282    @Test
    83     public void testClosedWayArea() throws Exception {
     83    void testClosedWayArea() throws Exception {
    8484        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm"))) {
    8585            DataSet ds = OsmReader.parseDataSet(in, null);
     
    9797     */
    9898    @Test
    99     public void testMultipolygonArea() throws Exception {
     99    void testMultipolygonArea() throws Exception {
    100100        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) {
    101101            DataSet ds = OsmReader.parseDataSet(in, null);
     
    112112     */
    113113    @Test
    114     public void testAreaAndPerimeter() throws Exception {
     114    void testAreaAndPerimeter() throws Exception {
    115115        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "create_multipolygon.osm"))) {
    116116            DataSet ds = OsmReader.parseDataSet(in, null);
     
    127127     */
    128128    @Test
    129     public void testRightAngle() {
     129    void testRightAngle() {
    130130        Node n1 = new Node(1);
    131131        Node n2 = new Node(2);
     
    159159     */
    160160    @Test
    161     public void testCentroidEN() {
     161    void testCentroidEN() {
    162162        EastNorth en1 = new EastNorth(100, 200);
    163163        EastNorth en2 = new EastNorth(150, 400);
     
    173173     */
    174174    @Test
    175     public void testPolygonIntersectionTriangles() {
     175    void testPolygonIntersectionTriangles() {
    176176        Node node1 = new Node(new LatLon(0.0, 1.0));
    177177        Node node2 = new Node(new LatLon(0.0, 2.0));
     
    204204     */
    205205    @Test
    206     public void testPolygonIntersectionVShapes() {
     206    void testPolygonIntersectionVShapes() {
    207207        Node node1 = new Node(new LatLon(1.0, 1.0));
    208208        Node node2 = new Node(new LatLon(2.0, 2.0));
     
    234234     */
    235235    @Test
    236     public void testIsPolygonInsideMultiPolygon() {
     236    void testIsPolygonInsideMultiPolygon() {
    237237        Node node1 = new Node(new LatLon(1.01, 1.0));
    238238        Node node2 = new Node(new LatLon(1.01, 1.1));
     
    268268     */
    269269    @Test
    270     public void testFilterInsideMultiPolygon() {
     270    void testFilterInsideMultiPolygon() {
    271271        Node node1 = new Node(new LatLon(1.01, 1.0));
    272272        Node node2 = new Node(new LatLon(1.01, 1.1));
     
    310310     */
    311311    @Test
    312     public void testGetDistance() {
     312    void testGetDistance() {
    313313        Node node1 = new Node(new LatLon(0, 0));
    314314        Node node2 = new Node(new LatLon(0.1, 1));
     
    361361     */
    362362    @Test
    363     public void testGetClosestPrimitive() {
     363    void testGetClosestPrimitive() {
    364364        Node node1 = new Node(new LatLon(0, 0));
    365365        Node node2 = new Node(new LatLon(0.1, 1));
     
    380380     */
    381381    @Test
    382     public void testGetFurthestPrimitive() {
     382    void testGetFurthestPrimitive() {
    383383        Node node1 = new Node(new LatLon(0, 0));
    384384        Node node2 = new Node(new LatLon(0, 1.1));
     
    407407     */
    408408    @Test
    409     public void testGetClosestWaySegment() {
     409    void testGetClosestWaySegment() {
    410410        Node node1 = new Node(new LatLon(0, 0));
    411411        Node node2 = new Node(new LatLon(0, 1));
     
    423423     */
    424424    @Test
    425     public void testGetDistanceSegmentSegment() {
     425    void testGetDistanceSegmentSegment() {
    426426        Node node1 = new Node(new LatLon(2.0, 2.0));
    427427        Node node2 = new Node(new LatLon(2.0, 3.0));
  • trunk/test/unit/org/openstreetmap/josm/tools/I18nTest.java

    r11404 r17275  
    22package org.openstreetmap.josm.tools;
    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 {@link I18n}.
    1010 */
    11 public class I18nTest {
     11class I18nTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testEscape() {
     17    void testEscape() {
    1818        String foobar = "{foo'bar}";
    1919        assertEquals("'{'foo''bar'}'", I18n.escape(foobar));
  • trunk/test/unit/org/openstreetmap/josm/tools/ImageResizeModeTest.java

    r17151 r17275  
    88import java.awt.Dimension;
    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 of {@link ImageResizeMode} class.
    1818 */
    19 public class ImageResizeModeTest {
     19class ImageResizeModeTest {
    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();
     
    3333     */
    3434    @Test
    35     public void testComputeDimensionAuto() {
     35    void testComputeDimensionAuto() {
    3636        assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.AUTO.computeDimension(new Dimension(0, 0), image));
    3737        assertEquals(new Dimension(64, 48), ImageResizeMode.AUTO.computeDimension(ImageResource.DEFAULT_DIMENSION, image));
     
    4747     */
    4848    @Test
    49     public void testComputeDimensionBounded() {
     49    void testComputeDimensionBounded() {
    5050        assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image));
    5151        assertEquals(new Dimension(64, 48), ImageResizeMode.BOUNDED.computeDimension(new Dimension(-1, -1), image));
     
    6868     */
    6969    @Test
    70     public void testComputeDimensionPadded() {
     70    void testComputeDimensionPadded() {
    7171        assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(new Dimension(0, 0), image));
    7272        assertThrows(IllegalArgumentException.class, () -> ImageResizeMode.PADDED.computeDimension(ImageResource.DEFAULT_DIMENSION, image));
     
    8282     */
    8383    @Test
    84     public void testCacheKey() {
     84    void testCacheKey() {
    8585        assertEquals(0x00180018, ImageResizeMode.AUTO.cacheKey(ImageProvider.ImageSizes.LARGEICON.getImageDimension()));
    8686        assertEquals(0x10180018, ImageResizeMode.BOUNDED.cacheKey(ImageProvider.ImageSizes.LARGEICON.getImageDimension()));
  • trunk/test/unit/org/openstreetmap/josm/tools/JosmDecimalFormatSymbolsProviderTest.java

    r17155 r17275  
    22package org.openstreetmap.josm.tools;
    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.junit.Assume.assumeTrue;
    77
     
    1010import java.util.stream.Stream;
    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.JOSMTestRules;
    1515
     
    1919 * Unit tests of {@link JosmDecimalFormatSymbolsProvider}.
    2020 */
    21 public class JosmDecimalFormatSymbolsProviderTest {
     21class JosmDecimalFormatSymbolsProviderTest {
    2222
    2323    /**
    2424     * Setup rule.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules();
    2929
    3030    @Test
    31     public void testGroupingSeparator() {
     31    void testGroupingSeparator() {
    3232        System.out.println(Locale.getDefault());
    3333        assumeTrue(Utils.getJavaVersion() >= 9);
     
    4747     */
    4848    @Test
    49     public void testParseDouble() {
     49    void testParseDouble() {
    5050        final Locale defLocale = Locale.getDefault();
    5151        try {
  • trunk/test/unit/org/openstreetmap/josm/tools/KeyboardUtilsTest.java

    r16643 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.awt.event.KeyEvent;
     
    1313import java.util.Map.Entry;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.testutils.JOSMTestRules;
    1818
     
    2222 * Unit tests of {@link KeyboardUtils} class.
    2323 */
    24 public class KeyboardUtilsTest {
     24class KeyboardUtilsTest {
    2525    /**
    2626     * Initializes test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules rules = new JOSMTestRules();
     
    3434     */
    3535    @Test
    36     public void testExtendedCharacters() {
     36    void testExtendedCharacters() {
    3737        Map<Integer, Character> map = new LinkedHashMap<>();
    3838        KeyboardUtils.addLatinCharacters(map);
     
    5555     */
    5656    @Test
    57     public void testGetCharactersForKeyE00() {
     57    void testGetCharactersForKeyE00() {
    5858        char deadCircumflex = (char) KeyEvent.VK_DEAD_CIRCUMFLEX;
    5959        char deadCaron = (char) KeyEvent.VK_DEAD_CARON;
  • trunk/test/unit/org/openstreetmap/josm/tools/LanguageInfoTest.java

    r15661 r17275  
    99
    1010import org.junit.Assert;
    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 {@link LanguageInfo}.
    1919 */
    20 public class LanguageInfoTest {
     20class LanguageInfoTest {
    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().i18n("ca@valencia");
     
    4242     */
    4343    @Test
    44     public void testWikiLanguagePrefix() {
     44    void testWikiLanguagePrefix() {
    4545        testGetWikiLanguagePrefixes(LanguageInfo.LocaleType.DEFAULT,
    4646                "En:", "De:", "Pt_BR:", "Ca-Valencia:", "Zh_CN:", "Zh_TW:", "Ast:", "En_GB:", "Ru:", "Nb:");
     
    6666     */
    6767    @Test
    68     public void testGetLocale() {
     68    void testGetLocale() {
    6969        Assert.assertEquals(RU, LanguageInfo.getLocale("ru"));
    7070        Assert.assertEquals(EN_GB, LanguageInfo.getLocale("en_GB"));
     
    7979     */
    8080    @Test
    81     public void testGetJOSMLocaleCode() {
     81    void testGetJOSMLocaleCode() {
    8282        Assert.assertEquals("de", LanguageInfo.getJOSMLocaleCode(DE_DE));
    8383        Assert.assertEquals("pt_BR", LanguageInfo.getJOSMLocaleCode(PT_BR));
     
    8989     */
    9090    @Test
    91     public void testGetJavaLocaleCode() {
     91    void testGetJavaLocaleCode() {
    9292        Assert.assertEquals("ca__valencia", LanguageInfo.getJavaLocaleCode("ca@valencia"));
    9393    }
     
    9797     */
    9898    @Test
    99     public void testGetLanguageCodeXML() {
     99    void testGetLanguageCodeXML() {
    100100        Assert.assertEquals("ca-valencia.", LanguageInfo.getLanguageCodeXML());
    101101    }
     
    105105     */
    106106    @Test
    107     public void testGetLanguageCodeManifest() {
     107    void testGetLanguageCodeManifest() {
    108108        Assert.assertEquals("ca-valencia_", LanguageInfo.getLanguageCodeManifest());
    109109    }
     
    113113     */
    114114    @Test
    115     public void testGetLanguageCodes() {
     115    void testGetLanguageCodes() {
    116116        Assert.assertEquals(Arrays.asList("ca_ES@valencia", "ca@valencia", "ca_ES", "ca"), LanguageInfo.getLanguageCodes(CA_ES_VALENCIA));
    117117    }
  • trunk/test/unit/org/openstreetmap/josm/tools/ListenableWeakReferenceTest.java

    r12181 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertFalse;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
    7 import static org.junit.Assert.assertSame;
    8 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    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
     
    1919 * @since 12181
    2020 */
    21 public class ListenableWeakReferenceTest {
     21class ListenableWeakReferenceTest {
    2222    /**
    2323     * Default test rules.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3434     */
    3535    @Test
    36     public void testOnDereference() throws InterruptedException {
     36    void testOnDereference() throws InterruptedException {
    3737        object = new Object();
    3838        called = false;
  • trunk/test/unit/org/openstreetmap/josm/tools/LoggingTest.java

    r16945 r17275  
    22package org.openstreetmap.josm.tools;
    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;
    99
    1010import java.io.IOException;
     
    1414import java.util.logging.LogRecord;
    1515
    16 import org.junit.After;
    17 import org.junit.Before;
    18 import org.junit.Test;
     16import org.junit.jupiter.api.AfterEach;
     17import org.junit.jupiter.api.BeforeEach;
     18import org.junit.jupiter.api.Test;
    1919
    2020import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    2424 *
    2525 */
    26 public class LoggingTest {
     26class LoggingTest {
    2727
    2828    private LogRecord captured;
     
    4646     * @throws SecurityException if a security error occurs
    4747     */
    48     @Before
     48    @BeforeEach
    4949    public void setUp() throws SecurityException {
    5050        captured = null;
     
    5555     * @throws SecurityException if a security error occurs
    5656     */
    57     @After
     57    @AfterEach
    5858    public void tearDown() throws SecurityException {
    5959        Logging.getLogger().removeHandler(handler);
     
    6464     */
    6565    @Test
    66     public void testSetLogLevel() {
     66    void testSetLogLevel() {
    6767        Logging.setLogLevel(Logging.LEVEL_DEBUG);
    6868        assertEquals(Logging.LEVEL_DEBUG, Logging.getLogger().getLevel());
     
    9595     */
    9696    @Test
    97     public void testErrorString() {
     97    void testErrorString() {
    9898        testLogCaptured(Logging.LEVEL_ERROR, "test", () -> Logging.error("test"));
    9999    }
     
    103103     */
    104104    @Test
    105     public void testErrorStringObjectArray() {
     105    void testErrorStringObjectArray() {
    106106        testLogCaptured(Logging.LEVEL_ERROR, "test x 1", () -> Logging.error("test {0} {1}", "x", 1));
    107107    }
     
    111111     */
    112112    @Test
    113     public void testWarnString() {
     113    void testWarnString() {
    114114        testLogCaptured(Logging.LEVEL_WARN, "test", () -> Logging.warn("test"));
    115115    }
     
    119119     */
    120120    @Test
    121     public void testWarnStringObjectArray() {
     121    void testWarnStringObjectArray() {
    122122        testLogCaptured(Logging.LEVEL_WARN, "test x 1", () -> Logging.warn("test {0} {1}", "x", 1));
    123123    }
     
    127127     */
    128128    @Test
    129     public void testInfoString() {
     129    void testInfoString() {
    130130        testLogCaptured(Logging.LEVEL_INFO, "test", () -> Logging.info("test"));
    131131    }
     
    135135     */
    136136    @Test
    137     public void testInfoStringObjectArray() {
     137    void testInfoStringObjectArray() {
    138138        testLogCaptured(Logging.LEVEL_INFO, "test x 1", () -> Logging.info("test {0} {1}", "x", 1));
    139139    }
     
    143143     */
    144144    @Test
    145     public void testDebugString() {
     145    void testDebugString() {
    146146        testLogCaptured(Logging.LEVEL_DEBUG, "test", () -> Logging.debug("test"));
    147147    }
     
    151151     */
    152152    @Test
    153     public void testDebugStringObjectArray() {
     153    void testDebugStringObjectArray() {
    154154        testLogCaptured(Logging.LEVEL_DEBUG, "test x 1", () -> Logging.debug("test {0} {1}", "x", 1));
    155155    }
     
    159159     */
    160160    @Test
    161     public void testTraceString() {
     161    void testTraceString() {
    162162        testLogCaptured(Logging.LEVEL_TRACE, "test", () -> Logging.trace("test"));
    163163    }
     
    167167     */
    168168    @Test
    169     public void testTraceStringObjectArray() {
     169    void testTraceStringObjectArray() {
    170170        testLogCaptured(Logging.LEVEL_TRACE, "test x 1", () -> Logging.trace("test {0} {1}", "x", 1));
    171171    }
     
    175175     */
    176176    @Test
    177     public void testLogLevelThrowable() {
     177    void testLogLevelThrowable() {
    178178        testLogCaptured(Logging.LEVEL_ERROR, "java.io.IOException: x", () -> Logging.log(Logging.LEVEL_ERROR, new IOException("x")));
    179179
     
    185185     */
    186186    @Test
    187     public void testLogLevelStringThrowable() {
     187    void testLogLevelStringThrowable() {
    188188        testLogCaptured(Logging.LEVEL_ERROR, "y: java.io.IOException: x", () -> Logging.log(Logging.LEVEL_ERROR, "y", new IOException("x")));
    189189
     
    195195     */
    196196    @Test
    197     public void testLogWithStackTraceLevelThrowable() {
     197    void testLogWithStackTraceLevelThrowable() {
    198198        Consumer<String> test = string -> {
    199199            assertTrue(string.startsWith("java.io.IOException: x"));
     
    215215     */
    216216    @Test
    217     public void testLogWithStackTraceLevelStringThrowable() {
     217    void testLogWithStackTraceLevelStringThrowable() {
    218218        Consumer<String> test = string -> {
    219219            assertTrue(string.startsWith("y: java.io.IOException: x"));
     
    228228     */
    229229    @Test
    230     public void testIsLoggingEnabled() {
     230    void testIsLoggingEnabled() {
    231231        Logging.setLogLevel(Logging.LEVEL_ERROR);
    232232        assertTrue(Logging.isLoggingEnabled(Logging.LEVEL_ERROR));
     
    247247     */
    248248    @Test
    249     public void testClearLastErrorAndWarnings() {
     249    void testClearLastErrorAndWarnings() {
    250250        Logging.setLogLevel(Logging.LEVEL_WARN);
    251251        Logging.clearLastErrorAndWarnings();
     
    261261     */
    262262    @Test
    263     public void testGetLastErrorAndWarnings() {
     263    void testGetLastErrorAndWarnings() {
    264264        Logging.setLogLevel(Logging.LEVEL_WARN);
    265265        Logging.clearLastErrorAndWarnings();
     
    267267
    268268        assertEquals(1, Logging.getLastErrorAndWarnings().size());
    269         assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"));
     269        assertTrue(Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"), Logging.getLastErrorAndWarnings()::toString);
    270270
    271271        Logging.setLogLevel(Logging.LEVEL_ERROR);
     
    277277
    278278        assertEquals(2, Logging.getLastErrorAndWarnings().size());
    279         assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"));
    280         assertTrue(Logging.getLastErrorAndWarnings().toString(), Logging.getLastErrorAndWarnings().get(1).endsWith("E: y"));
     279        assertTrue(Logging.getLastErrorAndWarnings().get(0).endsWith("W: x"), Logging.getLastErrorAndWarnings()::toString);
     280        assertTrue(Logging.getLastErrorAndWarnings().get(1).endsWith("E: y"), Logging.getLastErrorAndWarnings()::toString);
    281281
    282282        // limit somewhere reasonable
  • trunk/test/unit/org/openstreetmap/josm/tools/MediawikiTest.java

    r16988 r17275  
    22package org.openstreetmap.josm.tools;
    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 {@link Mediawiki}.
    1010 */
    11 public class MediawikiTest {
     11class MediawikiTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testImageUrl() {
     17    void testImageUrl() {
    1818        assertEquals("https://upload.wikimedia.org/wikipedia/commons/1/18/OpenJDK_logo.svg",
    1919                Mediawiki.getImageUrl("https://upload.wikimedia.org/wikipedia/commons", "OpenJDK_logo.svg"));
  • trunk/test/unit/org/openstreetmap/josm/tools/MemoryManagerTest.java

    r10717 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertSame;
    7 import static org.junit.Assert.assertTrue;
    8 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.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
    910
    1011import java.util.List;
    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;
    1516import org.openstreetmap.josm.tools.MemoryManager.MemoryHandle;
     
    2627     * Base test environment
    2728     */
    28     @Rule
     29    @RegisterExtension
    2930    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3031    public JOSMTestRules test = new JOSMTestRules().memoryManagerLeaks();
     
    3536     */
    3637    @Test
    37     public void testUseMemory() throws NotEnoughMemoryException {
     38    void testUseMemory() throws NotEnoughMemoryException {
    3839        MemoryManager manager = MemoryManager.getInstance();
    3940        long available = manager.getAvailableMemory();
     
    5960     * @throws NotEnoughMemoryException if there is not enough memory
    6061     */
    61     @Test(expected = IllegalStateException.class)
    62     public void testUseAfterFree() throws NotEnoughMemoryException {
     62    @Test
     63    void testUseAfterFree() throws NotEnoughMemoryException {
    6364        MemoryManager manager = MemoryManager.getInstance();
    6465        MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new);
    6566        testMemory.free();
    66         testMemory.get();
     67        assertThrows(IllegalStateException.class, () -> testMemory.get());
    6768    }
    6869
     
    7172     * @throws NotEnoughMemoryException if there is not enough memory
    7273     */
    73     @Test(expected = IllegalStateException.class)
    74     public void testFreeAfterFree() throws NotEnoughMemoryException {
     74    @Test
     75    void testFreeAfterFree() throws NotEnoughMemoryException {
    7576        MemoryManager manager = MemoryManager.getInstance();
    7677        MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new);
    7778        testMemory.free();
    78         testMemory.free();
     79        assertThrows(IllegalStateException.class, () -> testMemory.free());
    7980    }
    8081
     
    8384     * @throws NotEnoughMemoryException always
    8485     */
    85     @Test(expected = NotEnoughMemoryException.class)
    86     public void testAllocationFails() throws NotEnoughMemoryException {
     86    @Test
     87    void testAllocationFails() throws NotEnoughMemoryException {
    8788        MemoryManager manager = MemoryManager.getInstance();
    8889        long available = manager.getAvailableMemory();
    8990
    90         manager.allocateMemory("test", available + 1, () -> {
     91        assertThrows(NotEnoughMemoryException.class, () -> manager.allocateMemory("test", available + 1, () -> {
    9192            fail("Should not reach");
    9293            return null;
    93         });
     94        }));
    9495    }
    9596
     
    9899     * @throws NotEnoughMemoryException never
    99100     */
    100     @Test(expected = IllegalArgumentException.class)
    101     public void testSupplierFails() throws NotEnoughMemoryException {
     101    @Test
     102    void testSupplierFails() throws NotEnoughMemoryException {
    102103        MemoryManager manager = MemoryManager.getInstance();
    103104
    104         manager.allocateMemory("test", 1, () -> null);
     105        assertThrows(IllegalArgumentException.class, () -> manager.allocateMemory("test", 1, () -> null));
    105106    }
    106107
     
    109110     */
    110111    @Test
    111     public void testIsAvailable() {
     112    void testIsAvailable() {
    112113        MemoryManager manager = MemoryManager.getInstance();
    113114        assertTrue(manager.isAvailable(10));
     
    120121     * @throws NotEnoughMemoryException never
    121122     */
    122     @Test(expected = IllegalArgumentException.class)
    123     public void testIsAvailableFails() throws NotEnoughMemoryException {
     123    @Test
     124    void testIsAvailableFails() throws NotEnoughMemoryException {
    124125        MemoryManager manager = MemoryManager.getInstance();
    125126
    126         manager.isAvailable(-10);
     127        assertThrows(IllegalArgumentException.class, () -> manager.isAvailable(-10));
    127128    }
    128129
     
    132133     */
    133134    @Test
    134     public void testResetState() throws NotEnoughMemoryException {
     135    void testResetState() throws NotEnoughMemoryException {
    135136        MemoryManager manager = MemoryManager.getInstance();
    136137        assertTrue(manager.resetState().isEmpty());
     
    147148     * @throws NotEnoughMemoryException if there is not enough memory
    148149     */
    149     @Test(expected = IllegalStateException.class)
    150     public void testResetStateUseAfterFree() throws NotEnoughMemoryException {
     150    @Test
     151    void testResetStateUseAfterFree() throws NotEnoughMemoryException {
    151152        MemoryManager manager = MemoryManager.getInstance();
    152153        MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new);
    153154
    154155        assertFalse(manager.resetState().isEmpty());
    155         testMemory.get();
     156        assertThrows(IllegalStateException.class, () -> testMemory.get());
    156157    }
    157158
     
    163164        List<MemoryHandle<?>> hadLeaks = MemoryManager.getInstance().resetState();
    164165        if (!allowMemoryManagerLeaks) {
    165             assertTrue("Memory manager had leaking memory: " + hadLeaks, hadLeaks.isEmpty());
     166            assertTrue(hadLeaks.isEmpty(), "Memory manager had leaking memory: " + hadLeaks);
    166167        }
    167168    }
  • trunk/test/unit/org/openstreetmap/josm/tools/MultiMapTest.java

    r15870 r17275  
    22package org.openstreetmap.josm.tools;
    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;
     
    1313import java.util.Set;
    1414
    15 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
    1616import org.openstreetmap.josm.TestUtils;
    1717
     
    2121 * Unit tests of {@link MultiMap} class.
    2222 */
    23 public class MultiMapTest {
     23class MultiMapTest {
    2424
    2525    /**
     
    2727     */
    2828    @Test
    29     public void testEqualsContract() {
     29    void testEqualsContract() {
    3030        TestUtils.assumeWorkingEqualsVerifier();
    3131        EqualsVerifier.forClass(MultiMap.class).usingGetClass().verify();
     
    3636     */
    3737    @Test
    38     public void testMultiMap() {
     38    void testMultiMap() {
    3939        final MultiMap<String, String> map = new MultiMap<>();
    4040        assertTrue(map.isEmpty());
  • trunk/test/unit/org/openstreetmap/josm/tools/OptionParserTest.java

    r16618 r17275  
    22package org.openstreetmap.josm.tools;
    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;
    77import static org.junit.jupiter.api.Assertions.assertThrows;
    88
     
    1313import java.util.concurrent.atomic.AtomicReference;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.testutils.JOSMTestRules;
    1818import org.openstreetmap.josm.tools.OptionParser.OptionCount;
     
    2525 * @author Michael Zangl
    2626 */
    27 public class OptionParserTest {
     27class OptionParserTest {
    2828    /**
    2929     * Setup test.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules test = new JOSMTestRules().i18n();
     
    3535    // A reason for moving to jupiter...
    3636    @Test
    37     public void testEmptyParserRejectsLongopt() {
     37    void testEmptyParserRejectsLongopt() {
    3838        Exception e = assertThrows(OptionParseException.class, () ->
    3939                new OptionParser("test").parseOptions(Arrays.asList("--long")));
     
    4242
    4343    @Test
    44     public void testEmptyParserRejectsShortopt() {
     44    void testEmptyParserRejectsShortopt() {
    4545        Exception e = assertThrows(OptionParseException.class, () ->
    4646                new OptionParser("test").parseOptions(Arrays.asList("-s")));
     
    4949
    5050    @Test
    51     public void testParserRejectsWrongShortopt() {
     51    void testParserRejectsWrongShortopt() {
    5252        Exception e = assertThrows(OptionParseException.class, () ->
    5353                new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "t")
     
    5757
    5858    @Test
    59     public void testParserRejectsWrongLongopt() {
     59    void testParserRejectsWrongLongopt() {
    6060        Exception e = assertThrows(OptionParseException.class, () ->
    6161                new OptionParser("test").addFlagParameter("test", this::nop).parseOptions(Arrays.asList("--wrong")));
     
    6464
    6565    @Test
    66     public void testParserOption() {
     66    void testParserOption() {
    6767        AtomicReference<String> argFound = new AtomicReference<>();
    6868        OptionParser parser = new OptionParser("test")
     
    7474
    7575    @Test
    76     public void testParserOptionFailsIfMissing() {
     76    void testParserOptionFailsIfMissing() {
    7777        AtomicReference<String> argFound = new AtomicReference<>();
    7878        OptionParser parser = new OptionParser("test")
     
    8484
    8585    @Test
    86     public void testParserOptionFailsIfMissingArgument() {
     86    void testParserOptionFailsIfMissingArgument() {
    8787        AtomicReference<String> argFound = new AtomicReference<>();
    8888        OptionParser parser = new OptionParser("test")
     
    9494
    9595    @Test
    96     public void testParserOptionFailsIfMissing2() {
     96    void testParserOptionFailsIfMissing2() {
    9797        AtomicReference<String> argFound = new AtomicReference<>();
    9898        OptionParser parser = new OptionParser("test")
     
    104104
    105105    @Test
    106     public void testParserOptionFailsIfTwice() {
     106    void testParserOptionFailsIfTwice() {
    107107        AtomicReference<String> argFound = new AtomicReference<>();
    108108        OptionParser parser = new OptionParser("test")
     
    114114
    115115    @Test
    116     public void testParserOptionFailsIfTwiceForAlias() {
     116    void testParserOptionFailsIfTwiceForAlias() {
    117117        AtomicReference<String> argFound = new AtomicReference<>();
    118118        OptionParser parser = new OptionParser("test")
     
    125125
    126126    @Test
    127     public void testOptionalOptionFailsIfTwice() {
     127    void testOptionalOptionFailsIfTwice() {
    128128        OptionParser parser = new OptionParser("test")
    129129                .addFlagParameter("test", this::nop);
     
    133133
    134134    @Test
    135     public void testOptionalOptionFailsIfTwiceForAlias() {
     135    void testOptionalOptionFailsIfTwiceForAlias() {
    136136        OptionParser parser = new OptionParser("test")
    137137                .addFlagParameter("test", this::nop)
     
    142142
    143143    @Test
    144     public void testOptionalOptionFailsIfTwiceForAlias2() {
     144    void testOptionalOptionFailsIfTwiceForAlias2() {
    145145        OptionParser parser = new OptionParser("test")
    146146                .addFlagParameter("test", this::nop)
     
    151151
    152152    @Test
    153     public void testLongArgumentsUsingEqualSign() {
     153    void testLongArgumentsUsingEqualSign() {
    154154        AtomicReference<String> argFound = new AtomicReference<>();
    155155        OptionParser parser = new OptionParser("test")
     
    173173
    174174    @Test
    175     public void testLongArgumentsMissingOption() {
     175    void testLongArgumentsMissingOption() {
    176176        OptionParser parser = new OptionParser("test")
    177177                .addArgumentParameter("test", OptionCount.REQUIRED, this::nop);
     
    182182
    183183    @Test
    184     public void testLongArgumentsMissingOption2() {
     184    void testLongArgumentsMissingOption2() {
    185185        OptionParser parser = new OptionParser("test")
    186186                .addArgumentParameter("test", OptionCount.REQUIRED, this::nop);
     
    191191
    192192    @Test
    193     public void testShortArgumentsMissingOption() {
     193    void testShortArgumentsMissingOption() {
    194194        OptionParser parser = new OptionParser("test")
    195195                .addArgumentParameter("test", OptionCount.REQUIRED, this::nop)
     
    201201
    202202    @Test
    203     public void testShortArgumentsMissingOption2() {
     203    void testShortArgumentsMissingOption2() {
    204204        OptionParser parser = new OptionParser("test")
    205205                .addArgumentParameter("test", OptionCount.REQUIRED, this::nop)
     
    211211
    212212    @Test
    213     public void testLongFlagHasOption() {
     213    void testLongFlagHasOption() {
    214214        OptionParser parser = new OptionParser("test")
    215215                .addFlagParameter("test", this::nop);
     
    220220
    221221    @Test
    222     public void testShortFlagHasOption() {
     222    void testShortFlagHasOption() {
    223223        OptionParser parser = new OptionParser("test")
    224224                .addFlagParameter("test", this::nop)
     
    230230
    231231    @Test
    232     public void testShortArgumentsUsingEqualSign() {
     232    void testShortArgumentsUsingEqualSign() {
    233233        AtomicReference<String> argFound = new AtomicReference<>();
    234234        OptionParser parser = new OptionParser("test")
     
    243243
    244244    @Test
    245     public void testMultipleArguments() {
     245    void testMultipleArguments() {
    246246        AtomicReference<String> argFound = new AtomicReference<>();
    247247        List<String> multiFound = new ArrayList<>();
     
    266266
    267267    @Test
    268     public void testUseAlternatives() {
     268    void testUseAlternatives() {
    269269        AtomicReference<String> argFound = new AtomicReference<>();
    270270        AtomicBoolean usedFlag = new AtomicBoolean();
     
    285285
    286286    @Test
    287     public void testAmbiguousAlternatives() {
     287    void testAmbiguousAlternatives() {
    288288        AtomicReference<String> argFound = new AtomicReference<>();
    289289        AtomicBoolean usedFlag = new AtomicBoolean();
     
    300300
    301301    @Test
    302     public void testMultipleShort() {
     302    void testMultipleShort() {
    303303        AtomicReference<String> argFound = new AtomicReference<>();
    304304        AtomicBoolean usedFlag = new AtomicBoolean();
     
    328328
    329329    @Test
    330     public void testIllegalOptionName() {
     330    void testIllegalOptionName() {
    331331        Exception e = assertThrows(IllegalArgumentException.class, () ->
    332332                new OptionParser("test").addFlagParameter("", this::nop));
     
    335335
    336336    @Test
    337     public void testIllegalOptionName2() {
     337    void testIllegalOptionName2() {
    338338        Exception e = assertThrows(IllegalArgumentException.class, () ->
    339339                new OptionParser("test").addFlagParameter("-", this::nop));
     
    342342
    343343    @Test
    344     public void testIllegalOptionName3() {
     344    void testIllegalOptionName3() {
    345345        Exception e = assertThrows(IllegalArgumentException.class, () ->
    346346                new OptionParser("test").addFlagParameter("-test", this::nop));
     
    349349
    350350    @Test
    351     public void testIllegalOptionName4() {
     351    void testIllegalOptionName4() {
    352352        Exception e = assertThrows(IllegalArgumentException.class, () ->
    353353                new OptionParser("test").addFlagParameter("$", this::nop));
     
    356356
    357357    @Test
    358     public void testDuplicateOptionName() {
     358    void testDuplicateOptionName() {
    359359        Exception e = assertThrows(IllegalArgumentException.class, () ->
    360360                new OptionParser("test").addFlagParameter("test", this::nop).addFlagParameter("test", this::nop));
     
    363363
    364364    @Test
    365     public void testDuplicateOptionName2() {
     365    void testDuplicateOptionName2() {
    366366        Exception e = assertThrows(IllegalArgumentException.class, () ->
    367367                new OptionParser("test").addFlagParameter("test", this::nop)
     
    371371
    372372    @Test
    373     public void testInvalidShortAlias() {
     373    void testInvalidShortAlias() {
    374374        Exception e = assertThrows(IllegalArgumentException.class, () ->
    375375                new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "$"));
     
    378378
    379379    @Test
    380     public void testInvalidShortAlias2() {
     380    void testInvalidShortAlias2() {
    381381        Exception e = assertThrows(IllegalArgumentException.class, () ->
    382382                new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", ""));
     
    385385
    386386    @Test
    387     public void testInvalidShortAlias3() {
     387    void testInvalidShortAlias3() {
    388388        Exception e = assertThrows(IllegalArgumentException.class, () ->
    389389                new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test", "xx"));
     
    392392
    393393    @Test
    394     public void testDuplicateShortAlias() {
     394    void testDuplicateShortAlias() {
    395395        Exception e = assertThrows(IllegalArgumentException.class, () ->
    396396                new OptionParser("test").addFlagParameter("test", this::nop)
     
    402402
    403403    @Test
    404     public void testInvalidShortNoLong() {
     404    void testInvalidShortNoLong() {
    405405        Exception e = assertThrows(IllegalArgumentException.class, () ->
    406406                new OptionParser("test").addFlagParameter("test", this::nop).addShortAlias("test2", "t"));
  • trunk/test/unit/org/openstreetmap/josm/tools/OsmPrimitiveImageProviderTest.java

    r16946 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    5 import org.junit.BeforeClass;
    6 import org.junit.Rule;
    7 import org.junit.Test;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7
     8import java.awt.Dimension;
     9import java.util.EnumSet;
     10
     11import javax.swing.ImageIcon;
     12
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    816import org.openstreetmap.josm.JOSMFixture;
    917import org.openstreetmap.josm.data.osm.Node;
     
    1422import org.openstreetmap.josm.tools.OsmPrimitiveImageProvider.Options;
    1523
    16 import java.awt.Dimension;
    17 import java.util.EnumSet;
    18 
    19 import static org.junit.Assert.assertEquals;
    20 import static org.junit.Assert.assertNotNull;
    21 import static org.junit.Assert.assertNull;
    22 
    23 import javax.swing.ImageIcon;
     24import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2425
    2526/**
    2627 * Unit tests of {@link OsmPrimitiveImageProvider}
    2728 */
    28 public class OsmPrimitiveImageProviderTest {
     29class OsmPrimitiveImageProviderTest {
    2930
    3031    /**
    3132     * Setup test.
    3233     */
    33     @Rule
     34    @RegisterExtension
    3435    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3536    public JOSMTestRules test = new JOSMTestRules().mapStyles().presets();
     
    3839     * Setup test.
    3940     */
    40     @BeforeClass
     41    @BeforeAll
    4142    public static void setUp() {
    4243        JOSMFixture.createUnitTestFixture().init();
     
    4748     */
    4849    @Test
    49     public void testGetResource() {
     50    void testGetResource() {
    5051        TaggingPresetsTest.waitForIconLoading(TaggingPresets.getTaggingPresets());
    5152
     
    6768     */
    6869    @Test
    69     public void testGetResourceNonSquare() {
     70    void testGetResourceNonSquare() {
    7071        final ImageIcon bankIcon = OsmPrimitiveImageProvider
    7172                .getResource(OsmUtils.createPrimitive("node amenity=bank"), Options.DEFAULT)
  • trunk/test/unit/org/openstreetmap/josm/tools/OsmUrlToBoundsTest.java

    r12802 r17275  
    33
    44import org.junit.Assert;
    5 import org.junit.Rule;
    6 import org.junit.Test;
     5import org.junit.jupiter.api.extension.RegisterExtension;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.data.Bounds;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1313  * Unit tests of {@link OsmUrlToBounds} class.
    1414*/
    15 public class OsmUrlToBoundsTest {
     15class OsmUrlToBoundsTest {
    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 testPositionToBounds() {
     28    void testPositionToBounds() {
    2929        Assert.assertEquals(new Bounds(51.7167359, 8.7573485, 51.720724, 8.7659315),
    3030                OsmUrlToBounds.positionToBounds(51.71873, 8.76164, 17));
     
    9191     */
    9292    @Test
    93     public void testParse() {
     93    void testParse() {
    9494        for (ParseTestItem item : parseTestData) {
    9595            Bounds bounds = null;
     
    108108     */
    109109    @Test
    110     public void testGetZoom() {
     110    void testGetZoom() {
    111111        Assert.assertEquals(4, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(0, 0, 4)));
    112112        Assert.assertEquals(10, OsmUrlToBounds.getZoom(OsmUrlToBounds.positionToBounds(5, 5, 10)));
  • trunk/test/unit/org/openstreetmap/josm/tools/PairTest.java

    r13079 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import org.junit.Test;
     4import org.junit.jupiter.api.Test;
    55import org.openstreetmap.josm.TestUtils;
    66
     
    1111 * Unit tests of {@link Pair} class.
    1212 */
    13 public class PairTest {
     13class PairTest {
    1414
    1515    /**
     
    1717     */
    1818    @Test
    19     public void testEqualsContract() {
     19    void testEqualsContract() {
    2020        TestUtils.assumeWorkingEqualsVerifier();
    2121        EqualsVerifier.forClass(Pair.class).suppress(Warning.NONFINAL_FIELDS).verify();
  • trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookOsxTest.java

    r15469 r17275  
    22package org.openstreetmap.josm.tools;
    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;
     8import static org.junit.jupiter.api.Assumptions.assumeTrue;
    89
    910import java.io.File;
    1011import java.io.IOException;
    1112
    12 import org.junit.Assume;
    13 import org.junit.BeforeClass;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.JOSMFixture;
    1616import org.openstreetmap.josm.spi.preferences.Config;
     
    1919 * Unit tests of {@link PlatformHookOsx} class.
    2020 */
    21 public class PlatformHookOsxTest {
     21class PlatformHookOsxTest {
    2222
    2323    static PlatformHookOsx hook;
     
    2626     * Setup test.
    2727     */
    28     @BeforeClass
     28    @BeforeAll
    2929    public static void setUp() {
    3030        JOSMFixture.createUnitTestFixture().init();
     
    3636     */
    3737    @Test
    38     public void testStartupHook() {
     38    void testStartupHook() {
    3939        hook.startupHook((a, b, c, d) -> System.out.println("callback"));
    4040    }
     
    4444     */
    4545    @Test
    46     public void testAfterPrefStartupHook() {
     46    void testAfterPrefStartupHook() {
    4747        hook.afterPrefStartupHook();
    4848    }
     
    5353     */
    5454    @Test
    55     public void testOpenUrl() throws IOException {
    56         Assume.assumeTrue(PlatformManager.isPlatformOsx());
     55    void testOpenUrl() throws IOException {
     56        assumeTrue(PlatformManager.isPlatformOsx());
    5757        hook.openUrl(Config.getUrls().getJOSMWebsite());
    5858    }
     
    6262     */
    6363    @Test
    64     public void testGetDefaultCacheDirectory() {
     64    void testGetDefaultCacheDirectory() {
    6565        File cache = hook.getDefaultCacheDirectory();
    6666        assertNotNull(cache);
     
    7474     */
    7575    @Test
    76     public void testGetDefaultPrefDirectory() {
     76    void testGetDefaultPrefDirectory() {
    7777        File cache = hook.getDefaultPrefDirectory();
    7878        assertNotNull(cache);
     
    8686     */
    8787    @Test
    88     public void testGetDefaultStyle() {
     88    void testGetDefaultStyle() {
    8989        assertEquals("com.apple.laf.AquaLookAndFeel", hook.getDefaultStyle());
    9090    }
     
    9494     */
    9595    @Test
    96     public void testGetOSDescription() {
     96    void testGetOSDescription() {
    9797        String os = hook.getOSDescription();
    9898        if (PlatformManager.isPlatformOsx()) {
     
    107107     */
    108108    @Test
    109     public void testInitSystemShortcuts() {
     109    void testInitSystemShortcuts() {
    110110        hook.initSystemShortcuts();
    111111    }
  • trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookTestIT.java

    r15480 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.StringReader;
     
    1010import javax.json.Json;
    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.JOSMTestRules;
    1515
     
    1919 * Integration tests of {@link PlatformHook} class.
    2020 */
    21 public class PlatformHookTestIT {
     21class PlatformHookTestIT {
    2222
    2323    /**
    2424     * Setup rule
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules();
     
    3333     */
    3434    @Test
    35     public void testLatestUbuntuVersion() throws Exception {
     35    void testLatestUbuntuVersion() throws Exception {
    3636        String latestUbuntuVersion = Json.createReader(new StringReader(HttpClient.create(
    3737                new URL("https://api.launchpad.net/devel/ubuntu/series")).connect().fetchContent()))
    3838                .readObject().getJsonArray("entries").getJsonObject(0).getString("name");
    39         assertEquals(latestUbuntuVersion, HttpURLConnection.HTTP_OK, HttpClient.create(
    40                 new URL("https://josm.openstreetmap.de/apt/dists/" + latestUbuntuVersion + '/')).connect().getResponseCode());
     39        assertEquals(HttpURLConnection.HTTP_OK, HttpClient.create(
     40                new URL("https://josm.openstreetmap.de/apt/dists/" + latestUbuntuVersion + '/')).connect().getResponseCode(),
     41                latestUbuntuVersion);
    4142    }
    4243}
  • trunk/test/unit/org/openstreetmap/josm/tools/PlatformHookWindowsTest.java

    r17126 r17275  
    3030 * Unit tests of {@link PlatformHookWindows} class.
    3131 */
    32 public class PlatformHookWindowsTest {
     32class PlatformHookWindowsTest {
    3333
    3434    /**
     
    5353     */
    5454    @Test
    55     public void testStartupHook() {
     55    void testStartupHook() {
    5656        hook.startupHook((a, b, c, d) -> System.out.println("callback"));
    5757    }
     
    6262     */
    6363    @Test
    64     public void testGetRootKeystore() throws Exception {
     64    void testGetRootKeystore() throws Exception {
    6565        if (PlatformManager.isPlatformWindows()) {
    6666            assertNotNull(PlatformHookWindows.getRootKeystore());
     
    7979     */
    8080    @Test
    81     public void testAfterPrefStartupHook() {
     81    void testAfterPrefStartupHook() {
    8282        hook.afterPrefStartupHook();
    8383    }
     
    8989     */
    9090    @Test
    91     public void testOpenUrlSuccess(@Mocked final Desktop mockDesktop) throws IOException {
     91    void testOpenUrlSuccess(@Mocked final Desktop mockDesktop) throws IOException {
    9292        TestUtils.assumeWorkingJMockit();
    9393        new Expectations() {{
     
    107107     */
    108108    @Test
    109     public void testOpenUrlFallback(@Mocked final Desktop mockDesktop, @Mocked Runtime anyRuntime) throws IOException {
     109    void testOpenUrlFallback(@Mocked final Desktop mockDesktop, @Mocked Runtime anyRuntime) throws IOException {
    110110        TestUtils.assumeWorkingJMockit();
    111111        new Expectations() {{
     
    130130     */
    131131    @Test
    132     public void testGetAdditionalFonts() {
     132    void testGetAdditionalFonts() {
    133133        assertFalse(hook.getAdditionalFonts().isEmpty());
    134134    }
     
    138138     */
    139139    @Test
    140     public void testGetDefaultCacheDirectory() {
     140    void testGetDefaultCacheDirectory() {
    141141        File cache = hook.getDefaultCacheDirectory();
    142142        assertNotNull(cache);
     
    150150     */
    151151    @Test
    152     public void testGetDefaultPrefDirectory() {
     152    void testGetDefaultPrefDirectory() {
    153153        File cache = hook.getDefaultPrefDirectory();
    154154        assertNotNull(cache);
     
    162162     */
    163163    @Test
    164     public void testGetDefaultStyle() {
     164    void testGetDefaultStyle() {
    165165        assertEquals("com.sun.java.swing.plaf.windows.WindowsLookAndFeel", hook.getDefaultStyle());
    166166    }
     
    170170     */
    171171    @Test
    172     public void testGetInstalledFonts() {
     172    void testGetInstalledFonts() {
    173173        Collection<String> fonts = hook.getInstalledFonts();
    174174        if (PlatformManager.isPlatformWindows()) {
     
    183183     */
    184184    @Test
    185     public void testGetOSDescription() {
     185    void testGetOSDescription() {
    186186        String os = hook.getOSDescription();
    187187        if (PlatformManager.isPlatformWindows()) {
     
    196196     */
    197197    @Test
    198     public void testInitSystemShortcuts() {
     198    void testInitSystemShortcuts() {
    199199        hook.initSystemShortcuts();
    200200    }
  • trunk/test/unit/org/openstreetmap/josm/tools/RightAndLefthandTrafficTest.java

    r16321 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.fail;
    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.testutils.JOSMTestRules;
     
    1515 * Unit tests of {@link RightAndLefthandTraffic} class.
    1616 */
    17 public class RightAndLefthandTrafficTest {
     17class RightAndLefthandTrafficTest {
    1818    /**
    1919     * Test rules.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules rules = new JOSMTestRules().projection().territories();
     
    2828     */
    2929    @Test
    30     public void testUtilityClass() throws ReflectiveOperationException {
     30    void testUtilityClass() throws ReflectiveOperationException {
    3131        UtilityClassTestUtil.assertUtilityClassWellDefined(RightAndLefthandTraffic.class);
    3232    }
     
    3636     */
    3737    @Test
    38     public void testIsRightHandTraffic() {
     38    void testIsRightHandTraffic() {
    3939        check(true, "Paris", 48.8567, 2.3508);
    4040        check(true, "Berlin", 52.5167, 13.383);
  • trunk/test/unit/org/openstreetmap/josm/tools/RotationAngleTest.java

    r12802 r17275  
    22package org.openstreetmap.josm.tools;
    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 RotationAngle} class.
    1011 */
    11 public class RotationAngleTest {
     12class RotationAngleTest {
    1213
    1314    private static final double EPSILON = 1e-11;
     
    1718     */
    1819    @Test
    19     public void testParseCardinal() {
     20    void testParseCardinal() {
    2021        assertEquals(Math.PI, RotationAngle.buildStaticRotation("south").getRotationAngle(null), EPSILON);
    2122        assertEquals(Math.PI, RotationAngle.buildStaticRotation("s").getRotationAngle(null), EPSILON);
     
    2627     * Unit test of method {@link RotationAngle#buildStaticRotation} - wrong parameter.
    2728     */
    28     @Test(expected = IllegalArgumentException.class)
    29     public void testParseFail() {
    30         RotationAngle.buildStaticRotation("bad");
     29    @Test
     30    void testParseFail() {
     31        assertThrows(IllegalArgumentException.class, () -> RotationAngle.buildStaticRotation("bad"));
    3132    }
    3233
     
    3435     * Unit test of method {@link RotationAngle#buildStaticRotation} - null handling.
    3536     */
    36     @Test(expected = NullPointerException.class)
    37     public void testParseNull() {
    38         RotationAngle.buildStaticRotation(null);
     37    @Test
     38    void testParseNull() {
     39        assertThrows(NullPointerException.class, () -> RotationAngle.buildStaticRotation(null));
    3940    }
    4041}
  • trunk/test/unit/org/openstreetmap/josm/tools/SearchCompilerQueryWizardTest.java

    r16413 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
    5 
    6 import org.junit.Ignore;
    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.assertThrows;
     6
     7import org.junit.jupiter.api.Disabled;
     8import org.junit.jupiter.api.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
    910import org.openstreetmap.josm.testutils.JOSMTestRules;
    1011
     
    1415 * Unit tests of {@link SearchCompilerQueryWizard} class.
    1516 */
    16 public class SearchCompilerQueryWizardTest {
     17class SearchCompilerQueryWizardTest {
    1718    /**
    1819     * Base test environment is enough
    1920     */
    20     @Rule
     21    @RegisterExtension
    2122    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2223    public JOSMTestRules test = new JOSMTestRules().i18n("de");
     
    4142     */
    4243    @Test
    43     public void testKeyValue() {
     44    void testKeyValue() {
    4445        assertQueryEquals("  nwr[\"amenity\"=\"drinking_water\"];\n", "amenity=drinking_water");
    4546        assertQueryEquals("  nwr[\"amenity\"];\n", "amenity=*");
     
    5051     */
    5152    @Test
    52     public void testKeyNotValue() {
     53    void testKeyNotValue() {
    5354        assertQueryEquals("  nwr[\"amenity\"!=\"drinking_water\"];\n", "-amenity=drinking_water");
    5455        assertQueryEquals("  nwr[!\"amenity\"];\n", "-amenity=*");
     
    5960     */
    6061    @Test
    61     public void testKeyLikeValue() {
     62    void testKeyLikeValue() {
    6263        assertQueryEquals("  nwr[\"foo\"~\"bar\"];\n", "foo~bar");
    6364        assertQueryEquals("  nwr[\"foo\"~\"bar\"];\n", "foo~/bar/");
     
    7374     */
    7475    @Test
    75     public void testOsmBoolean() {
     76    void testOsmBoolean() {
    7677        assertQueryEquals("  nwr[\"highway\"][\"oneway\"~\"true|yes|1|on\"];\n", "highway=* AND oneway?");
    7778        assertQueryEquals("  nwr[\"highway\"][\"oneway\"~\"false|no|0|off\"];\n", "highway=* AND -oneway?");
     
    8283     */
    8384    @Test
    84     public void testBooleanAnd() {
     85    void testBooleanAnd() {
    8586        assertQueryEquals("  nwr[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n", "foo=bar and baz=42");
    8687        assertQueryEquals("  nwr[\"foo\"=\"bar\"][\"baz\"=\"42\"];\n", "foo=bar && baz=42");
     
    9293     */
    9394    @Test
    94     public void testBooleanOr() {
     95    void testBooleanOr() {
    9596        assertQueryEquals("  nwr[\"foo\"=\"bar\"];\n  nwr[\"baz\"=\"42\"];\n", "foo=bar or baz=42");
    9697        assertQueryEquals("  nwr[\"foo\"=\"bar\"];\n  nwr[\"baz\"=\"42\"];\n", "foo=bar | baz=42");
     
    101102     */
    102103    @Test
    103     public void testBoolean() {
     104    void testBoolean() {
    104105        assertQueryEquals("" +
    105106                "  nwr[\"foo\"][\"baz1\"];\n" +
     
    118119     */
    119120    @Test
    120     public void testType() {
     121    void testType() {
    121122        assertQueryEquals("  node[\"foo\"=\"bar\"];\n  way[\"foo\"=\"bar\"];\n", "foo=bar and (type:node or type:way)");
    122123    }
     
    126127     */
    127128    @Test
    128     public void testUser() {
     129    void testUser() {
    129130        assertQueryEquals("  nwr(user:\"foo\");\n  nwr(uid:42);\n", "user:foo or user:42");
    130131    }
     
    134135     */
    135136    @Test
    136     public void testEmpty() {
     137    void testEmpty() {
    137138        assertQueryEquals("  way[\"foo\"~\"^$\"];\n", "foo=\"\" and type:way");
    138139    }
     
    142143     */
    143144    @Test
    144     public void testInArea() {
     145    void testInArea() {
    145146        String query = constructQuery("foo=bar | foo=baz in Innsbruck");
    146147        assertEquals("" +
     
    179180     */
    180181    @Test
    181     public void testAroundArea() {
     182    void testAroundArea() {
    182183        final String query = constructQuery("foo=bar | foo=baz around \"Sankt Sigmund im Sellrain\"");
    183184        assertEquals("" +
     
    196197     */
    197198    @Test
    198     public void testGlobal() {
     199    void testGlobal() {
    199200        final String query = constructQuery("foo=bar global");
    200201        assertEquals("" +
     
    211212     */
    212213    @Test
    213     public void testInBbox() {
     214    void testInBbox() {
    214215        assertQueryEquals("  nwr[\"foo\"=\"bar\"];\n", "foo=bar IN BBOX");
    215216    }
     
    219220     */
    220221    @Test
    221     @Ignore("preset handling not implemented")
    222     public void testPreset() {
     222    @Disabled("preset handling not implemented")
     223    void testPreset() {
    223224        assertQueryEquals("  nwr[\"amenity\"=\"hospital\"];\n", "Hospital");
    224225    }
     
    227228     * Test erroneous value.
    228229     */
    229     @Test(expected = UncheckedParseException.class)
    230     public void testErroneous() {
    231         constructQuery("-(foo or bar)");
     230    @Test
     231    void testErroneous() {
     232        assertThrows(UncheckedParseException.class, () -> constructQuery("-(foo or bar)"));
    232233    }
    233234
     
    236237     */
    237238    @Test
    238     public void testTicket19151() {
     239    void testTicket19151() {
    239240        assertQueryEquals("  relation[\"type\"=\"multipolygon\"][!\"landuse\"][!\"area:highway\"];\n",
    240241                "type:relation and type=multipolygon and -landuse=* and -\"area:highway\"=*");
  • trunk/test/unit/org/openstreetmap/josm/tools/ShortcutTest.java

    r17180 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.awt.event.InputEvent;
     
    99import javax.swing.KeyStroke;
    1010
    11 import org.junit.BeforeClass;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.JOSMFixture;
    1414
     
    1616 * Unit tests of {@link Shortcut} class.
    1717 */
    18 public class ShortcutTest {
     18class ShortcutTest {
    1919
    2020    /**
    2121     * Setup test.
    2222     */
    23     @BeforeClass
     23    @BeforeAll
    2424    public static void setUp() {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3030     */
    3131    @Test
    32     public void testMakeTooltip() {
     32    void testMakeTooltip() {
    3333        final String tooltip = Shortcut.makeTooltip("Foo Bar", KeyStroke.getKeyStroke(KeyEvent.VK_J, InputEvent.SHIFT_DOWN_MASK));
    3434        if (Platform.determinePlatform() == Platform.OSX) {
  • trunk/test/unit/org/openstreetmap/josm/tools/StreamUtilsTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.tools;
    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
    8 import static org.junit.Assert.assertEquals;
     8import static org.junit.jupiter.api.Assertions.assertEquals;
    99
    1010import java.util.Arrays;
     
    1717 * Unit tests of {@link StreamUtils} class.
    1818 */
    19 public class StreamUtilsTest {
     19class StreamUtilsTest {
    2020
    2121    /**
    2222     * Setup rule.
    2323     */
    24     @Rule
     24    @RegisterExtension
    2525    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2626    public JOSMTestRules test = new JOSMTestRules();
     
    3131     */
    3232    @Test
    33     public void testUtilityClass() throws ReflectiveOperationException {
     33    void testUtilityClass() throws ReflectiveOperationException {
    3434        UtilityClassTestUtil.assertUtilityClassWellDefined(StreamUtils.class);
    3535    }
     
    3939     */
    4040    @Test
    41     public void testReverseStream() {
     41    void testReverseStream() {
    4242        assertEquals("baz/bar/foo",
    4343                StreamUtils.reversedStream(Arrays.asList("foo", "bar", "baz")).collect(Collectors.joining("/")));
  • trunk/test/unit/org/openstreetmap/josm/tools/StringParserTest.java

    r16618 r17275  
    44import static org.hamcrest.CoreMatchers.is;
    55import static org.hamcrest.MatcherAssert.assertThat;
    6 import static org.junit.Assert.assertFalse;
    7 import static org.junit.Assert.assertTrue;
     6import static org.junit.jupiter.api.Assertions.assertFalse;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
    89
    910import java.util.Optional;
    1011
    11 import org.junit.Test;
     12import org.junit.jupiter.api.Test;
    1213
    1314import net.trajano.commons.testing.UtilityClassTestUtil;
     
    1617 * Unit tests of {@link StringParser} class.
    1718 */
    18 public class StringParserTest {
     19class StringParserTest {
    1920
    2021    /**
     
    2425     */
    2526    @Test
    26     public void testUtilityClass() throws ReflectiveOperationException {
     27    void testUtilityClass() throws ReflectiveOperationException {
    2728        UtilityClassTestUtil.assertUtilityClassWellDefined(Utils.class);
    2829    }
     
    3233     */
    3334    @Test
    34     public void testParse() {
     35    void testParse() {
    3536        assertThat(StringParser.DEFAULT.parse(char.class, "josm"), is('j'));
    3637        assertThat(StringParser.DEFAULT.parse(short.class, "123"), is((short) 123));
     
    4445     * Tests that {@link StringParser#DEFAULT} is immutable.
    4546     */
    46     @Test(expected = UnsupportedOperationException.class)
    47     public void testDefaultImmutable() {
    48         StringParser.DEFAULT.registerParser(String.class, String::valueOf);
     47    @Test
     48    void testDefaultImmutable() {
     49        assertThrows(UnsupportedOperationException.class, () -> StringParser.DEFAULT.registerParser(String.class, String::valueOf));
    4950    }
    5051
     
    5354     */
    5455    @Test
    55     public void testCopyConstructor() {
     56    void testCopyConstructor() {
    5657        final StringParser parser = new StringParser(StringParser.DEFAULT).registerParser(boolean.class, "JOSM"::equals);
    5758        assertTrue(StringParser.DEFAULT.parse(boolean.class, "true"));
  • trunk/test/unit/org/openstreetmap/josm/tools/Tag2LinkTest.java

    r17006 r17275  
    77
    88import org.junit.Assert;
    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 * Test {@link Tag2Link}
    1717 */
    18 public class Tag2LinkTest {
     18class Tag2LinkTest {
    1919
    2020    List<String> links = new ArrayList<>();
     
    3131     * Setup test.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3939     */
    4040    @Test
    41     public void testInitialize() {
     41    void testInitialize() {
    4242        Tag2Link.initialize();
    4343        Assert.assertTrue("obtains at least 40 rules", Tag2Link.wikidataRules.size() > 40);
     
    4848     */
    4949    @Test
    50     public void testName() {
     50    void testName() {
    5151        Tag2Link.getLinksForTag("name", "foobar", this::addLink);
    5252        checkLinks("Search on duckduckgo.com // https://duckduckgo.com/?q=foobar",
     
    5858     */
    5959    @Test
    60     public void testWebsite() {
     60    void testWebsite() {
    6161        Tag2Link.getLinksForTag("website", "http://www.openstreetmap.org/", this::addLink);
    6262        checkLinks("Open openstreetmap.org // http://www.openstreetmap.org/");
     
    7373     */
    7474    @Test
    75     public void testWikipedia() {
     75    void testWikipedia() {
    7676        Tag2Link.getLinksForTag("wikipedia", "de:Wohnhausgruppe Herderstraße", this::addLink);
    7777        checkLinks("View Wikipedia article // https://de.wikipedia.org/wiki/Wohnhausgruppe_Herderstraße");
     
    8585     */
    8686    @Test
    87     public void testImageCommonsImage() {
     87    void testImageCommonsImage() {
    8888        Tag2Link.getLinksForTag("image", "File:Witten Brücke Gasstraße.jpg", this::addLink);
    8989        checkLinks("View image on Wikimedia Commons // https://commons.wikimedia.org/wiki/File:Witten Brücke Gasstraße.jpg");
     
    9999     */
    100100    @Test
    101     public void testImageCommonsCategory() {
     101    void testImageCommonsCategory() {
    102102        Tag2Link.getLinksForTag("image", "category:JOSM", this::addLink);
    103103        checkLinks("View category on Wikimedia Commons // https://commons.wikimedia.org/wiki/category:JOSM");
     
    108108     */
    109109    @Test
    110     public void testBrandWikidata() {
     110    void testBrandWikidata() {
    111111        Tag2Link.getLinksForTag("brand:wikidata", "Q259340", this::addLink);
    112112        checkLinks("View Wikidata item // https://www.wikidata.org/wiki/Q259340");
     
    117117     */
    118118    @Test
    119     public void testArchipelagoWikidata() {
     119    void testArchipelagoWikidata() {
    120120        Tag2Link.getLinksForTag("archipelago:wikidata", "Q756987;Q756988", this::addLink);
    121121        checkLinks("View Wikidata item // https://www.wikidata.org/wiki/Q756987",
  • trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTest.java

    r16945 r17275  
    33
    44import static java.util.Collections.singleton;
    5 import static org.junit.Assert.assertEquals;
    6 import static org.junit.Assert.assertNull;
    7 import static org.junit.Assert.assertTrue;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    99import java.util.Arrays;
     
    1313import java.util.Set;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.coor.LatLon;
     
    2525 * Unit tests of {@link Territories} class.
    2626 */
    27 public class TerritoriesTest {
     27class TerritoriesTest {
    2828    /**
    2929     * Test rules.
    3030     */
    31     @Rule
     31    @RegisterExtension
    3232    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3333    public JOSMTestRules rules = new JOSMTestRules().projection().territories();
     
    3939     */
    4040    @Test
    41     public void testUtilityClass() throws ReflectiveOperationException {
     41    void testUtilityClass() throws ReflectiveOperationException {
    4242        UtilityClassTestUtil.assertUtilityClassWellDefined(Territories.class);
    4343    }
     
    4747     */
    4848    @Test
    49     public void testIsIso3166Code() {
     49    void testIsIso3166Code() {
    5050        check("Paris", new LatLon(48.8567, 2.3508), "EU", "FR", "FX");
    5151    }
     
    5353    private static void check(String name, LatLon ll, String... expectedCodes) {
    5454        for (String e : expectedCodes) {
    55             assertTrue(name + " " + e, Territories.isIso3166Code(e, ll));
     55            assertTrue(Territories.isIso3166Code(e, ll), name + " " + e);
    5656        }
    5757    }
     
    6161     */
    6262    @Test
    63     public void testTaginfoGeofabrik_nominal() {
     63    void testTaginfoGeofabrik_nominal() {
    6464        Territories.initializeExternalData("foo", TestUtils.getTestDataRoot() + "/taginfo/geofabrik-index-v1-nogeom.json");
    6565        Map<String, TaginfoRegionalInstance> cache = Territories.taginfoGeofabrikCache;
     
    8686     */
    8787    @Test
    88     public void testTaginfoGeofabrik_broken() {
     88    void testTaginfoGeofabrik_broken() {
    8989        Logging.clearLastErrorAndWarnings();
    9090        Territories.initializeExternalData("foo", TestUtils.getTestDataRoot() + "taginfo/geofabrik-index-v1-nogeom-broken.json");
     
    9292        assertTrue(cache.isEmpty());
    9393        String error = Logging.getLastErrorAndWarnings().get(0);
    94         assertTrue(error, error.contains("W: Failed to parse external taginfo data at "));
    95         assertTrue(error, error.contains(": Invalid token=EOF at (line no=3,"));
     94        assertTrue(error.contains("W: Failed to parse external taginfo data at "), error);
     95        assertTrue(error.contains(": Invalid token=EOF at (line no=3,"), error);
    9696    }
    9797
     
    100100     */
    101101    @Test
    102     public void testGetCustomTags() {
     102    void testGetCustomTags() {
    103103        assertNull(Territories.getCustomTags(null));
    104104        assertNull(Territories.getCustomTags("foo"));
  • trunk/test/unit/org/openstreetmap/josm/tools/TerritoriesTestIT.java

    r16602 r17275  
    22package org.openstreetmap.josm.tools;
    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
    77import java.util.Collections;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
    1212
     
    1616 * Integration tests of {@link Territories} class.
    1717 */
    18 public class TerritoriesTestIT {
     18class TerritoriesTestIT {
    1919
    2020    /**
    2121     * Test rules.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2525    public JOSMTestRules rules = new JOSMTestRules().projection();
     
    3030     */
    3131    @Test
    32     public void testUtilityClass() {
     32    void testUtilityClass() {
    3333        Logging.clearLastErrorAndWarnings();
    3434        Territories.initialize();
    35         assertEquals("no errors or warnings", Collections.emptyList(), Logging.getLastErrorAndWarnings());
    36         assertFalse("customTagsCache is non empty", Territories.customTagsCache.isEmpty());
    37         assertFalse("iso3166Cache is non empty", Territories.iso3166Cache.isEmpty());
    38         assertFalse("taginfoCache is non empty", Territories.taginfoCache.isEmpty());
    39         assertFalse("taginfoGeofabrikCache is non empty", Territories.taginfoGeofabrikCache.isEmpty());
     35        assertEquals(Collections.emptyList(), Logging.getLastErrorAndWarnings(), "no errors or warnings");
     36        assertFalse(Territories.customTagsCache.isEmpty(), "customTagsCache is non empty");
     37        assertFalse(Territories.iso3166Cache.isEmpty(), "iso3166Cache is non empty");
     38        assertFalse(Territories.taginfoCache.isEmpty(), "taginfoCache is non empty");
     39        assertFalse(Territories.taginfoGeofabrikCache.isEmpty(), "taginfoGeofabrikCache is non empty");
    4040    }
    4141}
  • trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java

    r16472 r17275  
    22package org.openstreetmap.josm.tools;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.ArrayList;
     
    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.testutils.JOSMTestRules;
    1616
     
    2020 * Unit tests of {@link TextTagParser} class.
    2121 */
    22 public class TextTagParserTest {
     22class TextTagParserTest {
    2323    /**
    2424     * Some of this depends on preferences.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3232     */
    3333    @Test
    34     public void testUnescape() {
     34    void testUnescape() {
    3535        String s, s1;
    3636        s = "\"2 3 4\"";
     
    5555     */
    5656    @Test
    57     public void testTNformat() {
     57    void testTNformat() {
    5858        String txt = "   a  \t  1   \n\n\n  b\t2 \n c \t the value with \"quotes\"";
    5959        Map<String, String> correctTags = new HashMap<String, String>() { {
     
    6868     */
    6969    @Test
    70     public void testEQformat() {
     70    void testEQformat() {
    7171        String txt = "key1=value key2=\"long value\" tag3=\"hotel \\\"Quote\\\"\"";
    7272        Map<String, String> correctTags = new HashMap<String, String>() { {
     
    8282     */
    8383    @Test
    84     public void testJSONformat() {
     84    void testJSONformat() {
    8585        String txt;
    8686        Map<String, String> tags, correctTags;
     
    105105     */
    106106    @Test
    107     public void testFreeformat() {
     107    void testFreeformat() {
    108108        String txt = "a 1 b=2 c=\"hello === \\\"\\\"world\"";
    109109        Map<String, String> correctTags = new HashMap<String, String>() { {
     
    118118     */
    119119    @Test
    120     public void testErrorDetect() {
     120    void testErrorDetect() {
    121121        String txt = "a=2 b=3 4";
    122122        Map<String, String> tags = TextTagParser.readTagsFromText(txt);
     
    128128     */
    129129    @Test
    130     public void testTab() {
     130    void testTab() {
    131131        assertEquals(Collections.singletonMap("shop", "jewelry"), TextTagParser.readTagsFromText("shop\tjewelry"));
    132132        assertEquals(Collections.singletonMap("shop", "jewelry"), TextTagParser.readTagsFromText("!shop\tjewelry"));
     
    139139     */
    140140    @Test
    141     public void testTicket16104() {
     141    void testTicket16104() {
    142142        Map<String, String> expected = new HashMap<>();
    143143        expected.put("boundary", "national_park");
     
    170170     */
    171171    @Test
    172     public void testTicket8384Comment58() {
     172    void testTicket8384Comment58() {
    173173        Map<String, String> expected = new HashMap<>();
    174174        expected.put("name", "Main street");
     
    181181     */
    182182    @Test
    183     public void testStableOrder() {
     183    void testStableOrder() {
    184184        List<String> expected = Arrays.asList("foo4", "foo3", "foo2", "foo1");
    185185        ArrayList<String> actual = new ArrayList<>(TextTagParser.readTagsByRegexp(
  • trunk/test/unit/org/openstreetmap/josm/tools/UtilsTest.java

    r17133 r17275  
    22package org.openstreetmap.josm.tools;
    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.assertSame;
    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.assertNull;
     7import static org.junit.jupiter.api.Assertions.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertThrows;
     9import static org.junit.jupiter.api.Assertions.assertTrue;
    910
    1011import java.io.File;
     
    2122import java.util.regex.Pattern;
    2223
    23 import org.junit.Rule;
    24 import org.junit.Test;
     24import org.junit.jupiter.api.Test;
     25import org.junit.jupiter.api.extension.RegisterExtension;
    2526import org.openstreetmap.josm.testutils.JOSMTestRules;
    2627
     
    3132 * Unit tests of {@link Utils} class.
    3233 */
    33 public class UtilsTest {
     34class UtilsTest {
    3435    /**
    3536     * Use default, basic test rules.
    3637     */
    37     @Rule
     38    @RegisterExtension
    3839    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3940    public JOSMTestRules rules = new JOSMTestRules();
     
    4445     */
    4546    @Test
    46     public void testUtilityClass() throws ReflectiveOperationException {
     47    void testUtilityClass() throws ReflectiveOperationException {
    4748        UtilityClassTestUtil.assertUtilityClassWellDefined(Utils.class);
    4849    }
     
    5253     */
    5354    @Test
    54     public void testStrip() {
     55    void testStrip() {
    5556        // CHECKSTYLE.OFF: SingleSpaceSeparator
    5657        final String someWhite =
     
    107108     */
    108109    @Test
    109     public void testIsStripEmpty() {
     110    void testIsStripEmpty() {
    110111        assertTrue(Utils.isStripEmpty(null));
    111112        assertTrue(Utils.isStripEmpty(""));
     
    123124     */
    124125    @Test
    125     public void testToHexString() {
     126    void testToHexString() {
    126127        assertEquals("", Utils.toHexString(null));
    127128        assertEquals("", Utils.toHexString(new byte[0]));
     
    137138     */
    138139    @Test
    139     public void testPositionListString() {
     140    void testPositionListString() {
    140141        assertEquals("1", Utils.getPositionListString(Arrays.asList(1)));
    141142        assertEquals("1-2", Utils.getPositionListString(Arrays.asList(1, 2)));
     
    150151     */
    151152    @Test
    152     public void testDurationString() {
     153    void testDurationString() {
    153154        I18n.set("en");
    154155        assertEquals("0 ms", Utils.getDurationString(0));
     
    169170     * Test of {@link Utils#getDurationString} method.
    170171     */
    171     @Test(expected = IllegalArgumentException.class)
    172     public void testDurationStringNegative() {
    173         Utils.getDurationString(-1);
     172    @Test
     173    void testDurationStringNegative() {
     174        assertThrows(IllegalArgumentException.class, () -> Utils.getDurationString(-1));
    174175    }
    175176
     
    178179     */
    179180    @Test
    180     public void testEscapeReservedCharactersHTML() {
     181    void testEscapeReservedCharactersHTML() {
    181182        assertEquals("foo -&gt; bar -&gt; '&amp;'", Utils.escapeReservedCharactersHTML("foo -> bar -> '&'"));
    182183    }
     
    186187     */
    187188    @Test
    188     public void testShortenString() {
     189    void testShortenString() {
    189190        assertNull(Utils.shortenString(null, 3));
    190191        assertEquals("...", Utils.shortenString("123456789", 3));
     
    200201     * Test of {@link Utils#shortenString} method.
    201202     */
    202     @Test(expected = IllegalArgumentException.class)
    203     public void testShortenStringTooShort() {
    204         Utils.shortenString("123456789", 2);
     203    @Test
     204    void testShortenStringTooShort() {
     205        assertThrows(IllegalArgumentException.class, () -> Utils.shortenString("123456789", 2));
    205206    }
    206207
     
    209210     */
    210211    @Test
    211     public void testRestrictStringLines() {
     212    void testRestrictStringLines() {
    212213        assertNull(Utils.restrictStringLines(null, 2));
    213214        assertEquals("1\n...", Utils.restrictStringLines("1\n2\n3", 2));
     
    220221     */
    221222    @Test
    222     public void testLimit() {
     223    void testLimit() {
    223224        assertNull(Utils.limit(null, 2, "..."));
    224225        assertEquals(Arrays.asList("1", "..."), Utils.limit(Arrays.asList("1", "2", "3"), 2, "..."));
     
    231232     */
    232233    @Test
    233     public void testSizeString() {
     234    void testSizeString() {
    234235        assertEquals("0 B", Utils.getSizeString(0, Locale.ENGLISH));
    235236        assertEquals("123 B", Utils.getSizeString(123, Locale.ENGLISH));
     
    251252     * Test of {@link Utils#getSizeString} method.
    252253     */
    253     @Test(expected = IllegalArgumentException.class)
    254     public void testSizeStringNegative() {
    255         Utils.getSizeString(-1, Locale.ENGLISH);
     254    @Test
     255    void testSizeStringNegative() {
     256        assertThrows(IllegalArgumentException.class, () -> Utils.getSizeString(-1, Locale.ENGLISH));
    256257    }
    257258
     
    260261     */
    261262    @Test
    262     public void testJoinAsHtmlUnorderedList() {
     263    void testJoinAsHtmlUnorderedList() {
    263264        List<? extends Object> items = Arrays.asList("1", Integer.valueOf(2));
    264265        assertEquals("<ul><li>1</li><li>2</li></ul>", Utils.joinAsHtmlUnorderedList(items));
     
    270271     */
    271272    @Test
    272     public void testGetJavaVersion() {
     273    void testGetJavaVersion() {
    273274        String javaVersion = System.getProperty("java.version");
    274275        try {
     
    302303     */
    303304    @Test
    304     public void testGetJavaUpdate() {
     305    void testGetJavaUpdate() {
    305306        String javaVersion = System.getProperty("java.version");
    306307        try {
     
    331332     */
    332333    @Test
    333     public void testGetJavaBuild() {
     334    void testGetJavaBuild() {
    334335        String javaVersion = System.getProperty("java.runtime.version");
    335336        try {
     
    363364     */
    364365    @Test
    365     public void testNullStreamForReadBytesFromStream() throws IOException {
    366         assertEquals("Empty on null stream", 0, Utils.readBytesFromStream(null).length);
     366    void testNullStreamForReadBytesFromStream() throws IOException {
     367        assertEquals(0, Utils.readBytesFromStream(null).length, "Empty on null stream");
    367368    }
    368369
     
    371372     */
    372373    @Test
    373     public void testLevenshteinDistance() {
     374    void testLevenshteinDistance() {
    374375        assertEquals(0, Utils.getLevenshteinDistance("foo", "foo"));
    375376        assertEquals(3, Utils.getLevenshteinDistance("foo", "bar"));
     
    384385     */
    385386    @Test
    386     public void testIsSimilar() {
     387    void testIsSimilar() {
    387388        assertFalse(Utils.isSimilar("foo", "foo"));
    388389        assertFalse(Utils.isSimilar("foo", "bar"));
     
    396397     */
    397398    @Test
    398     public void testStripHtml() {
     399    void testStripHtml() {
    399400        assertEquals("Hoogte 55 m", Utils.stripHtml(
    400401                "<table width=\"100%\"><tr>" +
     
    407408     */
    408409    @Test
    409     public void testFirstNonNull() {
     410    void testFirstNonNull() {
    410411        assertNull(Utils.firstNonNull());
    411412        assertNull(Utils.firstNonNull(null, null));
     
    417418     */
    418419    @Test
    419     public void testGetMatches() {
     420    void testGetMatches() {
    420421        final Pattern pattern = Pattern.compile("(foo)x(bar)y(baz)");
    421422        assertNull(Utils.getMatches(pattern.matcher("")));
     
    427428     */
    428429    @Test
    429     public void testEncodeUrl() {
     430    void testEncodeUrl() {
    430431        assertEquals("%C3%A4%C3%B6%C3%BC%C3%9F", Utils.encodeUrl("äöüß"));
    431432    }
     
    434435     * Test of {@link Utils#encodeUrl}
    435436     */
    436     @Test(expected = NullPointerException.class)
    437     public void testEncodeUrlNull() {
    438         Utils.encodeUrl(null);
     437    @Test
     438    void testEncodeUrlNull() {
     439        assertThrows(NullPointerException.class, () -> Utils.encodeUrl(null));
    439440    }
    440441
     
    443444     */
    444445    @Test
    445     public void testDecodeUrl() {
     446    void testDecodeUrl() {
    446447        assertEquals("äöüß", Utils.decodeUrl("%C3%A4%C3%B6%C3%BC%C3%9F"));
    447448    }
     
    450451     * Test of {@link Utils#decodeUrl}
    451452     */
    452     @Test(expected = NullPointerException.class)
    453     public void testDecodeUrlNull() {
    454         Utils.decodeUrl(null);
     453    @Test
     454    void testDecodeUrlNull() {
     455        assertThrows(NullPointerException.class, () -> Utils.decodeUrl(null));
    455456    }
    456457
     
    459460     */
    460461    @Test
    461     public void testClamp() {
     462    void testClamp() {
    462463        assertEquals(3, Utils.clamp(2, 3, 5));
    463464        assertEquals(3, Utils.clamp(3, 3, 5));
     
    475476     * Test of {@link Utils#clamp}
    476477     */
    477     @Test(expected = IllegalArgumentException.class)
    478     public void testClampIAE1() {
    479         Utils.clamp(0, 5, 4);
     478    @Test
     479    void testClampIAE1() {
     480        assertThrows(IllegalArgumentException.class, () -> Utils.clamp(0, 5, 4));
    480481    }
    481482
     
    483484     * Test of {@link Utils#clamp}
    484485     */
    485     @Test(expected = IllegalArgumentException.class)
    486     public void testClampIAE2() {
    487         Utils.clamp(0., 5., 4.);
     486    @Test
     487    void testClampIAE2() {
     488        assertThrows(IllegalArgumentException.class, () -> Utils.clamp(0., 5., 4.));
    488489    }
    489490
     
    492493     */
    493494    @Test
    494     public void testHasExtension() {
     495    void testHasExtension() {
    495496        assertFalse(Utils.hasExtension("JOSM.txt"));
    496497        assertFalse(Utils.hasExtension("JOSM.txt", "jpg"));
     
    504505     */
    505506    @Test
    506     public void testToUnmodifiableList() {
     507    void testToUnmodifiableList() {
    507508        assertSame(Collections.emptyList(), Utils.toUnmodifiableList(null));
    508509        assertSame(Collections.emptyList(), Utils.toUnmodifiableList(Collections.emptyList()));
     
    518519     */
    519520    @Test
    520     public void testToUnmodifiableMap() {
     521    void testToUnmodifiableMap() {
    521522        assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(null));
    522523        assertSame(Collections.emptyMap(), Utils.toUnmodifiableMap(Collections.emptyMap()));
     
    538539     */
    539540    @Test
    540     public void testExecOutput() throws Exception {
     541    void testExecOutput() throws Exception {
    541542        final String output = Utils.execOutput(Arrays.asList("echo", "Hello", "World"));
    542543        assertEquals("Hello World", output);
  • trunk/test/unit/org/openstreetmap/josm/tools/XmlUtilsTest.java

    r16560 r17275  
    33
    44import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    5 import org.junit.Rule;
    6 import org.junit.Test;
     5import org.junit.jupiter.api.extension.RegisterExtension;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.TestUtils;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2020import java.io.StringWriter;
    2121
    22 import static org.junit.Assert.assertEquals;
    23 import static org.junit.Assert.assertNotNull;
    24 import static org.junit.Assert.fail;
     22import static org.junit.jupiter.api.Assertions.assertEquals;
     23import static org.junit.jupiter.api.Assertions.assertNotNull;
     24import static org.junit.jupiter.api.Assertions.fail;
    2525
    2626/**
    2727 * Unit tests of {@link XmlUtils} class.
    2828 */
    29 public class XmlUtilsTest {
     29class XmlUtilsTest {
    3030
    3131    /**
    3232     * Use default, basic test rules.
    3333     */
    34     @Rule
     34    @RegisterExtension
    3535    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3636    public JOSMTestRules rules = new JOSMTestRules();
     
    4040
    4141    @Test
    42     public void testExternalEntitiesParsingDom() throws IOException, ParserConfigurationException {
     42    void testExternalEntitiesParsingDom() throws IOException, ParserConfigurationException {
    4343        try {
    4444            final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml";
     
    5252
    5353    @Test
    54     public void testExternalEntitiesTransformer() throws IOException {
     54    void testExternalEntitiesTransformer() throws IOException {
    5555        try {
    5656            final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml";
     
    6565
    6666    @Test
    67     public void testExternalEntitiesSaxParser() throws IOException, ParserConfigurationException {
     67    void testExternalEntitiesSaxParser() throws IOException, ParserConfigurationException {
    6868        try {
    6969            final String source = TestUtils.getTestDataRoot() + "dom_external_entity.xml";
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java

    r12802 r17275  
    44import java.util.concurrent.CountDownLatch;
    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 BugReportExceptionHandler} class.
    1414 */
    15 public class BugReportExceptionHandlerTest {
     15class BugReportExceptionHandlerTest {
    1616    /**
    1717     * No dependencies
    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 testHandleException() throws InterruptedException {
     28    void testHandleException() throws InterruptedException {
    2929        CountDownLatch latch = new CountDownLatch(1);
    3030        BugReportQueue.getInstance().addBugReportHandler(e -> {
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.tools.bugreport;
    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
    88import java.io.IOException;
     
    1010import java.io.StringWriter;
    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.actions.ShowStatusReportAction;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * @author Michael Zangl
    2222 */
    23 public class BugReportTest {
     23class BugReportTest {
    2424    /**
    2525     * Preferences for the report text
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3333     */
    3434    @Test
    35     public void testReportText() {
     35    void testReportText() {
    3636        ReportedException e = interceptInChildMethod(new IOException("test-exception-message"));
    3737        e.put("test-key", "test-value");
     
    4848     */
    4949    @Test
    50     public void testIntercept() {
     50    void testIntercept() {
    5151        IOException base = new IOException("test");
    5252        ReportedException intercepted = interceptInChildMethod(base);
     
    6969     */
    7070    @Test
    71     public void testGetCallingMethod() {
     71    void testGetCallingMethod() {
    7272        assertEquals("BugReportTest#testGetCallingMethod", BugReport.getCallingMethod(1));
    7373        assertEquals("BugReportTest#testGetCallingMethod", testGetCallingMethod2());
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/ReportedExceptionTest.java

    r10285 r17275  
    22package org.openstreetmap.josm.tools.bugreport;
    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/**
     
    1313 * @since 10285
    1414 */
    15 public class ReportedExceptionTest {
     15class ReportedExceptionTest {
    1616    private static final class CauseOverwriteException extends RuntimeException {
    1717        private Throwable myCause;
     
    3131     */
    3232    @Test
    33     public void testPutDoesHandleNull() {
     33    void testPutDoesHandleNull() {
    3434        ReportedException e = new ReportedException(new RuntimeException());
    3535        e.startSection("test");
     
    4545     */
    4646    @Test
    47     public void testPutDoesNotThrow() {
     47    void testPutDoesNotThrow() {
    4848        ReportedException e = new ReportedException(new RuntimeException());
    4949        e.startSection("test");
     
    6565     */
    6666    @Test
    67     public void testIsSame() {
     67    void testIsSame() {
    6868        // Do not break this line! All exceptions need to be created in the same line.
    6969        // CHECKSTYLE.OFF: LineLength
     
    7878                boolean is01 = (i == 0 || i == 1) && (j == 0 || j == 1);
    7979                boolean is23 = (i == 2 || i == 3) && (j == 2 || j == 3);
    80                 assertEquals(i + ", " + j, is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]));
     80                assertEquals(is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]), i + ", " + j);
    8181            }
    8282        }
  • trunk/test/unit/org/openstreetmap/josm/tools/date/DateUtilsTest.java

    r17114 r17275  
    22package org.openstreetmap.josm.tools.date;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotEquals;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertNotSame;
    8 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotEquals;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNotSame;
     8import static org.junit.jupiter.api.Assertions.assertNull;
     9import static org.junit.jupiter.api.Assertions.assertThrows;
    910
    1011import java.text.DateFormat;
     
    1415import java.util.concurrent.ForkJoinPool;
    1516
    16 import org.junit.Ignore;
    17 import org.junit.Rule;
    18 import org.junit.Test;
     17import org.junit.jupiter.api.Disabled;
     18import org.junit.jupiter.api.Test;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    1920import org.openstreetmap.josm.testutils.JOSMTestRules;
    2021import org.openstreetmap.josm.tools.UncheckedParseException;
     
    3334     * Timeouts need to be disabled because we change the time zone.
    3435     */
    35     @Rule
     36    @RegisterExtension
    3637    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3738    public JOSMTestRules test = new JOSMTestRules().i18n().preferences();
     
    4243     */
    4344    @Test
    44     public void testUtilityClass() throws ReflectiveOperationException {
     45    void testUtilityClass() throws ReflectiveOperationException {
    4546        UtilityClassTestUtil.assertUtilityClassWellDefined(DateUtils.class);
    4647    }
     
    5859     */
    5960    @Test
    60     public void testMapDate() {
     61    void testMapDate() {
    6162        assertEquals(1344870637000L, DateUtils.fromString("2012-08-13T15:10:37Z").getTime());
    6263    }
     
    6667     */
    6768    @Test
    68     public void testNoteDate() {
     69    void testNoteDate() {
    6970        assertEquals(1417298930000L, DateUtils.fromString("2014-11-29 22:08:50 UTC").getTime());
    7071    }
     
    7475     */
    7576    @Test
    76     public void testExifDate() {
     77    void testExifDate() {
    7778        assertEquals(1443038712000L, DateUtils.fromString("2015:09:23 20:05:12").getTime());
    7879        assertEquals(1443038712888L, DateUtils.fromString("2015:09:23 20:05:12.888").getTime());
     
    8384     */
    8485    @Test
    85     public void testGPXDate() {
     86    void testGPXDate() {
    8687        assertEquals(1277465405000L, DateUtils.fromString("2010-06-25T11:30:05.000Z").getTime());
    8788    }
     
    9192     */
    9293    @Test
    93     public void testRfc3339() {
     94    void testRfc3339() {
    9495        // examples taken from RFC
    9596        assertEquals(482196050520L, DateUtils.fromString("1985-04-12T23:20:50.52Z").getTime());
     
    105106     * Verifies that parsing an illegal date throws a {@link UncheckedParseException}
    106107     */
    107     @Test(expected = UncheckedParseException.class)
    108     public void testIllegalDate() {
    109         DateUtils.fromString("2014-");
     108    @Test
     109    void testIllegalDate() {
     110        assertThrows(UncheckedParseException.class, () -> DateUtils.fromString("2014-"));
    110111    }
    111112
     
    114115     */
    115116    @Test
    116     public void testFormattingMillisecondsDoesNotCauseIncorrectParsing() {
     117    void testFormattingMillisecondsDoesNotCauseIncorrectParsing() {
    117118        DateUtils.fromDate(new Date(123));
    118119        assertEquals(1453694709000L, DateUtils.fromString("2016-01-25T04:05:09.000Z").getTime());
     
    125126     */
    126127    @Test
    127     public void testFromTimestamp() {
     128    void testFromTimestamp() {
    128129        assertEquals("1970-01-01T00:00:00Z", DateUtils.fromTimestamp(0));
    129130        assertEquals("2001-09-09T01:46:40Z", DateUtils.fromTimestamp(1000000000));
     
    135136     */
    136137    @Test
    137     public void testFromDate() {
     138    void testFromDate() {
    138139        assertEquals("1970-01-01T00:00:00Z", DateUtils.fromDate(new Date(0)));
    139140        assertEquals("1970-01-01T00:00:00.1Z", DateUtils.fromDate(new Date(100)));
     
    147148     */
    148149    @Test
    149     public void testFormatTime() {
     150    void testFormatTime() {
    150151        assertEquals("12:00 AM", DateUtils.formatTime(new Date(0), DateFormat.SHORT));
    151152        assertEquals("1:00 AM", DateUtils.formatTime(new Date(60 * 60 * 1000), DateFormat.SHORT));
     
    162163     */
    163164    @Test
    164     public void testFormatDate() {
     165    void testFormatDate() {
    165166        assertEquals("1/1/70", DateUtils.formatDate(new Date(123), DateFormat.SHORT));
    166167        assertEquals("January 1, 1970", DateUtils.formatDate(new Date(123), DateFormat.LONG));
     
    171172     */
    172173    @Test
    173     public void testTsFromString() {
     174    void testTsFromString() {
    174175        // UTC times
    175176        assertEquals(1459641600000L, DateUtils.tsFromString("2016-04-03"));
     
    204205
    205206    @Test
    206     @Ignore("slow; use for thread safety testing")
    207     public void testTsFromString800k() throws Exception {
     207    @Disabled("slow; use for thread safety testing")
     208    void testTsFromString800k() throws Exception {
    208209        new ForkJoinPool(64).submit(() -> new Random()
    209210                .longs(800_000)
     
    215216     * Unit test of {@link DateUtils#tsFromString} method.
    216217     */
    217     @Test(expected = UncheckedParseException.class)
    218     public void testTsFromStringInvalid1() {
    219         DateUtils.tsFromString("foobar");
     218    @Test
     219    void testTsFromStringInvalid1() {
     220        assertThrows(UncheckedParseException.class, () -> DateUtils.tsFromString("foobar"));
    220221    }
    221222
     
    223224     * Unit test of {@link DateUtils#tsFromString} method.
    224225     */
    225     @Test(expected = UncheckedParseException.class)
    226     public void testTsFromStringInvalid2() {
    227         DateUtils.tsFromString("2016/04/03");
     226    @Test
     227    void testTsFromStringInvalid2() {
     228        assertThrows(UncheckedParseException.class, () -> DateUtils.tsFromString("2016/04/03"));
    228229    }
    229230
     
    232233     */
    233234    @Test
    234     public void testGetDateFormat() {
     235    void testGetDateFormat() {
    235236        Boolean iso = DateUtils.PROP_ISO_DATES.get();
    236237        try {
     
    250251     */
    251252    @Test
    252     public void testTimeFormat() {
     253    void testTimeFormat() {
    253254        Boolean iso = DateUtils.PROP_ISO_DATES.get();
    254255        try {
     
    265266
    266267    @Test
    267     public void testCloneDate() {
     268    void testCloneDate() {
    268269        assertNull(DateUtils.cloneDate(null));
    269270        final Date date = new Date(1453694709000L);
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEntryTest.java

    r14100 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.TestUtils;
    1010import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1818 * Unit tests of {@link TemplateEntry} class.
    1919 */
    20 public class TemplateEntryTest {
     20class TemplateEntryTest {
    2121
    2222    /**
    2323     * Setup rule.
    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 testEqualsContract() {
     33    void testEqualsContract() {
    3434        TestUtils.assumeWorkingEqualsVerifier();
    3535        Set<Class<? extends TemplateEntry>> templates = TestUtils.getJosmSubtypes(TemplateEntry.class);
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateParserTest.java

    r14093 r17275  
    22package org.openstreetmap.josm.tools.template_engine;
    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
    67import java.util.Arrays;
     
    89
    910import org.junit.Assert;
    10 import org.junit.BeforeClass;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.BeforeAll;
     12import org.junit.jupiter.api.Test;
    1213import org.openstreetmap.josm.JOSMFixture;
    1314import org.openstreetmap.josm.data.osm.Node;
     
    2223 * Unit tests of {@link TemplateParser} class.
    2324 */
    24 public class TemplateParserTest {
     25class TemplateParserTest {
    2526
    2627    /**
    2728     * Setup test.
    2829     */
    29     @BeforeClass
     30    @BeforeAll
    3031    public static void setUp() {
    3132        JOSMFixture.createUnitTestFixture().init();
     
    3738     */
    3839    @Test
    39     public void testEmpty() throws ParseError {
     40    void testEmpty() throws ParseError {
    4041        TemplateParser parser = new TemplateParser("");
    4142        assertEquals(new StaticText(""), parser.parse());
     
    4748     */
    4849    @Test
    49     public void testVariable() throws ParseError {
     50    void testVariable() throws ParseError {
    5051        TemplateParser parser = new TemplateParser("abc{var}\\{ef\\$\\{g");
    5152        assertEquals(CompoundTemplateEntry.fromArray(new StaticText("abc"),
     
    5859     */
    5960    @Test
    60     public void testConditionWhitespace() throws ParseError {
     61    void testConditionWhitespace() throws ParseError {
    6162        TemplateParser parser = new TemplateParser("?{ '{name} {desc}' | '{name}' | '{desc}'    }");
    6263        Condition condition = new Condition(Arrays.asList(
     
    7273     */
    7374    @Test
    74     public void testConditionNoWhitespace() throws ParseError {
     75    void testConditionNoWhitespace() throws ParseError {
    7576        TemplateParser parser = new TemplateParser("?{'{name} {desc}'|'{name}'|'{desc}'}");
    7677        Condition condition = new Condition(Arrays.asList(
     
    9192     */
    9293    @Test
    93     public void testConditionSearchExpression() throws ParseError, SearchParseError {
     94    void testConditionSearchExpression() throws ParseError, SearchParseError {
    9495        TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' |  '{admin_level}'}");
    9596        Condition condition = new Condition(Arrays.asList(
     
    139140     */
    140141    @Test
    141     public void testFilling() throws ParseError {
     142    void testFilling() throws ParseError {
    142143        TemplateParser parser = new TemplateParser("{name} u{unknown}u i{number}i");
    143144        TemplateEntry entry = parser.parse();
     
    152153     */
    153154    @Test
    154     public void testFillingSearchExpression() throws ParseError {
     155    void testFillingSearchExpression() throws ParseError {
    155156        TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' |  '{admin_level}'}");
    156157        TemplateEntry templateEntry = parser.parse();
     
    173174     */
    174175    @Test
    175     public void testPrintAll() throws ParseError {
     176    void testPrintAll() throws ParseError {
    176177        TemplateParser parser = new TemplateParser("{special:everything}");
    177178        TemplateEntry entry = parser.parse();
     
    187188     */
    188189    @Test
    189     public void testPrintMultiline() throws ParseError {
     190    void testPrintMultiline() throws ParseError {
    190191        TemplateParser parser = new TemplateParser("{name}\\n{number}");
    191192        TemplateEntry entry = parser.parse();
     
    200201     */
    201202    @Test
    202     public void testSpecialVariable() throws ParseError {
     203    void testSpecialVariable() throws ParseError {
    203204        TemplateParser parser = new TemplateParser("{name}u{special:localName}u{special:special:key}");
    204205        TemplateEntry templateEntry = parser.parse();
     
    210211
    211212    @Test
    212     public void testSearchExpression() throws Exception {
     213    void testSearchExpression() throws Exception {
    213214        compile("(parent type=type1 type=parent1) | (parent type=type2 type=parent2)");
    214215        //"parent(type=type1,type=parent1) | (parent(type=type2,type=parent2)"
     
    221222     */
    222223    @Test
    223     public void testSwitchContext() throws ParseError {
     224    void testSwitchContext() throws ParseError {
    224225        TemplateParser parser = new TemplateParser("!{parent() type=parent2 '{name}'}");
    225226        DatasetFactory ds = new DatasetFactory();
     
    242243
    243244    @Test
    244     public void testSetAnd() throws ParseError {
     245    void testSetAnd() throws ParseError {
    245246        TemplateParser parser = new TemplateParser("!{(parent(type=child) type=parent) & (parent type=child subtype=parent) '{name}'}");
    246247        DatasetFactory ds = new DatasetFactory();
     
    261262
    262263    @Test
    263     public void testSetOr() throws ParseError {
     264    void testSetOr() throws ParseError {
    264265        TemplateParser parser = new TemplateParser("!{(parent(type=type1) type=parent1) | (parent type=type2 type=parent2) '{name}'}");
    265266        DatasetFactory ds = new DatasetFactory();
     
    288289
    289290    @Test
    290     public void testMultilevel() throws ParseError {
     291    void testMultilevel() throws ParseError {
    291292        TemplateParser parser = new TemplateParser(
    292293                "!{(parent(parent(type=type1)) type=grandparent) | (parent type=type2 type=parent2) '{name}'}");
     
    320321    }
    321322
    322     @Test(expected = ParseError.class)
    323     public void testErrorsNot() throws ParseError {
     323    @Test
     324    void testErrorsNot() {
    324325        TemplateParser parser = new TemplateParser("!{-parent() '{name}'}");
    325         parser.parse();
    326     }
    327 
    328     @Test(expected = ParseError.class)
    329     public void testErrorOr() throws ParseError {
     326        assertThrows(ParseError.class, () -> parser.parse());
     327    }
     328
     329    @Test
     330    void testErrorOr() {
    330331        TemplateParser parser = new TemplateParser("!{parent() | type=type1 '{name}'}");
    331         parser.parse();
    332     }
    333 
    334     @Test
    335     public void testChild() throws ParseError {
     332        assertThrows(ParseError.class, () -> parser.parse());
     333    }
     334
     335    @Test
     336    void testChild() throws ParseError {
    336337        TemplateParser parser = new TemplateParser("!{((child(type=type1) type=child1) | (child type=type2 type=child2)) type=child2 '{name}'}");
    337338        DatasetFactory ds = new DatasetFactory();
     
    351352        parent2.addMember(new RelationMember("", child2));
    352353
    353 
    354354        StringBuilder sb = new StringBuilder();
    355355        TemplateEntry entry = parser.parse();
     
    360360
    361361    @Test
    362     public void testToStringCanBeParsedAgain() throws Exception {
     362    void testToStringCanBeParsedAgain() throws Exception {
    363363        final String s1 = "?{ '{name} ({desc})' | '{name} ({cmt})' | '{name}' | '{desc}' | '{cmt}' }";
    364364        final String s2 = new TemplateParser(s1).parse().toString();
Note: See TracChangeset for help on using the changeset viewer.