Skip to content

Commit 6fe95f4

Browse files
committed
[openpgp] Fix usage of junit annotations in SecretKeyBackupHelperTestc
The unit test used the JUnit 4 annotations @BeforeClass and @afterclass when it should use the JUnit 5 variants @BeforeAll and @afterall.
1 parent 2e4178d commit 6fe95f4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretKeyBackupHelperTest.java

+7-11
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838

3939
import org.bouncycastle.openpgp.PGPException;
4040
import org.bouncycastle.openpgp.PGPSecretKeyRing;
41-
import org.junit.AfterClass;
42-
import org.junit.BeforeClass;
41+
import org.junit.jupiter.api.AfterAll;
4342
import org.junit.jupiter.api.Assertions;
43+
import org.junit.jupiter.api.BeforeAll;
4444
import org.junit.jupiter.api.Test;
4545
import org.jxmpp.jid.BareJid;
4646
import org.jxmpp.jid.impl.JidCreate;
@@ -49,14 +49,11 @@
4949

5050
public class SecretKeyBackupHelperTest extends SmackTestSuite {
5151

52-
private static final File basePath;
52+
private static File basePath;
5353

54-
static {
55-
try {
56-
basePath = Files.createTempDirectory("ox_secret_keys_").toFile();
57-
} catch (IOException e) {
58-
throw new AssertionError(e);
59-
}
54+
@BeforeAll
55+
public static void createTemptDir() throws IOException {
56+
basePath = Files.createTempDirectory("ox_secret_keys_").toFile();
6057
}
6158

6259
@Test
@@ -98,8 +95,7 @@ public void createAndDecryptSecretKeyElementTest()
9895
Assertions.assertArrayEquals(secretKeys.getEncoded(), secretKeyRing.getEncoded());
9996
}
10097

101-
@AfterClass
102-
@BeforeClass
98+
@AfterAll
10399
public static void deleteDirs() throws IOException {
104100
org.apache.commons.io.FileUtils.deleteDirectory(basePath);
105101
}

0 commit comments

Comments
 (0)