Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (12 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/gui/conflict
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/ConflictResolverTest.java

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

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

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.nodes;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link NodeListMerger} class.
    1414 */
    15 public class NodeListMergerTest {
     15class NodeListMergerTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testNodeListMerger() {
     28    void testNodeListMerger() {
    2929        assertNotNull(new NodeListMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/properties/PropertiesMergeModelTest.java

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

    r12045 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.properties;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.TestUtils;
    99import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1414 * Unit tests of {@link PropertiesMerger} class.
    1515 */
    16 public class PropertiesMergerTest {
     16class PropertiesMergerTest {
    1717
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2727     */
    2828    @Test
    29     public void testPropertiesMerger() {
     29    void testPropertiesMerger() {
    3030        PropertiesMerger merger = new PropertiesMerger();
    3131        assertNotNull(TestUtils.getComponentByName(merger, "button.keepmycoordinates"));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberMergerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link RelationMemberMerger} class.
    1414 */
    15 public class RelationMemberMergerTest {
     15class RelationMemberMergerTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testRelationMemberMerger() {
     28    void testRelationMemberMerger() {
    2929        assertNotNull(new RelationMemberMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellEditorTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    77
    88import java.awt.Component;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.data.osm.Node;
    1313import org.openstreetmap.josm.data.osm.RelationMember;
     
    1919 * Unit tests of {@link RelationMemberTableCellEditor} class.
    2020 */
    21 public class RelationMemberTableCellEditorTest {
     21class RelationMemberTableCellEditorTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3232     */
    3333    @Test
    34     public void testRelationMemberTableCellEditor() {
     34    void testRelationMemberTableCellEditor() {
    3535        RelationMemberTableCellEditor editor = new RelationMemberTableCellEditor();
    3636        assertNull(editor.getTableCellEditorComponent(null, null, false, 0, 0));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/relation/RelationMemberTableCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.relation;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import javax.swing.JTable;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.osm.Node;
    1111import org.openstreetmap.josm.data.osm.RelationMember;
     
    1919 * Unit tests of {@link RelationMemberTableCellRenderer} class.
    2020 */
    21 public class RelationMemberTableCellRendererTest {
     21class RelationMemberTableCellRendererTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3232     */
    3333    @Test
    34     public void testRelationMemberTableCellRenderer() {
     34    void testRelationMemberTableCellRenderer() {
    3535        JTable table = new JTable(new NodeListMergeModel().new EntriesTableModel(ListRole.MY_ENTRIES));
    3636        RelationMember member = new RelationMember("foo", new Node());
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergeItemTest.java

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

    r14092 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.tags;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNull;
    66
    77import java.beans.PropertyChangeListener;
     
    99import java.util.Set;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.TestUtils;
    1414import org.openstreetmap.josm.data.osm.Node;
     
    2222 */
    2323@SuppressWarnings("unchecked")
    24 public class TagMergeModelTest {
     24class TagMergeModelTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules();
     
    4040
    4141    @Test
    42     public void testAddPropertyChangeListener() throws ReflectiveOperationException {
     42    void testAddPropertyChangeListener() throws ReflectiveOperationException {
    4343        TagMergeModel model = new TagMergeModel();
    4444        PropertyChangeListener listener = evt -> {
     
    5353
    5454    @Test
    55     public void testRemovePropertyChangeListener() throws ReflectiveOperationException {
     55    void testRemovePropertyChangeListener() throws ReflectiveOperationException {
    5656        TagMergeModel model = new TagMergeModel();
    5757        PropertyChangeListener listener = evt -> {
     
    6666
    6767    @Test
    68     public void testPopulateNoConflichts() throws ReflectiveOperationException {
     68    void testPopulateNoConflichts() throws ReflectiveOperationException {
    6969        Node my = new Node(1);
    7070        Node their = new Node(1);
     
    7878
    7979    @Test
    80     public void testPopulateNoConflicts1() throws ReflectiveOperationException {
     80    void testPopulateNoConflicts1() throws ReflectiveOperationException {
    8181        Node my = new Node(1);
    8282        my.put("key", "value");
     
    9292
    9393    @Test
    94     public void testPopulateMissingKeyMine() throws ReflectiveOperationException {
     94    void testPopulateMissingKeyMine() throws ReflectiveOperationException {
    9595        Node my = new Node(1);
    9696        Node their = new Node(1);
     
    110110
    111111    @Test
    112     public void testPopulateMissingKeyTheir() throws ReflectiveOperationException {
     112    void testPopulateMissingKeyTheir() throws ReflectiveOperationException {
    113113        Node my = new Node(1);
    114114        my.put("key", "value");
     
    128128
    129129    @Test
    130     public void testPopulateConflictingValues() throws ReflectiveOperationException {
     130    void testPopulateConflictingValues() throws ReflectiveOperationException {
    131131        Node my = new Node(1);
    132132        my.put("key", "myvalue");
     
    147147
    148148    @Test
    149     public void testAddItem() throws ReflectiveOperationException {
     149    void testAddItem() throws ReflectiveOperationException {
    150150        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    151151        TagMergeModel model = new TagMergeModel();
     
    163163
    164164    @Test
    165     public void testDecide() throws ReflectiveOperationException {
     165    void testDecide() throws ReflectiveOperationException {
    166166        TagMergeItem item = new TagMergeItem("key", "myvalue", "theirvalue");
    167167        TagMergeModel model = new TagMergeModel();
     
    187187
    188188    @Test
    189     public void testDecideMultiple() throws ReflectiveOperationException {
     189    void testDecideMultiple() throws ReflectiveOperationException {
    190190
    191191        TagMergeModel model = new TagMergeModel();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/pair/tags/TagMergerTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.pair.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link TagMerger} class.
    1414 */
    15 public class TagMergerTest {
     15class TagMergerTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testTagMerger() {
     28    void testTagMerger() {
    2929        assertNotNull(new TagMerger());
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditorTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link MultiValueCellEditor} class.
    1414 */
    15 public class MultiValueCellEditorTest {
     15class MultiValueCellEditorTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testMultiValueCellEditor() {
     28    void testMultiValueCellEditor() {
    2929        assertNotNull(new MultiValueCellEditor().getTableCellEditorComponent(null, new MultiValueResolutionDecision(), false, 0, 0));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellRendererTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
    66
    77import java.util.Arrays;
     
    1010import javax.swing.JTable;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.osm.Tag;
    1515import org.openstreetmap.josm.data.osm.TagCollection;
     
    2121 * Unit tests of {@link MultiValueCellRenderer} class.
    2222 */
    23 public class MultiValueCellRendererTest {
     23class MultiValueCellRendererTest {
    2424
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3434     */
    3535    @Test
    36     public void testMultiValueCellRenderer() {
     36    void testMultiValueCellRenderer() {
    3737        TagConflictResolverModel model = new TagConflictResolverModel();
    3838        TagCollection tags = new TagCollection(Arrays.asList(new Tag("oneway", "yes"), new Tag("oneway", "no")));
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/PasteTagsConflictResolverDialogTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertNull;
    88
    99import java.awt.Insets;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1414import org.openstreetmap.josm.gui.conflict.tags.PasteTagsConflictResolverDialog.StatisticsInfo;
     
    2222 * Unit tests of {@link PasteTagsConflictResolverDialog} class.
    2323 */
    24 public class PasteTagsConflictResolverDialogTest {
     24class PasteTagsConflictResolverDialogTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules();
     
    3535     */
    3636    @Test
    37     public void testPaneTitles() {
     37    void testPaneTitles() {
    3838        assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES);
    3939        assertNotNull(PasteTagsConflictResolverDialog.PANE_TITLES.get(OsmPrimitiveType.NODE));
     
    4646     */
    4747    @Test
    48     public void testStatisticsInfoTable() {
     48    void testStatisticsInfoTable() {
    4949        StatisticsInfo info = new StatisticsInfo();
    5050        StatisticsTableModel model = new StatisticsTableModel();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModelTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.util.Arrays;
     
    1010import java.util.List;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.osm.DataSet;
     
    2525 * Unit tests of {@link RelationMemberConflictResolverModel} class.
    2626 */
    27 public class RelationMemberConflictResolverModelTest {
     27class RelationMemberConflictResolverModelTest {
    2828
    2929    /**
    3030     * Setup test.
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    5858
    5959    @Test
    60     public void testSameRoles() throws Exception {
     60    void testSameRoles() throws Exception {
    6161        final List<Way> ways = buildTestDataSet();
    6262        final Relation r = new Relation();
     
    7676
    7777    @Test
    78     public void testDifferentRoles() throws Exception {
     78    void testDifferentRoles() throws Exception {
    7979        final List<Way> ways = buildTestDataSet();
    8080        final Relation r = new Relation();
     
    8989
    9090    @Test
    91     public void testDifferentPresence() throws Exception {
     91    void testDifferentPresence() throws Exception {
    9292        final List<Way> ways = buildTestDataSet();
    9393        final Relation r = new Relation();
     
    101101
    102102    @Test
    103     public void testEveryMemberIsPresentTwice() throws Exception {
     103    void testEveryMemberIsPresentTwice() throws Exception {
    104104        final List<Way> ways = buildTestDataSet();
    105105        final Relation r = new Relation();
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverTest.java

    r10962 r17275  
    22package org.openstreetmap.josm.gui.conflict.tags;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link RelationMemberConflictResolver} class.
    1414 */
    15 public class RelationMemberConflictResolverTest {
     15class RelationMemberConflictResolverTest {
    1616
    1717    /**
    1818     * Setup test.
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2626     */
    2727    @Test
    28     public void testRelationMemberConflictResolver() {
     28    void testRelationMemberConflictResolver() {
    2929        assertNotNull(new RelationMemberConflictResolver(null));
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/gui/conflict/tags/TagConflictResolutionUtilTest.java

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