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/layer
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/AbstractMapViewPaintableTest.java

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

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

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

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

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

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

    r11008 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77
    88/**
    99 * Test the {@link LayerPositionStrategy} class.
    1010 */
    11 public class LayerPositionStrategyTest {
     11class LayerPositionStrategyTest {
    1212
    1313    /**
     
    1515     */
    1616    @Test
    17     public void testNullManager() {
     17    void testNullManager() {
    1818        assertEquals(0, LayerPositionStrategy.inFrontOfFirst(l -> true).getPosition(null));
    1919        assertEquals(0, LayerPositionStrategy.afterLast(l -> true).getPosition(null));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/LayerTest.java

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

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

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

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

    r13165 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link NoteLayer} class.
    1414 */
    15 public class NoteLayerTest {
     15class NoteLayerTest {
    1616
    1717    /**
    1818     * Setup tests
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testTicket13208() {
     28    void testTicket13208() {
    2929        assertEquals("0 notes", new NoteLayer().getToolTipText());
    3030    }
     
    3434     */
    3535    @Test
    36     public void testInsertLineBreaks() {
     36    void testInsertLineBreaks() {
    3737        // empty string
    3838        assertEquals("", NoteLayer.insertLineBreaks(""));
     
    6161     */
    6262    @Test
    63     public void testReplaceLinks() {
     63    void testReplaceLinks() {
    6464        // empty string
    6565        assertEquals("", NoteLayer.replaceLinks(""));
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

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

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

    r14138 r17275  
    22package org.openstreetmap.josm.gui.layer;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotNull;
     7import static org.junit.jupiter.api.Assertions.assertTrue;
    88
    9 import org.junit.Rule;
    10 import org.junit.Test;
     9import org.junit.jupiter.api.extension.RegisterExtension;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.data.osm.DataSet;
    1212import org.openstreetmap.josm.gui.MainApplication;
     
    1818 * Unit tests of {@link ValidatorLayer} class.
    1919 */
    20 public class ValidatorLayerTest {
     20class ValidatorLayerTest {
    2121
    2222    /**
    2323     * Setup tests
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    3131     */
    3232    @Test
    33     public void testValidatorLayer() {
     33    void testValidatorLayer() {
    3434        MainApplication.getLayerManager().addLayer(new OsmDataLayer(new DataSet(), "", null));
    3535        ValidatorLayer layer = new ValidatorLayer();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/WMSLayerTest.java

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

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

    r16006 r17275  
    22package org.openstreetmap.josm.gui.layer.geoimage;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Collections;
    77
    8 import org.junit.BeforeClass;
    9 import org.junit.Rule;
    10 import org.junit.Test;
     8import org.junit.jupiter.api.BeforeAll;
     9import org.junit.jupiter.api.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
    1111import org.openstreetmap.josm.data.gpx.GpxData;
    1212import org.openstreetmap.josm.data.gpx.GpxTimeOffset;
     
    2323 * Unit tests of {@link CorrelateGpxWithImages} class.
    2424 */
    25 public class CorrelateGpxWithImagesTest {
     25class CorrelateGpxWithImagesTest {
    2626
    2727    /**
    2828     * Setup test.
    2929     */
    30     @Rule
     30    @RegisterExtension
    3131    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3232    public JOSMTestRules test = new JOSMTestRules();
     
    3535     * Setup test.
    3636     */
    37     @BeforeClass
     37    @BeforeAll
    3838    public static void setUp() {
    3939        DateUtilsTest.setTimeZone(DateUtils.UTC);
     
    4545     */
    4646    @Test
    47     public void testAutoGuess() throws Exception {
     47    void testAutoGuess() throws Exception {
    4848        final GpxData gpx = GpxReaderTest.parseGpxData("nodist/data/2094047.gpx");
    4949        final ImageEntry i0 = new ImageEntry();
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayerTest.java

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

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

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

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

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

    r16850 r17275  
    22package org.openstreetmap.josm.gui.layer.gpx;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertNull;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    77
    88import java.util.Collections;
    99
    10 import org.junit.Rule;
    11 import org.junit.Test;
     10import org.junit.jupiter.api.extension.RegisterExtension;
     11import org.junit.jupiter.api.Test;
    1212import org.openstreetmap.josm.TestUtils;
    1313import org.openstreetmap.josm.data.gpx.GpxData;
     
    2525 * Unit tests of {@link DownloadAlongTrackAction} class.
    2626 */
    27 public class DownloadAlongTrackActionTest {
     27class DownloadAlongTrackActionTest {
    2828
    2929    /**
    3030     * The test rules for this test
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    7272     */
    7373    @Test
    74     public void testDownload() throws Exception {
     74    void testDownload() throws Exception {
    7575        assertNotNull(createTask("minimal.gpx"));
    7676    }
     
    8181     */
    8282    @Test
    83     public void testDownloadEmpty() throws Exception {
     83    void testDownloadEmpty() throws Exception {
    8484        assertNull(createTask("empty.gpx"));
    8585    }
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java

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

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

    r10547 r17275  
    22package org.openstreetmap.josm.gui.layer.imagery;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1414 * @author Michael Zangl
    1515 */
    16 public class GammaImageProcessorTest {
     16class GammaImageProcessorTest {
    1717
    1818    /**
    1919     * No special rules
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testSetGet() {
     29    void testSetGet() {
    3030        GammaImageProcessor processor = new GammaImageProcessor();
    3131
     
    5555     */
    5656    @Test
    57     public void testToString() {
     57    void testToString() {
    5858        GammaImageProcessor processor = new GammaImageProcessor();
    5959        assertEquals("GammaImageProcessor [gamma=1.0]", processor.toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/imagery/SharpenImageProcessorTest.java

    r10556 r17275  
    22package org.openstreetmap.josm.gui.layer.imagery;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1414 * @author Michael Zangl
    1515 */
    16 public class SharpenImageProcessorTest {
     16class SharpenImageProcessorTest {
    1717
    1818    /**
    1919     * No special rules
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules();
     
    2727     */
    2828    @Test
    29     public void testSetGet() {
     29    void testSetGet() {
    3030        SharpenImageProcessor processor = new SharpenImageProcessor();
    3131
     
    5555     */
    5656    @Test
    57     public void testToString() {
     57    void testToString() {
    5858        SharpenImageProcessor processor = new SharpenImageProcessor();
    5959        assertEquals("SharpenImageProcessor [sharpenLevel=1.0]", processor.toString());
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java

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

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

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

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

    r17125 r17275  
    2525 * Unit tests of {@link WebMarker} class.
    2626 */
    27 public class WebMarkerTest {
     27class WebMarkerTest {
    2828
    2929    /**
     
    4141     */
    4242    @Test
    43     public void testWebMarker(@Injectable final PlatformHook mockPlatformHook,
     43    void testWebMarker(@Injectable final PlatformHook mockPlatformHook,
    4444                              @Mocked final PlatformManager platformManager) throws Exception {
    4545        TestUtils.assumeWorkingJMockit();
Note: See TracChangeset for help on using the changeset viewer.