Ignore:
Timestamp:
2022-03-22T19:13:05+01:00 (3 years ago)
Author:
taylor.smock
Message:

fix #21768: Update deprecated functions in comfort0 (JUnit4 -> JUnit5)

Location:
applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/EditLevel0LActionTest.java

    r35629 r35934  
    1111import java.util.List;
    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.command.ChangePropertyCommand;
    1616import org.openstreetmap.josm.command.MoveCommand;
     
    2828import net.simon04.comfort0.level0l.parsergen.Level0LParser;
    2929import net.simon04.comfort0.level0l.parsergen.ParseException;
     30import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    3031
    31 public class EditLevel0LActionTest {
     32@BasicPreferences
     33class EditLevel0LActionTest {
    3234
    3335    /**
    3436     * Setup rule
    3537     */
    36     @Rule
     38    @RegisterExtension
    3739    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    38     public JOSMTestRules test = new JOSMTestRules().preferences().projection();
     40    JOSMTestRules test = new JOSMTestRules().projection();
    3941
    4042    private SequenceCommand buildChangeCommands(DataSet dataSet) throws ParseException {
     
    5557
    5658    @Test
    57     public void test() throws Exception {
     59    void test() throws Exception {
    5860        final Node node = new Node(1831881213, 42);
    5961        node.setCoor(new LatLon(54.0900666, 12.2539381));
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/OsmToLevel0LTest.java

    r35586 r35934  
    11package net.simon04.comfort0;
    22
    3 import static org.hamcrest.CoreMatchers.is;
    4 import static org.junit.Assert.assertThat;
    5 
    6 import java.io.InputStream;
    7 
    8 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    9 import org.junit.Before;
    10 import org.junit.Rule;
    11 import org.junit.Test;
    12 import org.openstreetmap.josm.data.Preferences;
     3import org.junit.jupiter.api.BeforeEach;
     4import org.junit.jupiter.api.Test;
    135import org.openstreetmap.josm.data.coor.LatLon;
    146import org.openstreetmap.josm.data.osm.DataSet;
    157import org.openstreetmap.josm.data.osm.Node;
    168import org.openstreetmap.josm.io.OsmReader;
    17 import org.openstreetmap.josm.testutils.JOSMTestRules;
     9import org.openstreetmap.josm.spi.preferences.Config;
     10import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1811
    19 public class OsmToLevel0LTest {
     12import java.io.InputStream;
    2013
    21     /**
    22      * Setup rule
    23      */
    24     @Rule
    25     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    26     public JOSMTestRules test = new JOSMTestRules().preferences();
     14import static org.hamcrest.CoreMatchers.is;
     15import static org.hamcrest.MatcherAssert.assertThat;
    2716
    28     @Before
    29     public void setUp() throws Exception {
    30         Preferences.main().putBoolean("osm-primitives.showcoor", true);
     17@BasicPreferences
     18class OsmToLevel0LTest {
     19
     20    @BeforeEach
     21    public void setUp() {
     22        Config.getPref().putBoolean("osm-primitives.showcoor", true);
    3123    }
    3224
    3325    @Test
    34     public void testNode() throws Exception {
     26    void testNode() {
    3527        final Node node = new Node(1234L, 42);
    3628        node.setCoor(new LatLon(123.45, 67.89));
     
    4436
    4537    @Test
    46     public void testLargerExample() throws Exception {
     38    void testLargerExample() throws Exception {
    4739        // from https://wiki.openstreetmap.org/wiki/OSM_XML#OSM_XML_file_format
    4840        // compare to https://wiki.openstreetmap.org/wiki/Level0L#Examples
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/level0l/parsergen/Level0LParserTest.java

    r35586 r35934  
    33import static org.CustomMatchers.hasSize;
    44import static org.hamcrest.CoreMatchers.is;
    5 import static org.junit.Assert.assertThat;
     5import static org.hamcrest.MatcherAssert.assertThat;
    66
    77import java.io.StringReader;
     
    99
    1010import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
    1312import org.openstreetmap.josm.data.osm.NodeData;
    1413import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
     
    1716import org.openstreetmap.josm.data.osm.WayData;
    1817import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.annotations.BasicPreferences;
    1919
    20 public class Level0LParserTest {
    21 
    22     /**
    23      * Setup rule
    24      */
    25     @Rule
    26     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    27     public JOSMTestRules test = new JOSMTestRules().preferences();
    28 
     20@BasicPreferences
     21class Level0LParserTest {
    2922    @Test
    30     public void testNode() throws Exception {
     23    void testNode() throws Exception {
    3124        final String level0l = "" +
    3225                "node 298884272: 54.0901447, 12.2516513\n" +
     
    4336
    4437    @Test
    45     public void testWay() throws Exception {
     38    void testWay() throws Exception {
    4639        final String level0l = "" +
    4740                "way 26659127\n" +
     
    6356
    6457    @Test
    65     public void testRelation() throws Exception {
     58    void testRelation() throws Exception {
    6659        final String level0l = "" +
    6760                "relation 56688 # member types: nd, wy, rel; roles are put after ids\n" +
     
    9083
    9184    @Test
    92     public void testExampleFromDocs() throws Exception {
     85    void testExampleFromDocs() throws Exception {
    9386        // https://wiki.openstreetmap.org/wiki/Level0L#Examples
    9487        final String level0l = "" +
Note: See TracChangeset for help on using the changeset viewer.