Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (6 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/performance/org/openstreetmap/josm/data/osm
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/data/osm/KeyValuePerformanceTest.java

    r16913 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertFalse;
    6 import static org.junit.Assert.assertNotSame;
    7 import static org.junit.Assert.assertSame;
    8 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNotSame;
     7import static org.junit.jupiter.api.Assertions.assertSame;
     8import static org.junit.jupiter.api.Assertions.assertTrue;
    99
    1010import java.security.SecureRandom;
    1111import java.util.ArrayList;
    1212import java.util.Random;
     13import java.util.concurrent.TimeUnit;
    1314
    1415import org.apache.commons.lang3.RandomStringUtils;
    1516import org.junit.Before;
    16 import org.junit.Rule;
    17 import org.junit.Test;
    18 import org.junit.rules.Timeout;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.Timeout;
     19import org.junit.jupiter.api.extension.RegisterExtension;
    1920import org.openstreetmap.josm.PerformanceTestUtils;
    2021import org.openstreetmap.josm.PerformanceTestUtils.PerformanceTestTimer;
     
    2829 * @author Michael Zangl
    2930 */
    30 public class KeyValuePerformanceTest {
     31@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     32class KeyValuePerformanceTest {
    3133    private static final int PUT_RUNS = 10000;
    3234    private static final int GET_RUNS = 100000;
     
    3840
    3941    /**
    40      * Global timeout applied to all test methods.
    41      */
    42     @Rule
    43     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    44     public Timeout globalTimeout = Timeout.seconds(15*60);
    45 
    46     /**
    4742     * Prepare the test.
    4843     */
    49     @Rule
     44    @RegisterExtension
    5045    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    5146    public JOSMTestRules test = new JOSMTestRules().projection();
     
    5651    @Test
    5752    @SuppressFBWarnings(value = "DM_STRING_CTOR", justification = "test Strings that are interned and those that are not")
    58     public void testMeasureStringEqualsIntern() {
     53    void testMeasureStringEqualsIntern() {
    5954        String str1Interned = "string1";
    6055        String str1InternedB = "string1";
     
    134129     */
    135130    @Test
    136     public void testKeyValuePut() {
     131    void testKeyValuePut() {
    137132        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    138133            int nodeCount = (int) (PUT_RUNS / tagNodeRatio);
     
    158153    @Test
    159154    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    160     public void testKeyValueGet() {
     155    void testKeyValueGet() {
    161156        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    162157            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
     
    179174     */
    180175    @Test
    181     public void testKeyValueGetKeys() {
     176    void testKeyValueGetKeys() {
    182177        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    183178            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
     
    202197    @Test
    203198    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    204     public void testKeyValueGetKeysGet() {
     199    void testKeyValueGetKeysGet() {
    205200        for (double tagNodeRatio : TAG_NODE_RATIOS) {
    206201            KeyValueDataGenerator generator = OsmDataGenerator.getKeyValue(tagNodeRatio);
  • trunk/test/performance/org/openstreetmap/josm/data/osm/RoundingPerformanceTest.java

    r10758 r17275  
    22package org.openstreetmap.josm.data.osm;
    33
    4 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertTrue;
    55
    6 import org.junit.Test;
     6import org.junit.jupiter.api.Test;
    77import org.openstreetmap.josm.data.coor.LatLon;
    88import org.openstreetmap.josm.data.coor.LatLonTest;
     
    1313 * Checks that rounding of coordinates is not too slow.
    1414 */
    15 public class RoundingPerformanceTest {
     15class RoundingPerformanceTest {
    1616
    1717    private static double oldRoundToOsmPrecision(double value) {
     
    2525    @Test
    2626    @SuppressFBWarnings(value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT")
    27     public void testRounding() {
     27    void testRounding() {
    2828        final int n = 1000000;
    2929        long start = System.nanoTime();
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/AbstractMapRendererPerformanceTestParent.java

    r16006 r17275  
    1111import java.nio.file.Files;
    1212import java.nio.file.Paths;
     13import java.util.concurrent.TimeUnit;
    1314
    1415import javax.imageio.ImageIO;
    1516
    16 import org.junit.Rule;
    17 import org.junit.Test;
    18 import org.junit.rules.Timeout;
     17import org.junit.jupiter.api.Test;
     18import org.junit.jupiter.api.Timeout;
    1919import org.openstreetmap.josm.JOSMFixture;
    2020import org.openstreetmap.josm.data.Bounds;
     
    3030 * Abstract superclass of {@code StyledMapRendererPerformanceTest} and {@code WireframeMapRendererPerformanceTest}.
    3131 */
    32 public abstract class AbstractMapRendererPerformanceTestParent {
     32@Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     33abstract class AbstractMapRendererPerformanceTestParent {
    3334
    3435    private static final int IMG_WIDTH = 1400;
     
    4546    private static DataSet dsOverpass;
    4647    private static DataSet dsCity;
    47 
    48     /**
    49      * Global timeout applied to all test methods.
    50      */
    51     @Rule
    52     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    53     public Timeout globalTimeout = Timeout.seconds(15*60);
    5448
    5549    protected static void load() throws Exception {
     
    112106
    113107    @Test
    114     public void testRestriction() throws Exception {
     108    void testRestriction() throws Exception {
    115109        test(700, dsRestriction, new Bounds(51.12, 14.147472381591795, 51.128, 14.162492752075195));
    116110    }
    117111
    118112    @Test
    119     public void testRestrictionSmall() throws Exception {
     113    void testRestrictionSmall() throws Exception {
    120114        test(1500, dsRestriction, new Bounds(51.125, 14.147, 51.128, 14.152));
    121115    }
    122116
    123117    @Test
    124     public void testMultipolygon() throws Exception {
     118    void testMultipolygon() throws Exception {
    125119        test(400, dsMultipolygon, new Bounds(60, -180, 85, -122));
    126120    }
    127121
    128122    @Test
    129     public void testMultipolygonSmall() throws Exception {
     123    void testMultipolygonSmall() throws Exception {
    130124        test(850, dsMultipolygon, new Bounds(-90, -180, 90, 180));
    131125    }
     
    135129     * Complex polygon (Lake Ontario) with small download area.
    136130     */
    137     public void testOverpassDownload() throws Exception {
     131    void testOverpassDownload() throws Exception {
    138132        test(20, dsOverpass, new Bounds(43.4510496, -76.536684, 43.4643202, -76.4954853));
    139133    }
    140134
    141135    @Test
    142     public void testCity() throws Exception {
     136    void testCity() throws Exception {
    143137        test(50, dsCity, new Bounds(53.51, 13.20, 53.59, 13.34));
    144138    }
    145139
    146140    @Test
    147     public void testCitySmall() throws Exception {
     141    void testCitySmall() throws Exception {
    148142        test(70, dsCity, new Bounds(52, 11, 55, 14));
    149143    }
    150144
    151145    @Test
    152     public void testCityPart1() throws Exception {
     146    void testCityPart1() throws Exception {
    153147        test(250, dsCity, new Bounds(53.56, 13.25, 53.57, 13.26));
    154148    }
    155149
    156150    @Test
    157     public void testCityPart2() throws Exception {
     151    void testCityPart2() throws Exception {
    158152        test(200, dsCity, new Bounds(53.55, 13.29, 53.57, 13.30));
    159153    }
    160154
    161155    @Test
    162     public void testCitySmallPart2() throws Exception {
     156    void testCitySmallPart2() throws Exception {
    163157        test(200, dsCity, new Bounds(53.56, 13.295, 53.57, 13.30));
    164158    }
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/StyledMapRendererPerformanceTest.java

    r10907 r17275  
    77import javax.imageio.ImageIO;
    88
    9 import org.junit.AfterClass;
    10 import org.junit.BeforeClass;
     9import org.junit.jupiter.api.AfterAll;
     10import org.junit.jupiter.api.BeforeAll;
    1111import org.openstreetmap.josm.gui.mappaint.MapPaintStyles;
    1212
     
    1616 * Performance test of {@code StyledMapRenderer}.
    1717 */
    18 public class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
     18class StyledMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
    1919
    20     @BeforeClass
     20    @BeforeAll
    2121    public static void load() throws Exception {
    2222        AbstractMapRendererPerformanceTestParent.load();
     
    2525    }
    2626
    27     @AfterClass
     27    @AfterAll
    2828    public static void clean() throws Exception {
    2929        AbstractMapRendererPerformanceTestParent.clean();
  • trunk/test/performance/org/openstreetmap/josm/data/osm/visitor/paint/WireframeMapRendererPerformanceTest.java

    r10907 r17275  
    22package org.openstreetmap.josm.data.osm.visitor.paint;
    33
    4 import org.junit.AfterClass;
    5 import org.junit.BeforeClass;
     4import org.junit.jupiter.api.AfterAll;
     5import org.junit.jupiter.api.BeforeAll;
    66
    77/**
    88 * Performance test of {@code WireframeMapRenderer}.
    99 */
    10 public class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
     10class WireframeMapRendererPerformanceTest extends AbstractMapRendererPerformanceTestParent {
    1111
    12     @BeforeClass
     12    @BeforeAll
    1313    public static void load() throws Exception {
    1414        AbstractMapRendererPerformanceTestParent.load();
    1515    }
    1616
    17     @AfterClass
     17    @AfterAll
    1818    public static void clean() throws Exception {
    1919        AbstractMapRendererPerformanceTestParent.clean();
Note: See TracChangeset for help on using the changeset viewer.