Ignore:
Timestamp:
2023-03-13T21:59:27+01:00 (2 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.

File:
1 edited

Legend:

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

    r17715 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertNull;
    67import static org.junit.jupiter.api.Assertions.assertTrue;
    78
     
    7071        assertEquals("3d", wayPoints.get(0).get(GpxConstants.PT_FIX));
    7172        assertEquals("0.7", wayPoints.get(0).get(GpxConstants.PT_HDOP).toString().trim());
    72         assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_VDOP));
    73         assertEquals(null, wayPoints.get(0).get(GpxConstants.PT_PDOP));
     73        assertNull(wayPoints.get(0).get(GpxConstants.PT_VDOP));
     74        assertNull(wayPoints.get(0).get(GpxConstants.PT_PDOP));
    7475    }
    7576
Note: See TracChangeset for help on using the changeset viewer.