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/gui/io/AsynchronousUploadPrimitivesTaskTest.java

    r17275 r18690  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.io;
     3
     4import static org.junit.jupiter.api.Assertions.assertFalse;
     5import static org.junit.jupiter.api.Assertions.assertNotNull;
    36
    47import java.util.Collections;
     
    710import javax.swing.JOptionPane;
    811
    9 import org.junit.Assert;
    1012import org.junit.jupiter.api.AfterEach;
    1113import org.junit.jupiter.api.BeforeEach;
     
    9496        Optional<AsynchronousUploadPrimitivesTask> task = AsynchronousUploadPrimitivesTask.
    9597                createAsynchronousUploadTask(strategy, layer, toUpload, changeset);
    96         Assert.assertNotNull(uploadPrimitivesTask);
    97         Assert.assertFalse(task.isPresent());
     98        assertNotNull(uploadPrimitivesTask);
     99        assertFalse(task.isPresent());
    98100    }
    99101}
Note: See TracChangeset for help on using the changeset viewer.