Repository: wultra/powerauth-crypto (java)

Issue:
Migrate tests to JUnit 5
The JUnit version 4 is getting deprecated, we should migrate the tests to JUnit 5. 

Pull request:
Fix #378: Migrate tests to JUnit 5

Patch:
diff --git a/pom.xml b/pom.xml
index 3be5cf76..ad9ce2be 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
     <groupId>io.getlime.security</groupId>
     <artifactId>powerauth-crypto-parent</artifactId>
-    <version>1.2.0-SNAPSHOT</version>
+    <version>1.1.0</version>
     <packaging>pom</packaging>
 
     <inceptionYear>2016</inceptionYear>
@@ -136,11 +136,13 @@
             <build>
                 <plugins>
                     <plugin>
-                        <groupId>org.kohsuke</groupId>
-                        <artifactId>pgp-maven-plugin</artifactId>
-                        <version>1.1</version>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-gpg-plugin</artifactId>
+                        <version>3.0.1</version>
                         <executions>
                             <execution>
+                                <id>sign-artifacts</id>
+                                <phase>verify</phase>
                                 <goals>
                                     <goal>sign</goal>
                                 </goals>
diff --git a/powerauth-java-crypto/pom.xml b/powerauth-java-crypto/pom.xml
index 65879717..1f76dd8e 100644
--- a/powerauth-java-crypto/pom.xml
+++ b/powerauth-java-crypto/pom.xml
@@ -21,13 +21,13 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<artifactId>powerauth-java-crypto</artifactId>
-	<version>1.2.0-SNAPSHOT</version>
+	<version>1.1.0</version>
 	<packaging>jar</packaging>
 
 	<parent>
 		<groupId>io.getlime.security</groupId>
 		<artifactId>powerauth-crypto-parent</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
+		<version>1.1.0</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 
@@ -43,9 +43,9 @@
 			<version>1.7.30</version>
 		</dependency>
 		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.13.2</version>
+			<groupId>org.junit.jupiter</groupId>
+			<artifactId>junit-jupiter-engine</artifactId>
+			<version>5.7.2</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
diff --git a/powerauth-java-http/pom.xml b/powerauth-java-http/pom.xml
index ee699222..d6354f66 100644
--- a/powerauth-java-http/pom.xml
+++ b/powerauth-java-http/pom.xml
@@ -21,7 +21,7 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<artifactId>powerauth-java-http</artifactId>
-	<version>1.2.0-SNAPSHOT</version>
+	<version>1.1.0</version>
 	<name>powerauth-java-http</name>
 	<description>PowerAuth utility module for HTTP support</description>
 	<packaging>jar</packaging>
@@ -29,7 +29,7 @@
 	<parent>
 		<groupId>io.getlime.security</groupId>
 		<artifactId>powerauth-crypto-parent</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
+		<version>1.1.0</version>
 		<relativePath>../pom.xml</relativePath>
 	</parent>
 
@@ -40,9 +40,9 @@
 			<version>30.1.1-jre</version>
 		</dependency>
 		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.13.2</version>
+			<groupId>org.junit.jupiter</groupId>
+			<artifactId>junit-jupiter-engine</artifactId>
+			<version>5.7.2</version>
 			<scope>test</scope>
 		</dependency>
 	</dependencies>


Test patch:
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/ActivationStatusBlobInfoTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/ActivationStatusBlobInfoTest.java
index 3d59b0d0..95552a96 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/ActivationStatusBlobInfoTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/ActivationStatusBlobInfoTest.java
@@ -26,8 +26,8 @@ import io.getlime.security.powerauth.crypto.lib.util.KeyDerivationUtils;
 import io.getlime.security.powerauth.crypto.server.activation.PowerAuthServerActivation;
 import io.getlime.security.powerauth.crypto.server.keyfactory.PowerAuthServerKeyFactory;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.nio.ByteBuffer;
@@ -36,7 +36,7 @@ import java.security.KeyPair;
 import java.security.Security;
 import java.util.Arrays;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Test activation status blob.
@@ -48,8 +48,8 @@ public class ActivationStatusBlobInfoTest {
     /**
      * Add crypto providers.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthActivationTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthActivationTest.java
index 86328974..5a95bdfd 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthActivationTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthActivationTest.java
@@ -24,8 +24,8 @@ import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderEx
 import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
 import io.getlime.security.powerauth.crypto.server.activation.PowerAuthServerActivation;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.security.KeyPair;
@@ -33,7 +33,7 @@ import java.security.PrivateKey;
 import java.security.PublicKey;
 import java.security.Security;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * @author petrdvorak
@@ -45,8 +45,8 @@ public class PowerAuthActivationTest {
     /**
      * Add crypto providers.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthRecoveryCodeTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthRecoveryCodeTest.java
index 8cb11593..2a64d3e5 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthRecoveryCodeTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/activation/PowerAuthRecoveryCodeTest.java
@@ -23,14 +23,14 @@ import io.getlime.security.powerauth.crypto.lib.model.RecoverySeed;
 import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException;
 import io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.security.*;
 import java.util.HashSet;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  *
@@ -43,8 +43,8 @@ public class PowerAuthRecoveryCodeTest {
     /**
      * Add crypto providers.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/ec/InvalidPointTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/ec/InvalidPointTest.java
index 0a578f9f..641d0fdd 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/ec/InvalidPointTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/ec/InvalidPointTest.java
@@ -25,16 +25,16 @@ import org.bouncycastle.jce.ECNamedCurveTable;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.jce.spec.ECNamedCurveParameterSpec;
 import org.bouncycastle.math.ec.custom.sec.SecP256R1Curve;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import java.lang.reflect.Field;
 import java.math.BigInteger;
 import java.security.Security;
 import java.security.spec.InvalidKeySpecException;
 
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Tests for validations during public key import.
@@ -48,8 +48,8 @@ public class InvalidPointTest {
     /**
      * Add BC crypto provider.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         Security.addProvider(new BouncyCastleProvider());
     }
 
@@ -72,7 +72,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("Infinity allowed as public key");
+        fail("Infinity allowed as public key");
     }
 
     /**
@@ -86,7 +86,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
     /**
@@ -100,7 +100,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
     /**
@@ -114,7 +114,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
     /**
@@ -128,7 +128,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
     /**
@@ -144,7 +144,7 @@ public class InvalidPointTest {
         } catch (GenericCryptoException ex) {
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
     /**
@@ -167,7 +167,7 @@ public class InvalidPointTest {
             orderField.set(p256curve, orderValid);
             return;
         }
-        Assert.fail("EC point validation is missing");
+        fail("EC point validation is missing");
     }
 
 }
\ No newline at end of file
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/encryption/EciesEncryptorTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/encryption/EciesEncryptorTest.java
index 5d278157..a565a244 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/encryption/EciesEncryptorTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/encryption/EciesEncryptorTest.java
@@ -30,8 +30,8 @@ import io.getlime.security.powerauth.crypto.lib.util.Hash;
 import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.util.encoders.Hex;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.nio.ByteBuffer;
@@ -43,8 +43,8 @@ import java.security.Security;
 import java.security.interfaces.ECPrivateKey;
 import java.security.interfaces.ECPublicKey;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Test to validate functionality of {@link EciesEncryptor}
@@ -60,8 +60,8 @@ public class EciesEncryptorTest {
     /**
      * Add crypto providers.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/generator/ActivationCodeGeneratorTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/generator/ActivationCodeGeneratorTest.java
index f2c76c40..a340c415 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/generator/ActivationCodeGeneratorTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/generator/ActivationCodeGeneratorTest.java
@@ -19,12 +19,12 @@ package io.getlime.security.powerauth.crypto.generator;
 import io.getlime.security.powerauth.crypto.lib.generator.IdentifierGenerator;
 import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import java.security.Security;
 
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test activation code generator.
@@ -36,8 +36,8 @@ public class ActivationCodeGeneratorTest {
     /**
      * Set up crypto providers
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/Argon2Test.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/Argon2Test.java
index 07d589e2..a13bee41 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/Argon2Test.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/Argon2Test.java
@@ -18,11 +18,11 @@ package io.getlime.security.powerauth.crypto.lib.util;
 
 import com.google.common.io.BaseEncoding;
 import io.getlime.security.powerauth.crypto.lib.model.Argon2Hash;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 
-import static org.junit.Assert.*;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Verify parsing of Argon2 hashes in Modular Crypt Format.
@@ -51,24 +51,32 @@ public class Argon2Test {
         assertArrayEquals(BaseEncoding.base64().decode("wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA"), hash19.getDigest());
     }
 
-    @Test(expected = IOException.class)
-    public void testInvalidHash1() throws IOException {
-        Argon2Hash.parse("argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+    @Test
+    public void testInvalidHash1() {
+        assertThrows(IOException.class, () -> {
+            Argon2Hash.parse("argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+        });
     }
 
-    @Test(expected = IOException.class)
-    public void testInvalidHash2() throws IOException {
-        Argon2Hash.parse("$argon2i$v=19$c29tZXNhbHQ$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+    @Test
+    public void testInvalidHash2() {
+        assertThrows(IOException.class, () -> {
+            Argon2Hash.parse("$argon2i$v=19$c29tZXNhbHQ$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+        });
     }
 
-    @Test(expected = IOException.class)
-    public void testInvalidHash3() throws IOException {
-        Argon2Hash.parse("argon2i$v=19$m=65536,t=2,p=1$$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+    @Test
+    public void testInvalidHash3() {
+        assertThrows(IOException.class, () -> {
+            Argon2Hash.parse("argon2i$v=19$m=65536,t=2,p=1$$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA");
+        });
     }
 
-    @Test(expected = IOException.class)
-    public void testInvalidHash4() throws IOException {
-        Argon2Hash.parse("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ$");
+    @Test
+    public void testInvalidHash4() {
+        assertThrows(IOException.class, () -> {
+            Argon2Hash.parse("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ$");
+        });
     }
 
     @Test
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/CRC16Test.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/CRC16Test.java
index d1bd7f81..4f9dbbbc 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/CRC16Test.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/CRC16Test.java
@@ -16,17 +16,17 @@
  */
 package io.getlime.security.powerauth.crypto.lib.util;
 
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class CRC16Test {
 
-    private CRC16 crc16;
+    private static CRC16 crc16;
 
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         crc16 = new CRC16();
     }
 
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/GenerateVectorDataTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/GenerateVectorDataTest.java
index ed08f8fc..34d5b994 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/GenerateVectorDataTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/GenerateVectorDataTest.java
@@ -31,8 +31,8 @@ import io.getlime.security.powerauth.crypto.lib.model.ActivationVersion;
 import io.getlime.security.powerauth.crypto.lib.util.model.TestSet;
 import io.getlime.security.powerauth.crypto.server.activation.PowerAuthServerActivation;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.BeforeClass;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.io.File;
@@ -50,7 +50,7 @@ import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
 
 /**
  * Generate test vectors
@@ -67,7 +67,7 @@ public class GenerateVectorDataTest {
     /**
      * Register crypto providers
      */
-    @BeforeClass
+    @BeforeAll
     public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/HashBasedCounterUtilsTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/HashBasedCounterUtilsTest.java
index 2e3c37e4..fdd65b1f 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/HashBasedCounterUtilsTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/HashBasedCounterUtilsTest.java
@@ -20,16 +20,16 @@ import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
 import io.getlime.security.powerauth.crypto.lib.model.exception.CryptoProviderException;
 import io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.nio.ByteBuffer;
 import java.security.InvalidKeyException;
 import java.security.Security;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test verification of hash calculated from the hash based counter.
@@ -42,8 +42,8 @@ public class HashBasedCounterUtilsTest {
     /**
      * Set up crypto providers
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
index 7fd72eed..9eb0da72 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
@@ -23,14 +23,14 @@ import org.bouncycastle.jce.ECNamedCurveTable;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.jce.spec.ECParameterSpec;
 import org.bouncycastle.jce.spec.ECPrivateKeySpec;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import java.math.BigInteger;
 import java.security.*;
 import java.security.interfaces.ECPrivateKey;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Test for key conversion utilities
@@ -49,8 +49,8 @@ public class KeyConversionUtilsTest {
 	/**
 	 * Set up crypto providers
 	 */
-	@Before
-	public void setUp() {
+	@BeforeAll
+	public static void setUp() {
 		// Add Bouncy Castle Security Provider
 		Security.addProvider(new BouncyCastleProvider());
 	}
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/PasswordHashTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/PasswordHashTest.java
index 5aa6327e..324e4e9a 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/PasswordHashTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/PasswordHashTest.java
@@ -16,7 +16,7 @@
  */
 package io.getlime.security.powerauth.crypto.lib.util;
 
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureFormatTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureFormatTest.java
index c03a42d5..28c05259 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureFormatTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureFormatTest.java
@@ -19,10 +19,9 @@ package io.getlime.security.powerauth.crypto.signature;
 
 import io.getlime.security.powerauth.crypto.lib.enums.PowerAuthSignatureFormat;
 import io.getlime.security.powerauth.crypto.lib.model.exception.GenericCryptoException;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.*;
 
 /**
  * Test that validates whether signature version to signature format works properly.
@@ -40,34 +39,46 @@ public class PowerAuthSignatureFormatTest {
         assertEquals(PowerAuthSignatureFormat.BASE64, PowerAuthSignatureFormat.getFormatForSignatureVersion("4.0"));
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidV2() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion("2.2");
+    @Test
+    public void testInvalidV2() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion("2.2");
+        });
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidV3() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion("3.05");
+    @Test
+    public void testInvalidV3() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion("3.05");
+        });
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidFormat1() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion("3.1.1");
+    @Test
+    public void testInvalidFormat1() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion("3.1.1");
+        });
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidFormat2() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion("foo");
+    @Test
+    public void testInvalidFormat2() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion("foo");
+        });
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidFormat3() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion("");
+    @Test
+    public void testInvalidFormat3() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion("");
+        });
     }
 
-    @Test(expected = GenericCryptoException.class)
-    public void testInvalidFormat4() throws Exception {
-        PowerAuthSignatureFormat.getFormatForSignatureVersion(null);
+    @Test
+    public void testInvalidFormat4() {
+        assertThrows(GenericCryptoException.class, () -> {
+            PowerAuthSignatureFormat.getFormatForSignatureVersion(null);
+        });
     }
 
     @Test
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureTest.java
index 0aee0afc..79d4d111 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/signature/PowerAuthSignatureTest.java
@@ -26,8 +26,8 @@ import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
 import io.getlime.security.powerauth.crypto.server.keyfactory.PowerAuthServerKeyFactory;
 import io.getlime.security.powerauth.crypto.server.signature.PowerAuthServerSignature;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.nio.ByteBuffer;
@@ -38,8 +38,8 @@ import java.security.Security;
 import java.util.Arrays;
 import java.util.Collections;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * Test for PowerAuth signature calculation and validation.
@@ -54,8 +54,8 @@ public class PowerAuthSignatureTest {
 	/**
 	 * Register crypto providers. 
 	 */
-	@Before
-    public void setUp() {
+	@BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
index ef4b1078..fd6785d4 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
@@ -24,8 +24,8 @@ import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
 import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
 import io.getlime.security.powerauth.crypto.server.vault.PowerAuthServerVault;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
 
 import javax.crypto.SecretKey;
 import java.nio.ByteBuffer;
@@ -33,7 +33,7 @@ import java.security.KeyPair;
 import java.security.PrivateKey;
 import java.security.Security;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Test the secure vault implementation.
@@ -47,8 +47,8 @@ public class VaultTest {
     /**
      * Register crypto providers.
      */
-    @Before
-    public void setUp() {
+    @BeforeAll
+    public static void setUp() {
         // Add Bouncy Castle Security Provider
         Security.addProvider(new BouncyCastleProvider());
     }
diff --git a/powerauth-java-http/src/test/java/io/getlime/security/powerauth/http/PowerAuthHttpBodyTest.java b/powerauth-java-http/src/test/java/io/getlime/security/powerauth/http/PowerAuthHttpBodyTest.java
index c9d145a7..69d1516c 100644
--- a/powerauth-java-http/src/test/java/io/getlime/security/powerauth/http/PowerAuthHttpBodyTest.java
+++ b/powerauth-java-http/src/test/java/io/getlime/security/powerauth/http/PowerAuthHttpBodyTest.java
@@ -17,11 +17,11 @@
 package io.getlime.security.powerauth.http;
 
 import com.google.common.io.BaseEncoding;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 import java.nio.charset.StandardCharsets;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 
 /**
  * Tests for HTTP body normalization routine.