Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (3 years 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/io
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/CapabilitiesTest.java

    r17212 r17275  
    22package org.openstreetmap.josm.io;
    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.io.InputStream;
     
    1111import java.util.Collections;
    1212
    13 import org.junit.Test;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.TestUtils;
    1515import org.xml.sax.InputSource;
     
    1818 * Unit tests of {@link Capabilities} class.
    1919 */
    20 public class CapabilitiesTest {
     20class CapabilitiesTest {
    2121
    2222    /**
     
    2626     */
    2727    @Test
    28     public void testCapabilities() throws Exception {
     28    void testCapabilities() throws Exception {
    2929        final Path path = Paths.get(TestUtils.getTestDataRoot(), "__files/api/0.6/capabilities");
    3030        final Capabilities capabilities;
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTest.java

    r16182 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import org.junit.Rule;
    5 import org.junit.Test;
     4import org.junit.jupiter.api.extension.RegisterExtension;
     5import org.junit.jupiter.api.Test;
    66import org.openstreetmap.josm.testutils.JOSMTestRules;
    77
     
    1212 * Unit tests of {@link CertificateAmendment} class.
    1313 */
    14 public class CertificateAmendmentTest {
     14class CertificateAmendmentTest {
    1515
    1616    /**
    1717     * Setup rule
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testUtilityClass() throws ReflectiveOperationException {
     28    void testUtilityClass() throws ReflectiveOperationException {
    2929        UtilityClassTestUtil.assertUtilityClassWellDefined(CertificateAmendment.class);
    3030    }
  • trunk/test/unit/org/openstreetmap/josm/io/CertificateAmendmentTestIT.java

    r15509 r17275  
    1313
    1414import org.junit.Assert;
    15 import org.junit.BeforeClass;
    1615import org.junit.ClassRule;
    17 import org.junit.Test;
     16import org.junit.jupiter.api.BeforeAll;
     17import org.junit.jupiter.api.Test;
    1818import org.openstreetmap.josm.TestUtils;
    1919import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2424 * Integration tests of {@link CertificateAmendment} class.
    2525 */
    26 public class CertificateAmendmentTestIT {
     26class CertificateAmendmentTestIT {
    2727
    2828    /**
     
    3939     * @throws IOException in case of I/O error
    4040     */
    41     @BeforeClass
     41    @BeforeAll
    4242    public static void beforeClass() throws IOException {
    4343        errorsToIgnore.addAll(TestUtils.getIgnoredErrorMessages(CertificateAmendmentTestIT.class));
     
    4949     */
    5050    @Test
    51     public void testDefault() throws IOException {
     51    void testDefault() throws IOException {
    5252        // something that is not embedded
    5353        connect("https://www.bing.com", true);
     
    5959     */
    6060    @Test
    61     public void testLetsEncrypt() throws IOException {
     61    void testLetsEncrypt() throws IOException {
    6262        // signed by letsencrypt's own ISRG root
    6363        connect("https://valid-isrgrootx1.letsencrypt.org", true);
     
    7373     */
    7474    @Test
    75     public void testOverpass() throws IOException {
     75    void testOverpass() throws IOException {
    7676        connect("https://overpass-api.de", true);
    7777    }
     
    8282     */
    8383    @Test
    84     public void testDutchGovernment() throws IOException {
     84    void testDutchGovernment() throws IOException {
    8585        connect("https://geodata.nationaalgeoregister.nl", true);
    8686    }
     
    9191     */
    9292    @Test
    93     public void testTaiwanGovernment() throws IOException {
     93    void testTaiwanGovernment() throws IOException {
    9494        connect("https://grca.nat.gov.tw", true);
    9595    }
  • trunk/test/unit/org/openstreetmap/josm/io/ChangesetQueryUrlParserTest.java

    r14068 r17275  
    22package org.openstreetmap.josm.io;
    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;
    8 import static org.junit.Assert.fail;
     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;
     8import static org.junit.jupiter.api.Assertions.fail;
    99
    1010import java.time.OffsetDateTime;
     
    1212import java.util.Arrays;
    1313
    14 import org.junit.Test;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlException;
    1616import org.openstreetmap.josm.io.ChangesetQuery.ChangesetQueryUrlParser;
     
    2020 * Unit tests of {@link ChangesetQueryUrlParser} class
    2121 */
    22 public class ChangesetQueryUrlParserTest {
     22class ChangesetQueryUrlParserTest {
    2323
    2424    /**
     
    2727     */
    2828    @Test
    29     public void testParseBasic() throws ChangesetQueryUrlException {
     29    void testParseBasic() throws ChangesetQueryUrlException {
    3030        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    3131
     
    5656     */
    5757    @Test
    58     public void testUid() throws ChangesetQueryUrlException {
     58    void testUid() throws ChangesetQueryUrlException {
    5959        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    6060        ChangesetQuery q;
     
    7474     */
    7575    @Test
    76     public void testDisplayName() throws ChangesetQueryUrlException {
     76    void testDisplayName() throws ChangesetQueryUrlException {
    7777        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    7878        ChangesetQuery q;
     
    8989     */
    9090    @Test
    91     public void testOpen() throws ChangesetQueryUrlException {
     91    void testOpen() throws ChangesetQueryUrlException {
    9292        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    9393        ChangesetQuery q;
     
    112112     */
    113113    @Test
    114     public void testClosed() throws ChangesetQueryUrlException {
     114    void testClosed() throws ChangesetQueryUrlException {
    115115        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    116116        ChangesetQuery q;
     
    134134     */
    135135    @Test
    136     public void testUidAndDisplayName() {
     136    void testUidAndDisplayName() {
    137137        shouldFail("uid=1&display_name=abcd");
    138138    }
     
    143143     */
    144144    @Test
    145     public void testTime() throws ChangesetQueryUrlException {
     145    void testTime() throws ChangesetQueryUrlException {
    146146        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    147147        ChangesetQuery q;
     
    169169     */
    170170    @Test
    171     public void testBbox() throws ChangesetQueryUrlException {
     171    void testBbox() throws ChangesetQueryUrlException {
    172172        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    173173        ChangesetQuery q;
     
    191191     */
    192192    @Test
    193     public void testChangesetIds() throws ChangesetQueryUrlException {
     193    void testChangesetIds() throws ChangesetQueryUrlException {
    194194        ChangesetQueryUrlParser parser = new ChangesetQueryUrlParser();
    195195        ChangesetQuery q;
  • trunk/test/unit/org/openstreetmap/josm/io/DiffResultProcessorTest.java

    r14046 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.util.Arrays;
     
    1010import java.util.Set;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.osm.Changeset;
     
    3131 * Unit tests of {@link DiffResultProcessor}
    3232 */
    33 public class DiffResultProcessorTest {
     33class DiffResultProcessorTest {
    3434
    3535    /**
    3636     * Setup rule
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules();
     
    5353     */
    5454    @Test
    55     public void testConstructor() {
     55    void testConstructor() {
    5656        Node n = new Node(1);
    5757        // these calls should not fail
     
    6666     */
    6767    @Test
    68     public void testParse_NOK_Cases() {
     68    void testParse_NOK_Cases() {
    6969        shouldFail(null);
    7070        shouldFail("");
     
    7777     */
    7878    @Test
    79     public void testParse_OK_Cases() throws XmlParsingException {
     79    void testParse_OK_Cases() throws XmlParsingException {
    8080        DiffResultProcessor processor = new DiffResultProcessor(null);
    8181        String doc =
     
    112112     */
    113113    @Test
    114     public void testPostProcess_Invocation_Variants() throws XmlParsingException {
     114    void testPostProcess_Invocation_Variants() throws XmlParsingException {
    115115        DiffResultProcessor processor = new DiffResultProcessor(null);
    116116        String doc =
     
    136136     */
    137137    @Test
    138     public void testPostProcess_OK() throws XmlParsingException {
     138    void testPostProcess_OK() throws XmlParsingException {
    139139
    140140        Node n = new Node();
     
    171171     */
    172172    @Test
    173     public void testPostProcess_ForCreatedElement() throws XmlParsingException {
     173    void testPostProcess_ForCreatedElement() throws XmlParsingException {
    174174
    175175        Node n = new Node();
     
    193193     */
    194194    @Test
    195     public void testPostProcess_ForModifiedElement() throws XmlParsingException {
     195    void testPostProcess_ForModifiedElement() throws XmlParsingException {
    196196
    197197        Node n = new Node(1);
     
    218218     */
    219219    @Test
    220     public void testPostProcess_ForDeletedElement() throws XmlParsingException {
     220    void testPostProcess_ForDeletedElement() throws XmlParsingException {
    221221
    222222        Node n = new Node(1);
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONReaderTest.java

    r17185 r17275  
    22package org.openstreetmap.josm.io;
    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;
    88import static org.junit.jupiter.api.Assertions.assertThrows;
    99
     
    1919import java.util.stream.IntStream;
    2020
    21 import org.junit.Rule;
    22 import org.junit.Test;
     21import org.junit.jupiter.api.extension.RegisterExtension;
     22import org.junit.jupiter.api.Test;
    2323import org.openstreetmap.josm.TestUtils;
    2424import org.openstreetmap.josm.data.coor.LatLon;
     
    3232 * Unit tests of {@link GeoJSONReader}.
    3333 */
    34 public class GeoJSONReaderTest {
     34class GeoJSONReaderTest {
    3535
    3636    /**
    3737     * Setup test.
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    public JOSMTestRules rules = new JOSMTestRules();
    4141
     
    4545     */
    4646    @Test
    47     public void testReadGeoJson() throws Exception {
     47    void testReadGeoJson() throws Exception {
    4848        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geo.json"))) {
    4949            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    6060     */
    6161    @Test
    62     public void testReadLineByLineGeoJSON() throws Exception {
     62    void testReadLineByLineGeoJSON() throws Exception {
    6363        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geoLineByLine.json"))) {
    6464            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    150150     */
    151151    @Test
    152     public void testReadGeoJsonNamedCrs() throws Exception {
     152    void testReadGeoJsonNamedCrs() throws Exception {
    153153        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "geocrs.json"))) {
    154154            final List<OsmPrimitive> primitives = new ArrayList<>(new GeoJSONReader()
     
    165165     */
    166166    @Test
    167     public void testReadGeoJsonWithoutType() {
     167    void testReadGeoJsonWithoutType() {
    168168        assertThrows(IllegalDataException.class, () ->
    169169                new GeoJSONReader().doParseDataSet(new ByteArrayInputStream("{}".getBytes(StandardCharsets.UTF_8)), null));
     
    193193     */
    194194    @Test
    195     public void testTicket19822() throws Exception {
     195    void testTicket19822() throws Exception {
    196196        try (InputStream in = TestUtils.getRegressionDataStream(19822, "data.geojson")) {
    197197            final List<OsmPrimitive> primitives = new ArrayList<>(
     
    207207     */
    208208    @Test
    209     public void testTicket19822Nested() throws Exception {
     209    void testTicket19822Nested() throws Exception {
    210210        try (InputStream in = TestUtils.getRegressionDataStream(19822, "problem3.geojson")) {
    211211            final List<OsmPrimitive> primitives = new ArrayList<>(
  • trunk/test/unit/org/openstreetmap/josm/io/GeoJSONWriterTest.java

    r16936 r17275  
    22package org.openstreetmap.josm.io;
    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.io.InputStream;
     
    1010import java.util.Arrays;
    1111
    12 import org.junit.BeforeClass;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.BeforeAll;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.JOSMFixture;
    1515import org.openstreetmap.josm.TestUtils;
     
    2222 * Unit tests of {@link GeoJSONWriter} class.
    2323 */
    24 public class GeoJSONWriterTest {
     24class GeoJSONWriterTest {
    2525
    2626    /**
    2727     * Setup test.
    2828     */
    29     @BeforeClass
     29    @BeforeAll
    3030    public static void setUp() {
    3131        JOSMFixture.createUnitTestFixture().init();
     
    3636     */
    3737    @Test
    38     public void testPoint() {
     38    void testPoint() {
    3939        final Node node = new Node(new LatLon(12.3, 4.56));
    4040        node.put("name", "foo");
     
    7575     */
    7676    @Test
    77     public void testLineString() {
     77    void testLineString() {
    7878        final DataSet ds = new DataSet();
    7979        final Node n1 = new Node(new LatLon(12.3, 4.56));
     
    119119     */
    120120    @Test
    121     public void testMultipolygon() throws Exception {
     121    void testMultipolygon() throws Exception {
    122122        try (InputStream in = Files.newInputStream(Paths.get(TestUtils.getTestDataRoot(), "multipolygon.osm"))) {
    123123            DataSet ds = OsmReader.parseDataSet(in, null);
     
    132132     */
    133133    @Test
    134     public void testMultipolygonRobustness() throws Exception {
     134    void testMultipolygonRobustness() throws Exception {
    135135        try (InputStream in = Files.newInputStream(Paths.get("nodist/data/multipolygon.osm"))) {
    136136            DataSet ds = OsmReader.parseDataSet(in, null);
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io;
    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.ByteArrayInputStream;
     
    1415import java.util.Map;
    1516
    16 import org.junit.Rule;
    17 import org.junit.Test;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.extension.RegisterExtension;
    1819import org.openstreetmap.josm.TestUtils;
    1920import org.openstreetmap.josm.data.Bounds;
     
    3435     * Setup rule
    3536     */
    36     @Rule
     37    @RegisterExtension
    3738    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3839    public JOSMTestRules test = new JOSMTestRules();
     
    6061     */
    6162    @Test
    62     public void testMunich() throws Exception {
     63    void testMunich() throws Exception {
    6364        final GpxData result = parseGpxData("nodist/data/munich.gpx");
    6465        assertEquals(2762, result.getTracks().size());
     
    7677     */
    7778    @Test
    78     public void testLayerPrefs() throws Exception {
     79    void testLayerPrefs() throws Exception {
    7980        final GpxData data = parseGpxData(TestUtils.getTestDataRoot() + "tracks/tracks-layerprefs.gpx");
    8081        Map<String, String> e = new HashMap<>();
     
    9394     * @throws Exception always SAXException
    9495     */
    95     @Test(expected = SAXException.class)
    96     public void testException() throws Exception {
    97         new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true);
     96    @Test
     97    void testException() throws Exception {
     98        assertThrows(SAXException.class,
     99                () -> new GpxReader(new ByteArrayInputStream("--foo--bar--".getBytes(StandardCharsets.UTF_8))).parse(true));
    98100    }
    99101
     
    104106     */
    105107    @Test
    106     public void testTicket15634() throws IOException, SAXException {
     108    void testTicket15634() throws IOException, SAXException {
    107109        assertEquals(new Bounds(53.7229357, -7.9135019, 53.9301103, -7.59656),
    108110                GpxReaderTest.parseGpxData(TestUtils.getRegressionDataFile(15634, "drumlish.gpx")).getMetaBounds());
  • trunk/test/unit/org/openstreetmap/josm/io/GpxWriterTest.java

    r17149 r17275  
    1515import java.util.function.Consumer;
    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.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    3737     * Setup rule
    3838     */
    39     @Rule
     39    @RegisterExtension
    4040    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4141    public JOSMTestRules test = new JOSMTestRules();
     
    6868     */
    6969    @Test
    70     public void testTicket16550() throws IOException {
     70    void testTicket16550() throws IOException {
    7171        // Checks that time stored as date is correctly written into XML timestamp
    7272        testSingleWaypoint(
     
    8080     */
    8181    @Test
    82     public void testTicket16725() throws IOException {
     82    void testTicket16725() throws IOException {
    8383        // Checks that sat, hdop, pdop, vdop are correctly exported
    8484        testSingleWaypoint(
     
    100100     */
    101101    @Test
    102     public void testExtensions() throws IOException {
     102    void testExtensions() throws IOException {
    103103        GpxData data = new GpxData();
    104104        // only namespace, no location printed
  • trunk/test/unit/org/openstreetmap/josm/io/MultiFetchOverpassObjectReaderTest.java

    r16612 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77import java.util.List;
    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.Node;
    1212import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2020 * Unit tests of {@link MultiFetchOverpassObjectReader}.
    2121 */
    22 public class MultiFetchOverpassObjectReaderTest {
     22class MultiFetchOverpassObjectReaderTest {
    2323
    2424    /**
    2525     * Setup test.
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3333     */
    3434    @Test
    35     public void testBuildRequestNodesString() {
     35    void testBuildRequestNodesString() {
    3636        List<OsmPrimitive> objects = Arrays.asList(new Node(123), new Node(126), new Node(130));
    3737        String requestString;
     
    6161     */
    6262    @Test
    63     public void testBuildRequestWaysString() {
     63    void testBuildRequestWaysString() {
    6464        List<OsmPrimitive> objects = Arrays.asList(new Way(123), new Way(126), new Way(130));
    6565        String requestString;
     
    8686     */
    8787    @Test
    88     public void testBuildRequestRelationsString() {
     88    void testBuildRequestRelationsString() {
    8989        List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130));
    9090        String requestString;
     
    112112     */
    113113    @Test
    114     public void testBuildComplexString() {
     114    void testBuildComplexString() {
    115115        List<OsmPrimitive> objects = Arrays.asList(new Relation(123), new Relation(126), new Relation(130), new Way(88), new Way(99),
    116116                new Node(1));
  • trunk/test/unit/org/openstreetmap/josm/io/NameFinderTest.java

    r14015 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.StringReader;
     
    88import java.util.stream.Collectors;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111
    1212/**
    1313 * Unit tests of {@link NameFinder} class.
    1414 */
    15 public class NameFinderTest {
     15class NameFinderTest {
    1616
    1717    // CHECKSTYLE.OFF: LineLength
     
    4141     */
    4242    @Test
    43     public void testParseSearchResults() throws Exception {
     43    void testParseSearchResults() throws Exception {
    4444        try (StringReader reader = new StringReader(SAMPLE)) {
    4545            assertEquals(Arrays.asList(
  • trunk/test/unit/org/openstreetmap/josm/io/NetworkManagerTest.java

    r16426 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.net.MalformedURLException;
     
    1010import java.util.Map;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.testutils.JOSMTestRules;
    1515
     
    1919 * Unit tests of {@link NetworkManager} class.
    2020 */
    21 public class NetworkManagerTest {
     21class NetworkManagerTest {
    2222
    2323    /**
    2424     * Setup test.
    2525     */
    26     @Rule
     26    @RegisterExtension
    2727    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2828    public JOSMTestRules test = new JOSMTestRules().https().devAPI().main().projection();
     
    3535     */
    3636    @Test
    37     public void testNetworkErrors() throws MalformedURLException {
     37    void testNetworkErrors() throws MalformedURLException {
    3838        NetworkManager.clearNetworkErrors();
    3939        assertTrue(NetworkManager.getNetworkErrors().isEmpty());
     
    5252     */
    5353    @Test
    54     public void testOfflineResources() {
     54    void testOfflineResources() {
    5555        NetworkManager.setOnline(OnlineResource.ALL);
    5656        assertFalse(NetworkManager.isOffline("http://www.example.com/"));
  • trunk/test/unit/org/openstreetmap/josm/io/NoteReaderTest.java

    r10134 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
    77import java.util.List;
    88
    9 import org.junit.Test;
     9import org.junit.jupiter.api.Test;
    1010import org.openstreetmap.josm.data.coor.LatLon;
    1111import org.openstreetmap.josm.data.notes.Note;
     
    2020 * Unit tests of {@link NoteReader} class.
    2121 */
    22 public class NoteReaderTest {
     22class NoteReaderTest {
    2323
    2424    /**
     
    2828     */
    2929    @Test
    30     public void testNoteReader() throws SAXException, IOException {
     30    void testNoteReader() throws SAXException, IOException {
    3131        List<Note> list = new NoteReader(
    3232            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"+
     
    8989     */
    9090    @Test
    91     public void testTicket12393() throws Exception {
     91    void testTicket12393() throws Exception {
    9292        // CHECKSTYLE.OFF: LineLength
    9393        new NoteReader(
  • trunk/test/unit/org/openstreetmap/josm/io/OsmApiExceptionTest.java

    r14810 r17275  
    22package org.openstreetmap.josm.io;
    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
    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.testutils.JOSMTestRules;
    1010
     
    1414 * Unit tests of {@link OsmApiException} class.
    1515 */
    16 public class OsmApiExceptionTest {
     16class OsmApiExceptionTest {
    1717
    1818    /**
    1919     * Setup tests
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2727     */
    2828    @Test
    29     public void testTicket17328() {
     29    void testTicket17328() {
    3030        assertFalse(new OsmApiException(503, "foo", "bar").isHtml());
    3131        assertTrue(new OsmApiException(503, null, "<h2>This website is under heavy load (queue full)</h2><p>Sorry...</p>").isHtml());
  • trunk/test/unit/org/openstreetmap/josm/io/OsmApiTest.java

    r10051 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.ByteArrayInputStream;
    77import java.nio.charset.StandardCharsets;
    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.osm.Changeset;
     
    1717 * Unit tests of {@link OsmApi} class.
    1818 */
    19 public class OsmApiTest {
     19class OsmApiTest {
    2020
    2121    /**
    2222     * Setup test.
    2323     */
    24     @BeforeClass
     24    @BeforeAll
    2525    public static void setUp() {
    2626        JOSMFixture.createUnitTestFixture().init();
     
    3232     */
    3333    @Test
    34     public void testTicket12675() throws IllegalDataException {
     34    void testTicket12675() throws IllegalDataException {
    3535        OsmApi api = OsmApi.getOsmApi();
    3636        Changeset cs = new Changeset();
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangeBuilderTest.java

    r14048 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.fail;
    66
    77import java.util.Arrays;
    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.coor.LatLon;
    1212import org.openstreetmap.josm.data.osm.Changeset;
     
    2020 * Unit tests of {@link OsmChangeBuilder}
    2121 */
    22 public class OsmChangeBuilderTest {
     22class OsmChangeBuilderTest {
    2323
    2424    /**
    2525     * Setup rule
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules();
     
    4242     */
    4343    @Test
    44     public void testConstructor() {
     44    void testConstructor() {
    4545        Changeset cs = new Changeset(1);
    4646        // should not fail
     
    5757     */
    5858    @Test
    59     public void testSequenceOfMethodCalls() {
     59    void testSequenceOfMethodCalls() {
    6060        Changeset cs = new Changeset(1);
    6161        OsmChangeBuilder csBuilder = new OsmChangeBuilder(cs);
     
    9393     */
    9494    @Test
    95     public void testDocumentWithNewNode() {
     95    void testDocumentWithNewNode() {
    9696        Changeset cs = new Changeset(1);
    9797        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    114114     */
    115115    @Test
    116     public void testDocumentWithModifiedNode() {
     116    void testDocumentWithModifiedNode() {
    117117        Changeset cs = new Changeset(1);
    118118        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    137137     */
    138138    @Test
    139     public void testDocumentWithDeletedNode() {
     139    void testDocumentWithDeletedNode() {
    140140        Changeset cs = new Changeset(1);
    141141        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
     
    160160     */
    161161    @Test
    162     public void testMixed() {
     162    void testMixed() {
    163163        Changeset cs = new Changeset(1);
    164164        OsmChangeBuilder builder = new OsmChangeBuilder(cs);
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangeReaderTest.java

    r14314 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.ByteArrayInputStream;
     
    1010import java.util.Iterator;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.data.coor.LatLon;
    1515import org.openstreetmap.josm.data.notes.Note;
     
    2525 * Unit tests of {@link OsmChangeReader}.
    2626 */
    27 public class OsmChangeReaderTest {
     27class OsmChangeReaderTest {
    2828
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    5454     */
    5555    @Test
    56     public void testNotes() throws Exception {
     56    void testNotes() throws Exception {
    5757        NoteData nd = parse(
    5858                "<create>\r\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetContentParserTest.java

    r14201 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
    7 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
     7import static org.junit.jupiter.api.Assertions.fail;
    88
    99import java.io.ByteArrayInputStream;
     
    1212import java.util.Arrays;
    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.data.osm.ChangesetDataSet;
    1717import org.openstreetmap.josm.data.osm.ChangesetDataSet.ChangesetModificationType;
     
    3131 * Unit tests of {@link OsmChangesetContentParser}.
    3232 */
    33 public class OsmChangesetContentParserTest {
     33class OsmChangesetContentParserTest {
    3434
    3535    /**
    3636     * Setup rule
    3737     */
    38     @Rule
     38    @RegisterExtension
    3939    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4040    public JOSMTestRules test = new JOSMTestRules();
     
    5454    @Test
    5555    @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF_NONVIRTUAL")
    56     public void test_Constructor() {
     56    void test_Constructor() {
    5757
    5858        // should be OK
     
    7373     */
    7474    @Test
    75     public void test_parse_arguments() throws XmlParsingException {
     75    void test_parse_arguments() throws XmlParsingException {
    7676        OsmChangesetContentParser parser;
    7777
     
    9696     */
    9797    @Test
    98     public void test_OK_OneCreatedNode() throws XmlParsingException {
     98    void test_OK_OneCreatedNode() throws XmlParsingException {
    9999        OsmChangesetContentParser parser;
    100100
     
    126126     */
    127127    @Test
    128     public void test_OK_OneUpdatedNode() throws XmlParsingException {
     128    void test_OK_OneUpdatedNode() throws XmlParsingException {
    129129        OsmChangesetContentParser parser;
    130130
     
    156156     */
    157157    @Test
    158     public void test_OK_OneDeletedNode() throws XmlParsingException {
     158    void test_OK_OneDeletedNode() throws XmlParsingException {
    159159        OsmChangesetContentParser parser;
    160160
     
    186186     */
    187187    @Test
    188     public void test_OK_ComplexTestCase() throws XmlParsingException {
     188    void test_OK_ComplexTestCase() throws XmlParsingException {
    189189        OsmChangesetContentParser parser;
    190190
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangesetParserTest.java

    r14231 r17275  
    22package org.openstreetmap.josm.io;
    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.io.ByteArrayInputStream;
     
    99import java.util.List;
    1010
    11 import org.junit.Rule;
    12 import org.junit.Test;
     11import org.junit.jupiter.api.extension.RegisterExtension;
     12import org.junit.jupiter.api.Test;
    1313import org.openstreetmap.josm.data.osm.Changeset;
    1414import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     
    2020 * Unit tests of {@link OsmChangesetParser} class.
    2121 */
    22 public class OsmChangesetParserTest {
     22class OsmChangesetParserTest {
    2323
    2424    private static final String BEGIN =
     
    5858     * Setup test.
    5959     */
    60     @Rule
     60    @RegisterExtension
    6161    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6262    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    7171     */
    7272    @Test
    73     public void testParseWithoutDiscussion() throws IllegalDataException {
     73    void testParseWithoutDiscussion() throws IllegalDataException {
    7474        // http://api.openstreetmap.org/api/0.6/changeset/36749147
    7575        Changeset cs = parse(BEGIN + END).iterator().next();
     
    8484     */
    8585    @Test
    86     public void testParseWithDiscussion() throws IllegalDataException {
     86    void testParseWithDiscussion() throws IllegalDataException {
    8787        // http://api.openstreetmap.org/api/0.6/changeset/36749147?include_discussion=true
    8888        Changeset cs = parse(BEGIN + DISCUSSION + END).iterator().next();
  • trunk/test/unit/org/openstreetmap/josm/io/OsmJsonReaderTest.java

    r17232 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.ByteArrayInputStream;
     
    1111import java.util.Iterator;
    1212
    13 import org.junit.BeforeClass;
    14 import org.junit.Rule;
    15 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
    1616import org.openstreetmap.josm.data.coor.LatLon;
    1717import org.openstreetmap.josm.data.osm.DataSet;
     
    2929 * Unit tests of {@link OsmReader} class.
    3030 */
    31 public class OsmJsonReaderTest {
     31class OsmJsonReaderTest {
    3232
    3333    /**
    3434     * Setup rule
    3535     */
    36     @Rule
     36    @RegisterExtension
    3737    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3838    public JOSMTestRules test = new JOSMTestRules();
     
    4141     * Setup test
    4242     */
    43     @BeforeClass
     43    @BeforeAll
    4444    public static void setUp() {
    4545        DateUtils.newIsoDateTimeFormat().setTimeZone(DateUtils.UTC);
     
    8989     */
    9090    @Test
    91     public void testHeader() throws Exception {
     91    void testHeader() throws Exception {
    9292        DataSet ds = parse("");
    9393        assertEquals("0.6", ds.getVersion());
     
    9999     */
    100100    @Test
    101     public void testNodeSpatialData() throws Exception {
     101    void testNodeSpatialData() throws Exception {
    102102        DataSet ds = parse("{\n" +
    103103                "  \"type\": \"node\",\n" +
     
    116116     */
    117117    @Test
    118     public void testNodeMetaData() throws Exception {
     118    void testNodeMetaData() throws Exception {
    119119        DataSet ds = parse("{\n" +
    120120                "  \"type\": \"node\",\n" +
     
    143143     */
    144144    @Test
    145     public void testNodeTags() throws Exception {
     145    void testNodeTags() throws Exception {
    146146        DataSet ds = parse("{\n" +
    147147                "  \"type\": \"node\",\n" +
     
    167167     */
    168168    @Test
    169     public void testWay() throws Exception {
     169    void testWay() throws Exception {
    170170        DataSet ds = parse("{\n" +
    171171                "  \"type\": \"way\",\n" +
     
    199199     */
    200200    @Test
    201     public void testRelation() throws Exception {
     201    void testRelation() throws Exception {
    202202        DataSet ds = parse("{\n" +
    203203                "  \"type\": \"relation\",\n" +
     
    244244     */
    245245    @Test
    246     public void testEmptyRelation() throws Exception {
     246    void testEmptyRelation() throws Exception {
    247247        DataSet ds = parse("{\n" +
    248248                "  \"type\": \"relation\",\n" +
     
    260260     */
    261261    @Test
    262     public void testRemark() throws Exception {
     262    void testRemark() throws Exception {
    263263        DataSet ds = parse("", "," +
    264264                "  \"remark\": \"runtime error: Query ran out of memory in \\\"query\\\" at line 5.\"\n");
  • trunk/test/unit/org/openstreetmap/josm/io/OsmReaderTest.java

    r17169 r17275  
    55import static org.hamcrest.CoreMatchers.is;
    66import static org.hamcrest.MatcherAssert.assertThat;
    7 import static org.junit.Assert.assertEquals;
    8 import static org.junit.Assert.assertFalse;
    9 import static org.junit.Assert.assertNull;
    10 import static org.junit.Assert.assertTrue;
    11 import static org.junit.Assert.fail;
     7import static org.junit.jupiter.api.Assertions.assertEquals;
     8import static org.junit.jupiter.api.Assertions.assertFalse;
     9import static org.junit.jupiter.api.Assertions.assertNull;
     10import static org.junit.jupiter.api.Assertions.assertTrue;
     11import static org.junit.jupiter.api.Assertions.fail;
    1212
    1313import java.io.ByteArrayInputStream;
     
    1818import java.util.Arrays;
    1919
    20 import org.junit.Rule;
    21 import org.junit.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
     21import org.junit.jupiter.api.Test;
    2222import org.openstreetmap.josm.TestUtils;
    2323import org.openstreetmap.josm.data.osm.DataSet;
     
    3434 * Unit tests of {@link OsmReader} class.
    3535 */
    36 public class OsmReaderTest {
     36class OsmReaderTest {
    3737
    3838    /**
    3939     * Setup rule
    4040     */
    41     @Rule
     41    @RegisterExtension
    4242    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4343    public JOSMTestRules test = new JOSMTestRules();
     
    6666     */
    6767    @Test
    68     public void testPostProcessors() throws Exception {
     68    void testPostProcessors() throws Exception {
    6969        PostProcessorStub registered = new PostProcessorStub();
    7070        PostProcessorStub unregistered = new PostProcessorStub();
     
    9696     */
    9797    @Test
    98     public void testUnknownRoot() throws Exception {
     98    void testUnknownRoot() throws Exception {
    9999        for (Options[] options : options()) {
    100100            testUnknown("<nonosm/>", options);
     
    107107     */
    108108    @Test
    109     public void testUnknownMeta() throws Exception {
     109    void testUnknownMeta() throws Exception {
    110110        for (Options[] options : options()) {
    111111            testUnknown("<osm version='0.6'><meta osm_base='2017-03-29T19:04:03Z'/></osm>", options);
     
    118118     */
    119119    @Test
    120     public void testUnknownNote() throws Exception {
     120    void testUnknownNote() throws Exception {
    121121        for (Options[] options : options()) {
    122122            testUnknown("<osm version='0.6'><note>The data included in this document is from www.openstreetmap.org.</note></osm>", options);
     
    129129     */
    130130    @Test
    131     public void testUnknownTag() throws Exception {
     131    void testUnknownTag() throws Exception {
    132132        for (Options[] options : options()) {
    133133            testUnknown("<osm version='0.6'><foo>bar</foo></osm>", options);
     
    170170     */
    171171    @Test
    172     public void testInvalidUid() throws Exception {
     172    void testInvalidUid() throws Exception {
    173173        testInvalidData("<osm version='0.6'><node id='1' uid='nan'/></osm>",
    174174                "Illegal value for attribute 'uid'. Got 'nan'. (at line 1, column 82). 82 bytes have been read");
     
    180180     */
    181181    @Test
    182     public void testMissingId() throws Exception {
     182    void testMissingId() throws Exception {
    183183        testInvalidData("<osm version='0.6'><node/></osm>",
    184184                "Missing required attribute 'id'. (at line 1, column 65). 64 bytes have been read");
     
    190190     */
    191191    @Test
    192     public void testMissingRef() throws Exception {
     192    void testMissingRef() throws Exception {
    193193        testInvalidData("<osm version='0.6'><way id='1' version='1'><nd/></way></osm>",
    194194                "Missing mandatory attribute 'ref' on <nd> of way 1. (at line 1, column 87). 88 bytes have been read");
     
    202202     */
    203203    @Test
    204     public void testIllegalRef() throws Exception {
     204    void testIllegalRef() throws Exception {
    205205        testInvalidData("<osm version='0.6'><way id='1' version='1'><nd ref='0'/></way></osm>",
    206206                "Illegal value of attribute 'ref' of element <nd>. Got 0. (at line 1, column 95). 96 bytes have been read");
     
    219219     */
    220220    @Test
    221     public void testMissingType() throws Exception {
     221    void testMissingType() throws Exception {
    222222        testInvalidData("<osm version='0.6'><relation id='1' version='1'><member ref='1'/></relation></osm>",
    223223                "Missing attribute 'type' on member 1 in relation 1. (at line 1, column 104). 109 bytes have been read");
     
    229229     */
    230230    @Test
    231     public void testIllegalType() throws Exception {
     231    void testIllegalType() throws Exception {
    232232        testInvalidData("<osm version='0.6'><relation id='1' version='1'><member type='foo' ref='1'/></relation></osm>",
    233233                "Illegal value for attribute 'type' on member 1 in relation 1. Got foo. (at line 1, column 115). 120 bytes have been read");
     
    239239     */
    240240    @Test
    241     public void testMissingKeyValue() throws Exception {
     241    void testMissingKeyValue() throws Exception {
    242242        testInvalidData("<osm version='0.6'><node id='1' version='1'><tag/></node></osm>",
    243243                "Missing key or value attribute in tag. (at line 1, column 89). 89 bytes have been read");
     
    253253     */
    254254    @Test
    255     public void testMissingVersion() throws Exception {
     255    void testMissingVersion() throws Exception {
    256256        testInvalidData("<osm/>",
    257257                "Missing mandatory attribute 'version'. (at line 1, column 45). 44 bytes have been read");
     
    265265     */
    266266    @Test
    267     public void testUnsupportedVersion() throws Exception {
     267    void testUnsupportedVersion() throws Exception {
    268268        testInvalidData("<osm version='0.1'/>",
    269269                "Unsupported version: 0.1 (at line 1, column 59). 58 bytes have been read");
     
    275275     */
    276276    @Test
    277     public void testIllegalVersion() throws Exception {
     277    void testIllegalVersion() throws Exception {
    278278        testInvalidData("<osm version='0.6'><node id='1' version='nan'/></osm>",
    279279                "Illegal value for attribute 'version' on OSM primitive with ID 1. Got nan. (at line 1, column 86). 86 bytes have been read");
     
    285285     */
    286286    @Test
    287     public void testIllegalChangeset() throws Exception {
     287    void testIllegalChangeset() throws Exception {
    288288        testInvalidData("<osm version='0.6'><node id='1' version='1' changeset='nan'/></osm>",
    289289                "Illegal value for attribute 'changeset'. Got nan. (at line 1, column 100). 100 bytes have been read");
     
    297297     */
    298298    @Test
    299     public void testGdprChangeset() throws Exception {
     299    void testGdprChangeset() throws Exception {
    300300        String gdprChangeset = "<osm version='0.6'><node id='1' version='1' changeset='0'/></osm>";
    301301        for (Options[] options : options()) {
     
    309309     */
    310310    @Test
    311     public void testInvalidBounds() throws Exception {
     311    void testInvalidBounds() throws Exception {
    312312        testInvalidData("<osm version='0.6'><bounds/></osm>",
    313313                "Missing mandatory attributes on element 'bounds'. " +
     
    329329     */
    330330    @Test
    331     public void testTicket14199() throws Exception {
     331    void testTicket14199() throws Exception {
    332332        try (InputStream in = TestUtils.getRegressionDataStream(14199, "emptytag.osm")) {
    333333            Way w = OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE).getWays().iterator().next();
     
    343343     */
    344344    @Test
    345     public void testTicket14754() throws Exception {
     345    void testTicket14754() throws Exception {
    346346        try (InputStream in = TestUtils.getRegressionDataStream(14754, "malformed_for_14754.osm")) {
    347347            OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     
    361361     */
    362362    @Test
    363     public void testTicket14788() throws Exception {
     363    void testTicket14788() throws Exception {
    364364        try (InputStream in = TestUtils.getRegressionDataStream(14788, "remove_sign_test_4.osm")) {
    365365            OsmReader.parseDataSet(in, NullProgressMonitor.INSTANCE);
     
    379379     */
    380380    @Test
    381     public void testRemark() throws Exception {
     381    void testRemark() throws Exception {
    382382        String query = "<osm version=\"0.6\" generator=\"Overpass API 0.7.55.4 3079d8ea\">\r\n" +
    383383                "<note>The data included in this document is from www.openstreetmap.org. The data is made available under ODbL.</note>\r\n" +
     
    396396     */
    397397    @Test
    398     public void testUnknownAttributeTags() throws Exception {
     398    void testUnknownAttributeTags() throws Exception {
    399399        String testData = "<osm version=\"0.6\" generator=\"fake generator\">"
    400400                + "<node id='1' version='1' visible='true' changeset='82' randomkey='randomvalue'></node>" + "</osm>";
  • trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java

    r16663 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertArrayEquals;
    5 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertArrayEquals;
     5import static org.junit.jupiter.api.Assertions.assertEquals;
    66
    77import java.io.ByteArrayOutputStream;
     
    1616import java.util.List;
    1717
    18 import org.junit.Test;
     18import org.junit.jupiter.api.Test;
    1919import org.openstreetmap.josm.data.coor.LatLon;
    2020import org.openstreetmap.josm.data.osm.Changeset;
     
    2828 * Unit tests of {@link OsmWriter} class.
    2929 */
    30 public class OsmWriterTest {
     30class OsmWriterTest {
    3131
    3232    /**
     
    3434     */
    3535    @Test
    36     public void testByIdComparator() {
     36    void testByIdComparator() {
    3737
    3838        final List<NodeData> ids = new ArrayList<>();
     
    5656     */
    5757    @Test
    58     public void testHeader() throws IOException {
     58    void testHeader() throws IOException {
    5959        doTestHeader(null, null,
    6060                "<osm version='0.6' generator='JOSM'>");
     
    8282     */
    8383    @Test
    84     public void testWriteLock() throws IOException {
     84    void testWriteLock() throws IOException {
    8585        ByteArrayOutputStream baos = new ByteArrayOutputStream();
    8686        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(baos, StandardCharsets.UTF_8));
     
    101101     */
    102102    @Test
    103     public void testChangeset() throws IOException {
     103    void testChangeset() throws IOException {
    104104        Changeset cs = new Changeset();
    105105        cs.setUser(User.getAnonymous());
  • trunk/test/unit/org/openstreetmap/josm/io/ParseWithChangesetReaderTest.java

    r14040 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.fail;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.fail;
    77
    88import java.io.ByteArrayInputStream;
     
    1111import java.nio.charset.StandardCharsets;
    1212
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.osm.DataSet;
    1616import org.openstreetmap.josm.data.osm.Node;
     
    2525 * Additional unit tests for {@link OsmReader}.
    2626 */
    27 public class ParseWithChangesetReaderTest {
     27class ParseWithChangesetReaderTest {
    2828
    2929    /**
    3030     * Setup rule
    3131     */
    32     @Rule
     32    @RegisterExtension
    3333    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3434    public JOSMTestRules test = new JOSMTestRules();
     
    5454     */
    5555    @Test
    56     public void test_1() throws Exception {
     56    void test_1() throws Exception {
    5757        String doc =
    5858            "<osm version=\"0.6\">\n" +
     
    7373     */
    7474    @Test
    75     public void test_11() throws Exception {
     75    void test_11() throws Exception {
    7676        String doc =
    7777        "<osm version=\"0.6\">\n" +
     
    9292     */
    9393    @Test
    94     public void test_12() throws Exception {
     94    void test_12() throws Exception {
    9595        String doc =
    9696        "<osm version=\"0.6\">\n" +
     
    111111     */
    112112    @Test
    113     public void test_13() throws Exception {
     113    void test_13() throws Exception {
    114114        String doc =
    115115        "<osm version=\"0.6\">\n" +
     
    131131     */
    132132    @Test
    133     public void test_14() throws Exception {
     133    void test_14() throws Exception {
    134134        String doc =
    135135        "<osm version=\"0.6\">\n" +
     
    152152     */
    153153    @Test
    154     public void test_2() throws Exception {
     154    void test_2() throws Exception {
    155155        String doc =
    156156        "<osm version=\"0.6\">\n" +
     
    171171     */
    172172    @Test
    173     public void test_3() throws Exception {
     173    void test_3() throws Exception {
    174174        String doc =
    175175        "<osm version=\"0.6\">\n" +
     
    190190     */
    191191    @Test
    192     public void test_4() throws IOException {
     192    void test_4() throws IOException {
    193193        String doc =
    194194        "<osm version=\"0.6\">\n" +
     
    205205     */
    206206    @Test
    207     public void test_5() throws IOException {
     207    void test_5() throws IOException {
    208208        String doc =
    209209        "<osm version=\"0.6\">\n" +
     
    220220     */
    221221    @Test
    222     public void test_6() throws IOException {
     222    void test_6() throws IOException {
    223223        String doc =
    224224            "<osm version=\"0.6\">\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/UrlPatternsTest.java

    r15784 r17275  
    22package org.openstreetmap.josm.io;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    66import java.util.Arrays;
     
    88import java.util.regex.Pattern;
    99
    10 import org.junit.Test;
     10import org.junit.jupiter.api.Test;
    1111import org.openstreetmap.josm.TestUtils;
    1212
     
    1414 * Unit tests of {@link UrlPatterns}.
    1515 */
    16 public class UrlPatternsTest {
     16class UrlPatternsTest {
    1717
    1818    private static final List<Class<? extends Enum<?>>> patterns = Arrays.asList(
     
    2727     */
    2828    @Test
    29     public void testUrlPatternEnums() {
     29    void testUrlPatternEnums() {
    3030        patterns.forEach(TestUtils::superficialEnumCodeCoverage);
    3131    }
     
    3535     */
    3636    @Test
    37     public void testUrlPatterns() {
     37    void testUrlPatterns() {
    3838        assertTrue(patterns.stream().flatMap(c -> Arrays.stream(c.getEnumConstants())).map(t -> ((UrlPattern) t).pattern())
    3939                .map(Pattern::compile).count() > 0);
  • trunk/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java

    r15755 r17275  
    22package org.openstreetmap.josm.io.audio;
    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;
     6import static org.junit.jupiter.api.Assertions.assertTimeout;
    67
    78import java.io.File;
    89import java.net.MalformedURLException;
    910import java.net.URL;
     11import java.time.Duration;
    1012
    11 import org.junit.BeforeClass;
    12 import org.junit.Ignore;
    13 import org.junit.Test;
     13import org.junit.jupiter.api.BeforeAll;
     14import org.junit.jupiter.api.Disabled;
     15import org.junit.jupiter.api.Test;
    1416import org.openstreetmap.josm.JOSMFixture;
    1517import org.openstreetmap.josm.TestUtils;
     
    1921 * Unit tests of {@link AudioPlayer} class.
    2022 */
    21 @Ignore("unresolved sporadic deadlock - see #13809")
    22 public class AudioPlayerTest {
     23@Disabled("unresolved sporadic deadlock - see #13809")
     24class AudioPlayerTest {
    2325
    2426    // We play wav files of about 4 seconds + pause, so define timeout at 16 seconds
     
    2830     * Setup test.
    2931     */
    30     @BeforeClass
     32    @BeforeAll
    3133    public static void setUp() {
    3234        JOSMFixture.createUnitTestFixture().init();
     
    3840     * @throws MalformedURLException wrong URL
    3941     */
    40     @Test(timeout = 4*MAX_DURATION)
    41     public void testPlay() throws MalformedURLException, Exception {
    42         File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
    43         File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav"));
     42    @Test
     43    void testPlay() throws MalformedURLException, Exception {
     44        assertTimeout(Duration.ofMillis(4*MAX_DURATION), () -> {
     45            File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
     46            File wav2 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121557.wav"));
    4447
    45         for (File w : new File[] {wav1, wav2}) {
    46             System.out.println("Playing " + w.toPath());
    47             URL url = w.toURI().toURL();
    48             final Stopwatch stopwatch = Stopwatch.createStarted();
    49             AudioPlayer.play(url);
    50             assertTrue(AudioPlayer.playing());
    51             assertFalse(AudioPlayer.paused());
    52             AudioPlayer.pause();
    53             assertFalse(AudioPlayer.playing());
    54             assertTrue(AudioPlayer.paused());
    55             AudioPlayer.play(url, AudioPlayer.position());
    56             while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) {
    57                 Thread.sleep(500);
     48            for (File w : new File[] {wav1, wav2}) {
     49                System.out.println("Playing " + w.toPath());
     50                URL url = w.toURI().toURL();
     51                final Stopwatch stopwatch = Stopwatch.createStarted();
     52                AudioPlayer.play(url);
     53                assertTrue(AudioPlayer.playing());
     54                assertFalse(AudioPlayer.paused());
     55                AudioPlayer.pause();
     56                assertFalse(AudioPlayer.playing());
     57                assertTrue(AudioPlayer.paused());
     58                AudioPlayer.play(url, AudioPlayer.position());
     59                while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) {
     60                    Thread.sleep(500);
     61                }
     62                System.out.println("Play finished after " + stopwatch);
     63                assertTrue(stopwatch.elapsed() < MAX_DURATION);
     64                AudioPlayer.reset();
     65                Thread.sleep(1000); // precaution, see #13809
    5866            }
    59             System.out.println("Play finished after " + stopwatch);
    60             assertTrue(stopwatch.elapsed() < MAX_DURATION);
    61             AudioPlayer.reset();
    62             Thread.sleep(1000); // precaution, see #13809
    63         }
     67        });
    6468    }
    6569}
  • trunk/test/unit/org/openstreetmap/josm/io/audio/AudioUtilTest.java

    r12327 r17275  
    22package org.openstreetmap.josm.io.audio;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.File;
    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;
    1111import org.openstreetmap.josm.TestUtils;
     
    1414 * Unit tests of {@link AudioUtil} class.
    1515 */
    16 public class AudioUtilTest {
     16class AudioUtilTest {
    1717
    1818    private static final double EPSILON = 1e-11;
     
    2121     * Setup test.
    2222     */
    23     @BeforeClass
     23    @BeforeAll
    2424    public static void setUp() {
    2525        JOSMFixture.createUnitTestFixture().init();
     
    3030     */
    3131    @Test
    32     public void testGetCalibratedDuration() {
     32    void testGetCalibratedDuration() {
    3333        assertEquals(0.0, AudioUtil.getCalibratedDuration(new File("invalid_file")), EPSILON);
    3434        File wav1 = new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav"));
  • trunk/test/unit/org/openstreetmap/josm/io/auth/CredentialsAgentExceptionTest.java

    r11102 r17275  
    22package org.openstreetmap.josm.io.auth;
    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 CredentialsAgentException} class.
    1414 */
    15 public class CredentialsAgentExceptionTest {
     15class CredentialsAgentExceptionTest {
    1616
    1717    /**
    1818     * Setup test
    1919     */
    20     @Rule
     20    @RegisterExtension
    2121    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2222    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testCredentialsAgentException() {
     28    void testCredentialsAgentException() {
    2929        String msg = "test1";
    3030        Exception cause = new Exception("test2");
  • trunk/test/unit/org/openstreetmap/josm/io/nmea/NmeaReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io.nmea;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.ByteArrayInputStream;
     
    1717import java.util.TimeZone;
    1818
    19 import org.junit.Before;
    20 import org.junit.Rule;
    21 import org.junit.Test;
     19import org.junit.jupiter.api.BeforeEach;
     20import org.junit.jupiter.api.Test;
     21import org.junit.jupiter.api.extension.RegisterExtension;
    2222import org.openstreetmap.josm.TestUtils;
    2323import org.openstreetmap.josm.data.coor.LatLon;
     
    3737 * Unit tests of {@link NmeaReader} class.
    3838 */
    39 public class NmeaReaderTest {
     39class NmeaReaderTest {
    4040    /**
    4141     * Set the timezone and timeout.
    4242     */
    43     @Rule
     43    @RegisterExtension
    4444    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4545    public JOSMTestRules test = new JOSMTestRules();
     
    5050     * Forces the timezone.
    5151     */
    52     @Before
     52    @BeforeEach
    5353    public void setUp() {
    5454        iso8601.setTimeZone(DateUtils.UTC);
     
    6060     */
    6161    @Test
    62     public void testReader() throws Exception {
     62    void testReader() throws Exception {
    6363        TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
    6464        final NmeaReader in = new NmeaReader(Files.newInputStream(Paths.get("nodist/data/btnmeatrack_2016-01-25.nmea")));
     
    116116     */
    117117    @Test
    118     public void testIsSentence() {
     118    void testIsSentence() {
    119119        assertTrue(NmeaReader.isSentence("$GPVTG", Sentence.VTG));
    120120        assertTrue(NmeaReader.isSentence("$GAVTG", Sentence.VTG));
     
    130130     */
    131131    @Test
    132     public void testTicket1433() throws Exception {
     132    void testTicket1433() throws Exception {
    133133        compareWithReference(1433, "2008-08-14-16-04-58", 1241);
    134134    }
     
    139139     */
    140140    @Test
    141     public void testTicket1853() throws Exception {
     141    void testTicket1853() throws Exception {
    142142        compareWithReference(1853, "PosData-20081216-115434", 1285);
    143143    }
     
    148148     */
    149149    @Test
    150     public void testTicket2147() throws Exception {
     150    void testTicket2147() throws Exception {
    151151        compareWithReference(2147, "WG20080203171807.log", 487);
    152152    }
     
    157157     */
    158158    @Test
    159     public void testTicket14924() throws Exception {
     159    void testTicket14924() throws Exception {
    160160        compareWithReference(14924, "input", 0);
    161161    }
     
    184184     */
    185185    @Test
    186     public void testTicket16496() throws Exception {
     186    void testTicket16496() throws Exception {
    187187        assertEquals("2018-05-30T16:28:59.400Z", iso8601.format(
    188188                readDate("$GNRMC,162859.400,A,4543.03388,N,00058.19870,W,45.252,209.07,300518,,,D,V*13")));
     
    198198     */
    199199    @Test
    200     public void testTicket16554() throws Exception {
     200    void testTicket16554() throws Exception {
    201201        assertEquals(63.2420959, readSpeed(
    202202                  "$GNRMC,141448.80,A,4659.05514,N,00130.44695,W,34.148,289.80,300718,,,D,V*26"), 1e-7);
  • trunk/test/unit/org/openstreetmap/josm/io/protocols/data/HandlerTest.java

    r10931 r17275  
    22package org.openstreetmap.josm.io.protocols.data;
    33
    4 import static org.junit.Assert.assertNotNull;
     4import static org.junit.jupiter.api.Assertions.assertNotNull;
    55
    66import java.io.IOException;
     
    88import java.net.URLConnection;
    99
    10 import org.junit.Before;
    11 import org.junit.Rule;
    12 import org.junit.Test;
     10import org.junit.jupiter.api.BeforeEach;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1313import org.openstreetmap.josm.testutils.JOSMTestRules;
    1414
     
    1616 * Unit tests of {@link Handler} class.
    1717 */
    18 public class HandlerTest {
     18class HandlerTest {
    1919
    2020    /**
    2121     * Use the test rules to remove any layers and reset state.
    2222     */
    23     @Rule
     23    @RegisterExtension
    2424    public final JOSMTestRules rules = new JOSMTestRules();
    2525
     
    2727     * Setup test.
    2828     */
    29     @Before
     29    @BeforeEach
    3030    public void setUp() {
    3131        Handler.install();
     
    3737     */
    3838    @Test
    39     public void testBase64Image() throws IOException {
     39    void testBase64Image() throws IOException {
    4040        // Red dot image, taken from https://en.wikipedia.org/wiki/Data_URI_scheme#HTML
    4141        URLConnection connection = new Handler().openConnection(new URL("data:image/png;base64," +
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/AddTagsDialogTest.java

    r16328 r17275  
    22package org.openstreetmap.josm.io.remotecontrol;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Map;
    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.testutils.JOSMTestRules;
    1111
     
    1515 * Unit tests for class {@link AddTagsDialog}.
    1616 */
    17 public class AddTagsDialogTest {
     17class AddTagsDialogTest {
    1818    /**
    1919     * Setup test.
    2020     */
    21     @Rule
     21    @RegisterExtension
    2222    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2323    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    2727     */
    2828    @Test
    29     public void testParseUrlTagsToKeyValues() {
     29    void testParseUrlTagsToKeyValues() {
    3030        Map<String, String> strings = AddTagsDialog.parseUrlTagsToKeyValues("wikipedia:de=Residenzschloss Dresden|name:en=Dresden Castle");
    3131        assertEquals(2, strings.size());
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java

    r16436 r17275  
    22package org.openstreetmap.josm.io.remotecontrol;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.BufferedReader;
     
    1515import java.util.stream.Collectors;
    1616
    17 import org.junit.After;
    18 import org.junit.Before;
    19 import org.junit.Rule;
    20 import org.junit.Test;
     17import org.junit.jupiter.api.AfterEach;
     18import org.junit.jupiter.api.BeforeEach;
     19import org.junit.jupiter.api.Test;
     20import org.junit.jupiter.api.extension.RegisterExtension;
    2121import org.openstreetmap.josm.TestUtils;
    2222import org.openstreetmap.josm.spi.preferences.Config;
     
    3232 * Unit tests for Remote Control
    3333 */
    34 public class RemoteControlTest {
     34class RemoteControlTest {
    3535
    3636    private String httpBase;
     
    4646     * Setup test.
    4747     */
    48     @Rule
     48    @RegisterExtension
    4949    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5050    public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT();
     
    5454     * @throws GeneralSecurityException if a security error occurs
    5555     */
    56     @Before
     56    @BeforeEach
    5757    public void setUp() throws GeneralSecurityException {
    5858        if (PlatformManager.isPlatformWindows() && "True".equals(System.getenv("APPVEYOR"))) {
     
    6969     * Stops Remote control after testing requests.
    7070     */
    71     @After
     71    @AfterEach
    7272    public void tearDown() {
    7373        RemoteControl.stop();
     
    7979     */
    8080    @Test
    81     public void testHttpListOfCommands() throws Exception {
     81    void testHttpListOfCommands() throws Exception {
    8282        testListOfCommands(httpBase);
    8383    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RequestProcessorTest.java

    r16825 r17275  
    1313 * @author Taylor Smock
    1414 */
    15 public class RequestProcessorTest {
     15class RequestProcessorTest {
    1616    /**
    1717     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/19436">#19436</a>
    1818     */
    1919    @Test
    20     public void testFeaturesDoesNotThrowNPE() {
     20    void testFeaturesDoesNotThrowNPE() {
    2121        assertTrue(RequestProcessor.getHandlersInfo(Arrays.asList("add_node", "/add_node", "", null))
    2222                .noneMatch(Objects::isNull));
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.DataSet;
    1111import org.openstreetmap.josm.gui.MainApplication;
     
    1919 * Unit tests of {@link AddNodeHandler} class.
    2020 */
    21 public class AddNodeHandlerTest {
     21class AddNodeHandlerTest {
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
     
    3838     */
    3939    @Test
    40     public void testBadRequestNoLayer() {
     40    void testBadRequestNoLayer() {
    4141        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?lat=0&lon=0").handle());
    4242        assertEquals("There is no layer opened to add node", e.getMessage());
     
    4747     */
    4848    @Test
    49     public void testBadRequestNoParam() {
     49    void testBadRequestNoParam() {
    5050        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    5151        MainApplication.getLayerManager().addLayer(layer);
     
    5858     */
    5959    @Test
    60     public void testBadRequestInvalidUrl() {
     60    void testBadRequestInvalidUrl() {
    6161        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    6262        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     
    6767     */
    6868    @Test
    69     public void testBadRequestIncompleteUrl() {
     69    void testBadRequestIncompleteUrl() {
    7070        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7171        assertEquals("The following keys are mandatory, but have not been provided: lat, lon", e.getMessage());
     
    7676     */
    7777    @Test
    78     public void testNominalRequest() {
     78    void testNominalRequest() {
    7979        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    8080        MainApplication.getLayerManager().addLayer(layer);
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.DataSet;
    1111import org.openstreetmap.josm.gui.MainApplication;
     
    1919 * Unit tests of {@link AddWayHandler} class.
    2020 */
    21 public class AddWayHandlerTest {
     21class AddWayHandlerTest {
    2222    /**
    2323     * Setup test.
    2424     */
    25     @Rule
     25    @RegisterExtension
    2626    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2727    public JOSMTestRules test = new JOSMTestRules();
     
    3838     */
    3939    @Test
    40     public void testBadRequestNoLayer() {
     40    void testBadRequestNoLayer() {
    4141        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?way=0,0;1,1").handle());
    4242        assertEquals("There is no layer opened to add way", e.getMessage());
     
    4747     */
    4848    @Test
    49     public void testBadRequestNoParam() {
     49    void testBadRequestNoParam() {
    5050        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    5151        try {
     
    6262     */
    6363    @Test
    64     public void testBadRequestInvalidUrl() {
     64    void testBadRequestInvalidUrl() {
    6565        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    6666        assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage());
     
    7171     */
    7272    @Test
    73     public void testBadRequestIncompleteUrl() {
     73    void testBadRequestIncompleteUrl() {
    7474        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7575        assertEquals("The following keys are mandatory, but have not been provided: way", e.getMessage());
     
    8080     */
    8181    @Test
    82     public void testNominalRequest() {
     82    void testNominalRequest() {
    8383        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    8484        try {
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java

    r16739 r17275  
    44import static org.hamcrest.CoreMatchers.hasItem;
    55import static org.hamcrest.MatcherAssert.assertThat;
    6 import static org.junit.Assert.assertEquals;
     6import static org.junit.jupiter.api.Assertions.assertEquals;
    77import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    88import static org.junit.jupiter.api.Assertions.assertThrows;
     
    1111import java.util.List;
    1212
    13 import org.junit.Rule;
    14 import org.junit.Test;
     13import org.junit.jupiter.api.extension.RegisterExtension;
     14import org.junit.jupiter.api.Test;
    1515import org.openstreetmap.josm.data.imagery.ImageryInfo;
    1616import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    2222 * Unit tests of {@link ImageryHandler} class.
    2323 */
    24 public class ImageryHandlerTest {
     24class ImageryHandlerTest {
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules();
     
    4141     */
    4242    @Test
    43     public void testBadRequestNoParam() {
     43    void testBadRequestNoParam() {
    4444        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    4545        assertEquals("Parameter must not be null", e.getMessage());
     
    5151     */
    5252    @Test
    53     public void testBadRequestInvalidUrl() {
     53    void testBadRequestInvalidUrl() {
    5454        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    5555        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    6060     */
    6161    @Test
    62     public void testBadRequestIncompleteUrl() {
     62    void testBadRequestIncompleteUrl() {
    6363        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    6464        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    6969     */
    7070    @Test
    71     public void testNominalRequest() {
     71    void testNominalRequest() {
    7272        assertDoesNotThrow(() -> newHandler("https://localhost?url=foo").handle());
    7373    }
     
    7878     */
    7979    @Test
    80     public void testOptionalParams() throws Exception {
     80    void testOptionalParams() throws Exception {
    8181        List<String> optionalParams = Arrays.asList(newHandler("").getOptionalParams());
    8282        assertThat(optionalParams, hasItem("type"));
     
    9191     */
    9292    @Test
    93     public void testBuildImageryInfo() throws Exception {
     93    void testBuildImageryInfo() throws Exception {
    9494        String url = "https://localhost/imagery?title=osm"
    9595                + "&type=tms&min_zoom=3&max_zoom=23&category=osmbasedmap&country_code=XA"
     
    110110     */
    111111    @Test
    112     public void testTicket19483() throws Exception {
     112    void testTicket19483() throws Exception {
    113113        String url = "https://localhost/imagery?url=" +
    114114                "tms[3-7]%3Ahttps%3A%2F%2Fservices.digitalglobe.com%2Fearthservice%2Ftmsaccess%2F" +
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandlerTest.java

    r16618 r17275  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
    66import static org.junit.jupiter.api.Assertions.assertThrows;
     
    88import java.io.File;
    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.gui.MainApplication;
     
    2222 * Unit tests of {@link ImportHandler} class.
    2323 */
    24 public class ImportHandlerTest {
     24class ImportHandlerTest {
    2525    /**
    2626     * Setup test.
    2727     */
    28     @Rule
     28    @RegisterExtension
    2929    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3030    public JOSMTestRules test = new JOSMTestRules().main();
     
    4242     */
    4343    @Test
    44     public void testTicket7434() throws Exception {
     44    void testTicket7434() throws Exception {
    4545        ImportHandler req = newHandler("http://localhost:8111/import?url=http://localhost:8888/relations?relations=19711&mode=recursive");
    4646        assertEquals("http://localhost:8888/relations?relations=19711&mode=recursive", req.args.get("url"));
     
    5252     */
    5353    @Test
    54     public void testBadRequestNoParam() throws Exception {
     54    void testBadRequestNoParam() throws Exception {
    5555        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    5656        assertEquals("MalformedURLException: null", e.getMessage());
     
    6262     */
    6363    @Test
    64     public void testBadRequestInvalidUrl() throws Exception {
     64    void testBadRequestInvalidUrl() throws Exception {
    6565        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost?url=invalid_url").handle());
    6666        assertEquals("MalformedURLException: no protocol: invalid_url", e.getMessage());
     
    7272     */
    7373    @Test
    74     public void testBadRequestIncompleteUrl() throws Exception {
     74    void testBadRequestIncompleteUrl() throws Exception {
    7575        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    7676        assertEquals("The following keys are mandatory, but have not been provided: url", e.getMessage());
     
    8282     */
    8383    @Test
    84     public void testNominalRequest() throws Exception {
     84    void testNominalRequest() throws Exception {
    8585        String url = new File(TestUtils.getRegressionDataFile(11957, "data.osm")).toURI().toURL().toExternalForm();
    8686        try {
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link LoadAndZoomHandler} class.
    1717 */
    18 public class LoadAndZoomHandlerTest {
     18class LoadAndZoomHandlerTest {
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    3636     */
    3737    @Test
    38     public void testBadRequestNoParam() throws Exception {
     38    void testBadRequestNoParam() throws Exception {
    3939        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler(null).handle());
    4040        assertEquals("NumberFormatException (empty String)", e.getMessage());
     
    4646     */
    4747    @Test
    48     public void testBadRequestInvalidUrl() throws Exception {
     48    void testBadRequestInvalidUrl() throws Exception {
    4949        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    5050        assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage());
     
    5656     */
    5757    @Test
    58     public void testBadRequestIncompleteUrl() throws Exception {
     58    void testBadRequestIncompleteUrl() throws Exception {
    5959        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    6060        assertEquals("The following keys are mandatory, but have not been provided: bottom, top, left, right", e.getMessage());
     
    6666     */
    6767    @Test
    68     public void testNominalRequest() throws Exception {
     68    void testNominalRequest() throws Exception {
    6969        assertDoesNotThrow(() -> newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle());
    7070    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java

    r16618 r17275  
    66import static org.junit.jupiter.api.Assertions.assertThrows;
    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.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
    1111import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    1616 * Unit tests of {@link LoadObjectHandler} class.
    1717 */
    18 public class LoadObjectHandlerTest {
     18class LoadObjectHandlerTest {
    1919    /**
    2020     * Setup test.
    2121     */
    22     @Rule
     22    @RegisterExtension
    2323    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2424    public JOSMTestRules test = new JOSMTestRules();
     
    3535     */
    3636    @Test
    37     public void testBadRequestNoParam() {
     37    void testBadRequestNoParam() {
    3838        assertDoesNotThrow(() -> newHandler(null).handle());
    3939    }
     
    4343     */
    4444    @Test
    45     public void testBadRequestInvalidUrl() {
     45    void testBadRequestInvalidUrl() {
    4646        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("invalid_url").handle());
    4747        assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage());
     
    5252     */
    5353    @Test
    54     public void testBadRequestIncompleteUrl() {
     54    void testBadRequestIncompleteUrl() {
    5555        Exception e = assertThrows(RequestHandlerBadRequestException.class, () -> newHandler("https://localhost").handle());
    5656        assertEquals("The following keys are mandatory, but have not been provided: objects", e.getMessage());
     
    6161     */
    6262    @Test
    63     public void testNominalRequest() {
     63    void testNominalRequest() {
    6464        assertDoesNotThrow(() -> newHandler("https://localhost?objects=foo,bar").handle());
    6565    }
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandlerTest.java

    r12558 r17275  
    22package org.openstreetmap.josm.io.remotecontrol.handler;
    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
    67import java.util.Collections;
     
    89import java.util.Map;
    910
    10 import org.junit.Rule;
    11 import org.junit.Test;
     11import org.junit.jupiter.api.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
    1213import org.openstreetmap.josm.io.remotecontrol.PermissionPrefWithDefault;
    1314import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
     
    1920 * Unit tests of {@link RequestHandler} class.
    2021 */
    21 public class RequestHandlerTest {
     22class RequestHandlerTest {
    2223
    2324    /**
    2425     * Setup test.
    2526     */
    26     @Rule
     27    @RegisterExtension
    2728    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2829    public JOSMTestRules test = new JOSMTestRules();
     
    6263     */
    6364    @Test
    64     public void testRequestParameter1() throws RequestHandlerBadRequestException {
     65    void testRequestParameter1() throws RequestHandlerBadRequestException {
    6566        final Map<String, String> expected = new HashMap<>();
    6667        expected.put("query", "a");
     
    7475     */
    7576    @Test
    76     public void testRequestParameter2() throws RequestHandlerBadRequestException {
     77    void testRequestParameter2() throws RequestHandlerBadRequestException {
    7778        assertEquals(Collections.singletonMap("query", "a&b==c"),
    7879                getRequestParameter("http://example.com/?query=a%26b==c"));
     
    8485     */
    8586    @Test
    86     public void testRequestParameter3() throws RequestHandlerBadRequestException {
     87    void testRequestParameter3() throws RequestHandlerBadRequestException {
    8788        assertEquals(Collections.singleton("blue+light blue"),
    8889                getRequestParameter("http://example.com/blue+light%20blue?blue%2Blight+blue").keySet());
     
    9697     */
    9798    @Test
    98     public void testRequestParameter4() throws RequestHandlerBadRequestException {
     99    void testRequestParameter4() throws RequestHandlerBadRequestException {
    99100        assertEquals(Collections.singletonMap("/?:@-._~!$'()* ,;", "/?:@-._~!$'()* ,;=="), getRequestParameter(
    100101            "http://example.com/:@-._~!$&'()*+,=;:@-._~!$&'()*+,=:@-._~!$&'()*+,==?/?:@-._~!$'()*+,;=/?:@-._~!$'()*+,;==#/?:@-._~!$&'()*+,;="
     
    107108     */
    108109    @Test
    109     public void testRequestParameter5() throws RequestHandlerBadRequestException {
     110    void testRequestParameter5() throws RequestHandlerBadRequestException {
    110111        final Map<String, String> expected = new HashMap<>();
    111112        expected.put("space", " ");
     
    119120     */
    120121    @Test
    121     public void testRequestParameter6() throws RequestHandlerBadRequestException {
     122    void testRequestParameter6() throws RequestHandlerBadRequestException {
    122123        final Map<String, String> expected = new HashMap<>();
    123124        expected.put("addtags", "wikipedia:de=Weiße_Gasse|maxspeed=5");
     
    135136    /**
    136137     * Test request parameter - invalid case
    137      * @throws RequestHandlerBadRequestException always
    138138     */
    139     @Test(expected = RequestHandlerBadRequestException.class)
    140     public void testRequestParameterInvalid() throws RequestHandlerBadRequestException {
    141         getRequestParameter("http://localhost:8111/load_and_zoom"+
     139    @Test
     140    void testRequestParameterInvalid() {
     141        assertThrows(RequestHandlerBadRequestException.class,
     142                () -> getRequestParameter("http://localhost:8111/load_and_zoom"+
    142143                "?addtags=wikipedia:de=Wei%C3%9Fe_Gasse|maxspeed=5"+
    143144                "&select=way23071688,way23076176,way23076177,"+
    144                 "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325");
     145                "&left=13.739727546842&right=13.740890970188&top=51.049987191025&bottom=51.048466954325"));
    145146    }
    146147}
  • trunk/test/unit/org/openstreetmap/josm/io/rtklib/RtkLibPosReaderTest.java

    r16006 r17275  
    22package org.openstreetmap.josm.io.rtklib;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.io.IOException;
     
    1212import java.util.TimeZone;
    1313
    14 import org.junit.Before;
    15 import org.junit.Rule;
    16 import org.junit.Test;
     14import org.junit.jupiter.api.BeforeEach;
     15import org.junit.jupiter.api.Test;
     16import org.junit.jupiter.api.extension.RegisterExtension;
    1717import org.openstreetmap.josm.data.coor.LatLon;
    1818import org.openstreetmap.josm.data.gpx.GpxConstants;
     
    2727 * Unit tests of {@link RtkLibPosReader} class.
    2828 */
    29 public class RtkLibPosReaderTest {
     29class RtkLibPosReaderTest {
    3030    /**
    3131     * Set the timezone and timeout.
    3232     */
    33     @Rule
     33    @RegisterExtension
    3434    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3535    public JOSMTestRules test = new JOSMTestRules();
     
    4040     * Forces the timezone.
    4141     */
    42     @Before
     42    @BeforeEach
    4343    public void setUp() {
    4444        iso8601.setTimeZone(DateUtils.UTC);
     
    5757     */
    5858    @Test
    59     public void testReader() throws Exception {
     59    void testReader() throws Exception {
    6060        RtkLibPosReader in = read("nodist/data/rtklib_example.pos");
    6161        assertEquals(137, in.getNumberOfCoordinates());
     
    8383     */
    8484    @Test
    85     public void testReader2() throws Exception {
     85    void testReader2() throws Exception {
    8686        RtkLibPosReader in = read("nodist/data/rtklib_example2.pos");
    8787        assertEquals(6, in.getNumberOfCoordinates());
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionReaderTest.java

    r15070 r17275  
    22package org.openstreetmap.josm.io.session;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertNotNull;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.ByteArrayInputStream;
     
    1313import java.util.List;
    1414
    15 import org.junit.Rule;
    16 import org.junit.Test;
     15import org.junit.jupiter.api.extension.RegisterExtension;
     16import org.junit.jupiter.api.Test;
    1717import org.openstreetmap.josm.TestUtils;
    1818import org.openstreetmap.josm.data.coor.EastNorth;
     
    3333 * Unit tests for Session reading.
    3434 */
    35 public class SessionReaderTest {
     35class SessionReaderTest {
    3636
    3737    /**
    3838     * Setup tests.
    3939     */
    40     @Rule
     40    @RegisterExtension
    4141    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    4242    public JOSMTestRules test = new JOSMTestRules().projection();
     
    6060     */
    6161    @Test
    62     public void testReadEmpty() throws IOException, IllegalDataException {
     62    void testReadEmpty() throws IOException, IllegalDataException {
    6363        assertTrue(testRead("empty.jos").isEmpty());
    6464        assertTrue(testRead("empty.joz").isEmpty());
     
    7171     */
    7272    @Test
    73     public void testReadOsm() throws IOException, IllegalDataException {
     73    void testReadOsm() throws IOException, IllegalDataException {
    7474        for (String file : new String[]{"osm.jos", "osm.joz"}) {
    7575            List<Layer> layers = testRead(file);
     
    8787     */
    8888    @Test
    89     public void testReadGpx() throws IOException, IllegalDataException {
     89    void testReadGpx() throws IOException, IllegalDataException {
    9090        for (String file : new String[]{"gpx.jos", "gpx.joz", "nmea.jos"}) {
    9191            List<Layer> layers = testRead(file);
     
    103103     */
    104104    @Test
    105     public void testReadGpxAndMarker() throws IOException, IllegalDataException {
     105    void testReadGpxAndMarker() throws IOException, IllegalDataException {
    106106        List<Layer> layers = testRead("gpx_markers.joz");
    107107        assertEquals(layers.size(), 2);
     
    127127     */
    128128    @Test
    129     public void testReadImage() throws IOException, IllegalDataException {
     129    void testReadImage() throws IOException, IllegalDataException {
    130130        final List<Layer> layers = testRead("bing.jos");
    131131        assertEquals(layers.size(), 1);
     
    144144     */
    145145    @Test
    146     public void testReadNotes() throws IOException, IllegalDataException {
     146    void testReadNotes() throws IOException, IllegalDataException {
    147147        if (MainApplication.isDisplayingMapView()) {
    148148            for (NoteLayer nl : MainApplication.getLayerManager().getLayersOfType(NoteLayer.class)) {
     
    163163     */
    164164    @Test
    165     public void testTicket17701() throws Exception {
     165    void testTicket17701() throws Exception {
    166166        try (InputStream in = new ByteArrayInputStream(("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
    167167                "<josm-session version=\"0.1\">\n" +
  • trunk/test/unit/org/openstreetmap/josm/io/session/SessionWriterTest.java

    r14138 r17275  
    1010import java.util.Map;
    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.coor.LatLon;
    1616import org.openstreetmap.josm.data.gpx.GpxData;
     
    3838 * Unit tests for Session writing.
    3939 */
    40 public class SessionWriterTest {
     40class SessionWriterTest {
    4141
    4242    protected static final class OsmHeadlessJosExporter extends OsmDataSessionExporter {
     
    8787     * Setup tests.
    8888     */
    89     @Rule
     89    @RegisterExtension
    9090    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    9191    public JOSMTestRules test = new JOSMTestRules().projection().main();
     
    9494     * Setup tests.
    9595     */
    96     @Before
     96    @BeforeEach
    9797    public void setUp() {
    9898        MainApplication.getLayerManager().addLayer(createOsmLayer());
     
    157157     */
    158158    @Test
    159     public void testWriteEmptyJos() throws IOException {
     159    void testWriteEmptyJos() throws IOException {
    160160        testWrite(Collections.<Layer>emptyList(), false);
    161161    }
     
    166166     */
    167167    @Test
    168     public void testWriteEmptyJoz() throws IOException {
     168    void testWriteEmptyJoz() throws IOException {
    169169        testWrite(Collections.<Layer>emptyList(), true);
    170170    }
     
    175175     */
    176176    @Test
    177     public void testWriteOsmJos() throws IOException {
     177    void testWriteOsmJos() throws IOException {
    178178        testWrite(Collections.<Layer>singletonList(createOsmLayer()), false);
    179179    }
     
    184184     */
    185185    @Test
    186     public void testWriteOsmJoz() throws IOException {
     186    void testWriteOsmJoz() throws IOException {
    187187        testWrite(Collections.<Layer>singletonList(createOsmLayer()), true);
    188188    }
     
    193193     */
    194194    @Test
    195     public void testWriteGpxJos() throws IOException {
     195    void testWriteGpxJos() throws IOException {
    196196        testWrite(Collections.<Layer>singletonList(createGpxLayer()), false);
    197197    }
     
    202202     */
    203203    @Test
    204     public void testWriteGpxJoz() throws IOException {
     204    void testWriteGpxJoz() throws IOException {
    205205        testWrite(Collections.<Layer>singletonList(createGpxLayer()), true);
    206206    }
     
    211211     */
    212212    @Test
    213     public void testWriteGpxAndMarkerJoz() throws IOException {
     213    void testWriteGpxAndMarkerJoz() throws IOException {
    214214        GpxLayer gpx = createGpxLayer();
    215215        testWrite(Arrays.asList(gpx, createMarkerLayer(gpx)), true);
     
    221221     */
    222222    @Test
    223     public void testWriteImageryLayer() throws IOException {
     223    void testWriteImageryLayer() throws IOException {
    224224        final Layer layer = createImageryLayer();
    225225        testWrite(Collections.singletonList(layer), true);
     
    231231     */
    232232    @Test
    233     public void testWriteNoteLayer() throws IOException {
     233    void testWriteNoteLayer() throws IOException {
    234234        final Layer layer = createNoteLayer();
    235235        testWrite(Collections.singletonList(layer), true);
Note: See TracChangeset for help on using the changeset viewer.