Ignore:
Timestamp:
2023-03-13T21:59:27+01:00 (13 months 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/data/osm/OsmUtilsTest.java

    r17586 r18690  
    44import static org.junit.jupiter.api.Assertions.assertEquals;
    55import static org.junit.jupiter.api.Assertions.assertFalse;
     6import static org.junit.jupiter.api.Assertions.assertInstanceOf;
    67import static org.junit.jupiter.api.Assertions.assertNull;
    78import static org.junit.jupiter.api.Assertions.assertTrue;
     
    3536    void testCreatePrimitive() {
    3637        final OsmPrimitive p = OsmUtils.createPrimitive("way name=Foo railway=rail");
    37         assertTrue(p instanceof Way);
     38        assertInstanceOf(Way.class, p);
    3839        assertEquals(2, p.getKeys().size());
    3940        assertEquals("Foo", p.get("name"));
Note: See TracChangeset for help on using the changeset viewer.