Ignore:
Timestamp:
2023-03-13T21:59:27+01:00 (3 years ago)
Author:
taylor.smock
Message:

See #16567: Convert all assertion calls to JUnit 5 (patch by gaben, modified)

The modifications are as follows:

  • Merge DomainValidatorTest.testIDN and DomainValidatorTest.testIDNJava6OrLater
  • Update some tests to use @ParameterizedTest (DomainValidatorTest)
  • Replace various exception blocks with assertThrows. These typically looked like
        try {
            // Something that should throw an exception here
            fail("An exception should have been thrown");
        } catch (Exception e) {
            // Verify the exception matches expectations here
        }
    
  • Replace assertTrue(val instanceof Clazz) with assertInstanceOf
  • Replace JUnit 4 @Suite with JUnit 5 @Suite

Both the original patch and the modified patch fix various lint issues.

Location:
trunk/test/performance/org/openstreetmap/josm/gui/mappaint
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/MapRendererPerformanceTest.java

    r17615 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    57
    68import java.awt.Color;
     
    2123import javax.imageio.ImageIO;
    2224
    23 import org.junit.Assert;
    2425import org.junit.jupiter.api.AfterAll;
    2526import org.junit.jupiter.api.BeforeAll;
     
    125126        List<StyleSource> sources = MapPaintStyles.getStyles().getStyleSources();
    126127        filterStyleIdx = sources.indexOf(filterStyle);
    127         Assert.assertEquals(2, filterStyleIdx);
    128 
    129         Assert.assertEquals(Feature.values().length, filterStyle.settings.size());
     128        assertEquals(2, filterStyleIdx);
     129
     130        assertEquals(Feature.values().length, filterStyle.settings.size());
    130131        for (StyleSetting set : filterStyle.settings) {
    131132            BooleanStyleSetting bset = (BooleanStyleSetting) set;
     
    139140                }
    140141            }
    141             Assert.assertTrue(prefKey, found);
     142            assertTrue(found, prefKey);
    142143        }
    143144
     
    151152            }
    152153        }
    153         Assert.assertNotNull(defaultStyle);
     154        assertNotNull(defaultStyle);
    154155
    155156        for (StyleSetting set : defaultStyle.settings) {
     
    161162            }
    162163        }
    163         Assert.assertNotNull(hideIconsSetting);
     164        assertNotNull(hideIconsSetting);
    164165        hideIconsSetting.setValue(false);
    165166        MapPaintStyleLoader.reloadStyles(defaultStyleIdx);
     
    209210            if (checkScale) {
    210211                int lvl = Selector.GeneralSelector.scale2level(nc.getDist100Pixel());
    211                 Assert.assertEquals(17, lvl);
     212                assertEquals(17, lvl);
    212213            }
    213214
     
    360361
    361362        public void dumpTimes() {
    362             System.out.print(String.format("gen. %4d, sort %4d, draw %4d%n", getGenerateTime(), getSortTime(), getDrawTime()));
     363            System.out.printf("gen. %4d, sort %4d, draw %4d%n", getGenerateTime(), getSortTime(), getDrawTime());
    363364        }
    364365
  • trunk/test/performance/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleSourceFilterTest.java

    r17275 r18690  
    1818 * @author Michael Zangl
    1919 */
    20 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     20@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2121class MapCSSStyleSourceFilterTest {
    2222
     
    7171
    7272        private void addRule(String selector) {
    73             sb.append(selector + " {}\n");
     73            sb.append(selector).append(" {}\n");
    7474        }
    7575
Note: See TracChangeset for help on using the changeset viewer.