Changeset 16617 in josm for trunk/test


Ignore:
Timestamp:
2020-06-14T11:54:09+02:00 (4 years ago)
Author:
simon04
Message:

fix #16567 - Upgrade to JUnit 5 (patch by taylor.smock)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r16321 r16617  
    2424
    2525import org.awaitility.Awaitility;
     26import org.junit.jupiter.api.extension.AfterEachCallback;
     27import org.junit.jupiter.api.extension.BeforeEachCallback;
     28import org.junit.jupiter.api.extension.ExtensionContext;
    2629import org.junit.rules.TemporaryFolder;
    2730import org.junit.rules.TestRule;
     
    7982 * @author Michael Zangl
    8083 */
    81 public class JOSMTestRules implements TestRule {
     84public class JOSMTestRules implements TestRule, AfterEachCallback, BeforeEachCallback {
    8285    private int timeout = isDebugMode() ? -1 : 10 * 1000;
    8386    private TemporaryFolder josmHome;
     
    433436    }
    434437
     438    @Override
     439    public void beforeEach(ExtensionContext context) throws Exception {
     440        Statement temporaryStatement = new Statement() {
     441            @Override
     442            public void evaluate() throws Throwable {
     443                // do nothing
     444            }
     445        };
     446        try {
     447            this.apply(temporaryStatement,
     448                    Description.createTestDescription(this.getClass(), "JOSMTestRules JUnit5 Compatibility"))
     449                    .evaluate();
     450        } catch (Throwable e) {
     451            throw new Exception(e);
     452        }
     453    }
     454
     455    @Override
     456    public void afterEach(ExtensionContext context) throws Exception {
     457        // do nothing for now
     458    }
     459
    435460    /**
    436461     * Set up before running a test
Note: See TracChangeset for help on using the changeset viewer.