Changeset 17276 in josm for trunk/test/functional/org


Ignore:
Timestamp:
2020-10-28T22:46:55+01:00 (4 years ago)
Author:
Don-vip
Message:

see #16567 - fix obvious test errors + upgrade tests dependencies

Location:
trunk/test/functional/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/gui/mappaint/MapCSSRendererTest.java

    r17275 r17276  
    2828import javax.imageio.ImageIO;
    2929
    30 import org.junit.jupiter.api.BeforeEach;
    31 import org.junit.jupiter.api.Test;
    3230import org.junit.jupiter.api.extension.RegisterExtension;
    33 import org.junit.runner.RunWith;
    34 import org.junit.runners.Parameterized;
    35 import org.junit.runners.Parameterized.Parameters;
     31import org.junit.jupiter.params.ParameterizedTest;
     32import org.junit.jupiter.params.provider.MethodSource;
    3633import org.openstreetmap.josm.TestUtils;
    3734import org.openstreetmap.josm.data.Bounds;
     
    5552 * @author Michael Zangl
    5653 */
    57 @RunWith(Parameterized.class)
    5854public class MapCSSRendererTest {
    5955    private static final String TEST_DATA_BASE = "/renderer/";
     
    7167    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    7268
    73     private final TestConfig testConfig;
    74 
    7569    // development flag - set to true in order to update all reference images
    7670    private static final boolean UPDATE_ALL = false;
     
    8175     * @return The parameters.
    8276     */
    83     @Parameters(name = "{1}")
    8477    public static Collection<Object[]> runs() {
    8578        return Stream.of(
     
    169162
    170163    /**
     164     * Run the test using {@code testConfig}
    171165     * @param testConfig The config to use for this test.
    172166     * @param ignored The name to print it nicely
     167     * @throws Exception if an error occurs
    173168     */
    174     public MapCSSRendererTest(TestConfig testConfig, String ignored) {
    175         this.testConfig = testConfig;
    176     }
    177 
    178     /**
    179      * This test only runs on OpenJDK.
    180      * It is ignored for other Java versions since they differ slightly in their rendering engine.
    181      * @since 11691
    182      */
    183     @BeforeEach
    184     public void forOpenJDK() {
     169    @ParameterizedTest(name = "{1}")
     170    @MethodSource("runs")
     171    void testRender(TestConfig testConfig, String ignored) throws Exception {
     172        // This test only runs on OpenJDK.
     173        // It is ignored for other Java versions since they differ slightly in their rendering engine.
    185174        String javaHome = System.getProperty("java.home");
    186175        assumeTrue(javaHome != null && javaHome.toLowerCase(Locale.ENGLISH).contains("openjdk"), "Test requires openJDK");
     
    190179            assumeTrue(fonts.contains(font), "Test requires font: " + font);
    191180        }
    192     }
    193 
    194     /**
    195      * Run the test using {@link #testConfig}
    196      * @throws Exception if an error occurs
    197      */
    198     @Test
    199     void testRender() throws Exception {
     181
    200182        // Force reset of preferences
    201183        StyledMapRenderer.PREFERENCE_ANTIALIASING_USE.put(true);
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r17275 r17276  
    2323import java.util.Random;
    2424import java.util.TreeSet;
     25import java.util.concurrent.TimeUnit;
    2526import java.util.logging.Logger;
    2627
     
    2829import org.junit.jupiter.api.BeforeEach;
    2930import org.junit.jupiter.api.Test;
     31import org.junit.jupiter.api.Timeout;
    3032import org.junit.jupiter.api.extension.RegisterExtension;
    31 import org.junit.rules.Timeout;
    3233import org.openstreetmap.josm.JOSMFixture;
    3334import org.openstreetmap.josm.TestUtils;
     
    5152 */
    5253@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS")
     54@Timeout(value = 60, unit = TimeUnit.SECONDS)
    5355class MultiFetchServerObjectReaderTest {
    5456    private static final Logger logger = Logger.getLogger(MultiFetchServerObjectReader.class.getName());
     
    6062    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    6163    public JOSMTestRules test = new JOSMTestRules().preferences();
    62 
    63     /**
    64      * Global timeout applied to all test methods.
    65      */
    66     @RegisterExtension
    67     public Timeout globalTimeout = Timeout.seconds(60);
    6864
    6965    /**
Note: See TracChangeset for help on using the changeset viewer.