Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (11 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/history
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/history/CoordinateInfoViewerTest.java

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

    r10962 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Date;
    77
    8 import org.junit.Rule;
    9 import org.junit.Test;
     8import org.junit.jupiter.api.extension.RegisterExtension;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
    1111import org.openstreetmap.josm.data.osm.User;
     
    2222 * Unit tests of {@link HistoryBrowserDialog} class.
    2323 */
    24 public class HistoryBrowserDialogTest {
     24class HistoryBrowserDialogTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @Rule
     29    @RegisterExtension
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3131    public JOSMTestRules test = new JOSMTestRules();
     
    3535     */
    3636    @Test
    37     public void testBuildTitle() {
     37    void testBuildTitle() {
    3838        HistoryDataSet hds = new HistoryDataSet();
    3939        User user = User.createOsmUser(1, "");
  • trunk/test/unit/org/openstreetmap/josm/gui/history/HistoryBrowserModelTest.java

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

    r13435 r17275  
    22package org.openstreetmap.josm.gui.history;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
    77import java.io.InputStream;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212import org.openstreetmap.josm.data.osm.Node;
     
    3030 * Unit tests of {@link HistoryLoadTask} class.
    3131 */
    32 public class HistoryLoadTaskTest {
     32class HistoryLoadTaskTest {
    3333
    3434    /**
    3535     * Setup test.
    3636     */
    37     @Rule
     37    @RegisterExtension
    3838    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3939    public JOSMTestRules test = new JOSMTestRules().preferences().devAPI().timeout(20000);
     
    4343     */
    4444    @Test
    45     public void testGetLoadingMessage() {
     45    void testGetLoadingMessage() {
    4646        assertEquals("Loading history for node {0}", HistoryLoadTask.getLoadingMessage(new Node().getPrimitiveId()));
    4747        assertEquals("Loading history for way {0}", HistoryLoadTask.getLoadingMessage(new Way().getPrimitiveId()));
     
    5757     */
    5858    @Test
    59     public void testLoadHistory() throws OsmTransferException {
     59    void testLoadHistory() throws OsmTransferException {
    6060        HistoryDataSet ds = HistoryLoadTask.loadHistory(new OsmServerHistoryReader(OsmPrimitiveType.NODE, 0) {
    6161            @Override
  • trunk/test/unit/org/openstreetmap/josm/gui/history/NodeListViewerTest.java

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