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/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/performance/org/openstreetmap/josm/io/OsmReaderPerformanceTest.java

    r17615 r18690  
    1010import java.io.IOException;
    1111import java.io.InputStream;
     12import java.nio.file.Files;
    1213import java.util.concurrent.TimeUnit;
    1314
     
    2728 * @author Michael Zangl
    2829 */
    29 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     30@Timeout(value = 15, unit = TimeUnit.MINUTES)
    3031class OsmReaderPerformanceTest {
    3132    private static final int TIMES = 4;
     
    7374    private InputStream loadFile(boolean decompressBeforeRead) throws IOException {
    7475        File file = new File(PerformanceTestUtils.DATA_FILE);
    75         try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : new FileInputStream(file)) {
     76        try (InputStream is = decompressBeforeRead ? Compression.getUncompressedFileInputStream(file) : Files.newInputStream(file.toPath())) {
    7677            ByteArrayOutputStream temporary = new ByteArrayOutputStream();
    7778            byte[] readBuffer = new byte[4096];
  • trunk/test/performance/org/openstreetmap/josm/io/OsmWriterPerformanceTest.java

    r17848 r18690  
    2020 * For this, we use the neubrandenburg-file, which is a good real world example of an OSM file.
    2121 */
    22 @Timeout(value = 15*60, unit = TimeUnit.SECONDS)
     22@Timeout(value = 15, unit = TimeUnit.MINUTES)
    2323class OsmWriterPerformanceTest {
    2424    private static final int TIMES = 4;
Note: See TracChangeset for help on using the changeset viewer.