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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java

    r17275 r18690  
    33
    44import static org.junit.jupiter.api.Assertions.assertNotNull;
     5import static org.junit.jupiter.api.Assertions.assertTrue;
    56
    67import java.lang.reflect.Constructor;
     
    1415import javax.swing.table.TableCellRenderer;
    1516
    16 import org.junit.Assert;
    1717import org.junit.jupiter.api.extension.RegisterExtension;
    1818import org.junit.jupiter.api.Test;
     
    6464    void testTableCellRenderer() throws ReflectiveOperationException {
    6565        Set<Class<? extends TableCellRenderer>> renderers = TestUtils.getJosmSubtypes(TableCellRenderer.class);
    66         Assert.assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
     66        assertTrue(renderers.size() >= 10); // if it finds less than 10 classes, something is broken
    6767        JTable tbl = new JTable(2, 2);
    6868        for (Class<? extends TableCellRenderer> klass : renderers) {
Note: See TracChangeset for help on using the changeset viewer.