tamaashu commented on a change in pull request #1417:
URL: https://github.com/apache/zookeeper/pull/1417#discussion_r462939237
##########
File path: zookeeper-server/src/test/java/org/apache/zookeeper/ZKTestCase.java
##########
@@ -54,54 +52,35 @@ protected String getTestName() {
return testName;
}
- @BeforeClass
+ @BeforeAll
public static void before() {
if (!testBaseDir.exists()) {
- assertTrue(
- "Cannot properly create test base directory " +
testBaseDir.getAbsolutePath(),
- testBaseDir.mkdirs());
+ assertTrue(testBaseDir.mkdirs(),
+ "Cannot properly create test base directory " +
testBaseDir.getAbsolutePath());
} else if (!testBaseDir.isDirectory()) {
- assertTrue(
- "Cannot properly delete file with duplicate name of test base
directory " + testBaseDir.getAbsolutePath(),
- testBaseDir.delete());
- assertTrue(
- "Cannot properly create test base directory " +
testBaseDir.getAbsolutePath(),
- testBaseDir.mkdirs());
+ assertTrue(testBaseDir.delete(),
+ "Cannot properly delete file with duplicate name of test base
directory " + testBaseDir.getAbsolutePath());
+ assertTrue(testBaseDir.mkdirs(),
+ "Cannot properly create test base directory " +
testBaseDir.getAbsolutePath());
}
}
- @Rule
- public TestWatcher watchman = new TestWatcher() {
-
- @Override
- public void starting(Description method) {
- // By default, disable starting a JettyAdminServer in tests to
avoid
- // accidentally attempting to start multiple admin servers on the
- // same port.
- System.setProperty("zookeeper.admin.enableServer", "false");
- // ZOOKEEPER-2693 disables all 4lw by default.
- // Here we enable the 4lw which ZooKeeper tests depends.
- System.setProperty("zookeeper.4lw.commands.whitelist", "*");
- testName = method.getMethodName();
- LOG.info("STARTING {}", testName);
- }
-
- @Override
- public void finished(Description method) {
- LOG.info("FINISHED {}", testName);
- }
-
- @Override
- public void succeeded(Description method) {
- LOG.info("SUCCEEDED {}", testName);
- }
-
- @Override
- public void failed(Throwable e, Description method) {
- LOG.error("FAILED {}", testName, e);
- }
+ @BeforeEach
+ public void starting(TestInfo testInfo) {
Review comment:
According to the documentation yes, except they get overridden:
https://junit.org/junit5/docs/5.0.1/api/org/junit/jupiter/api/BeforeEach.html
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]