Ignore:
Timestamp:
2020-10-28T20:41:00+01:00 (9 months ago)
Author:
Don-vip
Message:

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

Location:
trunk/test/unit/org/openstreetmap/josm/tools/bugreport
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportExceptionHandlerTest.java

    r12802 r17275  
    44import java.util.concurrent.CountDownLatch;
    55
    6 import org.junit.Rule;
    7 import org.junit.Test;
     6import org.junit.jupiter.api.extension.RegisterExtension;
     7import org.junit.jupiter.api.Test;
    88import org.openstreetmap.josm.testutils.JOSMTestRules;
    99
     
    1313 * Unit tests of {@link BugReportExceptionHandler} class.
    1414 */
    15 public class BugReportExceptionHandlerTest {
     15class BugReportExceptionHandlerTest {
    1616    /**
    1717     * No dependencies
    1818     */
    19     @Rule
     19    @RegisterExtension
    2020    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2121    public JOSMTestRules test = new JOSMTestRules();
     
    2626     */
    2727    @Test
    28     public void testHandleException() throws InterruptedException {
     28    void testHandleException() throws InterruptedException {
    2929        CountDownLatch latch = new CountDownLatch(1);
    3030        BugReportQueue.getInstance().addBugReportHandler(e -> {
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/BugReportTest.java

    r14138 r17275  
    22package org.openstreetmap.josm.tools.bugreport;
    33
    4 import static org.junit.Assert.assertEquals;
    5 import static org.junit.Assert.assertSame;
    6 import static org.junit.Assert.assertTrue;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
     5import static org.junit.jupiter.api.Assertions.assertSame;
     6import static org.junit.jupiter.api.Assertions.assertTrue;
    77
    88import java.io.IOException;
     
    1010import java.io.StringWriter;
    1111
    12 import org.junit.Rule;
    13 import org.junit.Test;
     12import org.junit.jupiter.api.extension.RegisterExtension;
     13import org.junit.jupiter.api.Test;
    1414import org.openstreetmap.josm.actions.ShowStatusReportAction;
    1515import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2121 * @author Michael Zangl
    2222 */
    23 public class BugReportTest {
     23class BugReportTest {
    2424    /**
    2525     * Preferences for the report text
    2626     */
    27     @Rule
     27    @RegisterExtension
    2828    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    2929    public JOSMTestRules test = new JOSMTestRules().preferences();
     
    3333     */
    3434    @Test
    35     public void testReportText() {
     35    void testReportText() {
    3636        ReportedException e = interceptInChildMethod(new IOException("test-exception-message"));
    3737        e.put("test-key", "test-value");
     
    4848     */
    4949    @Test
    50     public void testIntercept() {
     50    void testIntercept() {
    5151        IOException base = new IOException("test");
    5252        ReportedException intercepted = interceptInChildMethod(base);
     
    6969     */
    7070    @Test
    71     public void testGetCallingMethod() {
     71    void testGetCallingMethod() {
    7272        assertEquals("BugReportTest#testGetCallingMethod", BugReport.getCallingMethod(1));
    7373        assertEquals("BugReportTest#testGetCallingMethod", testGetCallingMethod2());
  • trunk/test/unit/org/openstreetmap/josm/tools/bugreport/ReportedExceptionTest.java

    r10285 r17275  
    22package org.openstreetmap.josm.tools.bugreport;
    33
    4 import static org.junit.Assert.assertEquals;
     4import static org.junit.jupiter.api.Assertions.assertEquals;
    55
    66import java.util.Arrays;
    77
    8 import org.junit.Test;
     8import org.junit.jupiter.api.Test;
    99
    1010/**
     
    1313 * @since 10285
    1414 */
    15 public class ReportedExceptionTest {
     15class ReportedExceptionTest {
    1616    private static final class CauseOverwriteException extends RuntimeException {
    1717        private Throwable myCause;
     
    3131     */
    3232    @Test
    33     public void testPutDoesHandleNull() {
     33    void testPutDoesHandleNull() {
    3434        ReportedException e = new ReportedException(new RuntimeException());
    3535        e.startSection("test");
     
    4545     */
    4646    @Test
    47     public void testPutDoesNotThrow() {
     47    void testPutDoesNotThrow() {
    4848        ReportedException e = new ReportedException(new RuntimeException());
    4949        e.startSection("test");
     
    6565     */
    6666    @Test
    67     public void testIsSame() {
     67    void testIsSame() {
    6868        // Do not break this line! All exceptions need to be created in the same line.
    6969        // CHECKSTYLE.OFF: LineLength
     
    7878                boolean is01 = (i == 0 || i == 1) && (j == 0 || j == 1);
    7979                boolean is23 = (i == 2 || i == 3) && (j == 2 || j == 3);
    80                 assertEquals(i + ", " + j, is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]));
     80                assertEquals(is01 || is23 || i == j, testExceptions[i].isSame(testExceptions[j]), i + ", " + j);
    8181            }
    8282        }
Note: See TracChangeset for help on using the changeset viewer.