Changeset 16658 in josm for trunk/test/unit/org


Ignore:
Timestamp:
2020-06-16T18:58:48+02:00 (4 years ago)
Author:
simon04
Message:

see #16567 - JUnit 5: call JOSMTestRules.after (patch by taylor.smock)

File:
1 edited

Legend:

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

    r16657 r16658  
    104104    private boolean metric;
    105105    private boolean main;
     106    /**
     107     * This boolean is only used to indicate if JUnit5 is used in a test. If it is,
     108     * we must not call after in {@link JOSMTestRules.CreateJosmEnvironment#evaluate}.
     109     * TODO: Remove JUnit4 as a whole sometime after 2021-01-01 (~6 month lead time for plugins)
     110     */
     111    private boolean junit5;
    106112
    107113    /**
     
    438444    @Override
    439445    public void beforeEach(ExtensionContext context) throws Exception {
     446        this.junit5 = true;
    440447        Statement temporaryStatement = new Statement() {
    441448            @Override
     
    455462    @Override
    456463    public void afterEach(ExtensionContext context) throws Exception {
    457         // do nothing for now
     464        after();
    458465    }
    459466
     
    690697                base.evaluate();
    691698            } finally {
    692                 after();
     699                if (!junit5) {
     700                    after();
     701                }
    693702            }
    694703        }
Note: See TracChangeset for help on using the changeset viewer.