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

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

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

Location:
trunk/test/unit/org/openstreetmap/josm/command
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • 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()
Note: See TracChangeset for help on using the changeset viewer.