Ticket #16567: 16567.patch
| File 16567.patch, 2.4 KB (added by , 6 years ago) |
|---|
-
.classpath
32 32 <attribute name="test" value="true"/> 33 33 </attributes> 34 34 </classpathentry> 35 <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"> 36 <attributes> 37 <attribute name="test" value="true"/> 38 </attributes> 39 </classpathentry> 35 40 <classpathentry kind="lib" path="test/lib/jfcunit.jar"> 36 41 <attributes> 37 42 <attribute name="test" value="true"/> -
test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java
23 23 import java.util.logging.Handler; 24 24 25 25 import org.awaitility.Awaitility; 26 import org.junit.jupiter.api.extension.AfterEachCallback; 27 import org.junit.jupiter.api.extension.BeforeEachCallback; 28 import org.junit.jupiter.api.extension.ExtensionContext; 26 29 import org.junit.rules.TemporaryFolder; 27 30 import org.junit.rules.TestRule; 28 31 import org.junit.runner.Description; … … 79 82 * 80 83 * @author Michael Zangl 81 84 */ 82 public class JOSMTestRules implements TestRule {85 public class JOSMTestRules implements TestRule, AfterEachCallback, BeforeEachCallback { 83 86 private int timeout = isDebugMode() ? -1 : 10 * 1000; 84 87 private TemporaryFolder josmHome; 85 88 private boolean usePreferences = false; … … 433 436 return statement; 434 437 } 435 438 439 @Override 440 public void beforeEach(ExtensionContext context) throws Exception { 441 Statement temporaryStatement = new Statement() { 442 @Override 443 public void evaluate() throws Throwable { 444 // do nothing 445 } 446 }; 447 try { 448 this.apply(temporaryStatement, 449 Description.createTestDescription(this.getClass(), "JOSMTestRules JUnit5 Compatibility")) 450 .evaluate(); 451 } catch (Throwable e) { 452 throw new Exception(e); 453 } 454 } 455 456 @Override 457 public void afterEach(ExtensionContext context) throws Exception { 458 // do nothing for now 459 } 460 436 461 /** 437 462 * Set up before running a test 438 463 * @throws InitializationError If an error occurred while creating the required environment.
