diff --git a/lib/src/test/java/com/auth0/jwt/algorithms/ECDSABouncyCastleProviderTests.java b/lib/src/test/java/com/auth0/jwt/algorithms/ECDSABouncyCastleProviderTests.java index 0e38e64f..4af1c4ec 100644 --- a/lib/src/test/java/com/auth0/jwt/algorithms/ECDSABouncyCastleProviderTests.java +++ b/lib/src/test/java/com/auth0/jwt/algorithms/ECDSABouncyCastleProviderTests.java @@ -6,8 +6,8 @@ import com.auth0.jwt.interfaces.ECDSAKeyProvider; import org.apache.commons.codec.binary.Base64; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -46,7 +46,7 @@ public class ECDSABouncyCastleProviderTests { @Rule public ExpectedException exception = ExpectedException.none(); - private final BouncyCastleProvider bcProvider = new BouncyCastleProvider(); + private static final Provider bcProvider = new BouncyCastleProvider(); //JOSE Signatures obtained using Node 'jwa' lib: https://github.com/brianloveswords/node-jwa //DER Signatures obtained from source JOSE signature using 'ecdsa-sig-formatter' lib: https://github.com/Brightspace/node-ecdsa-sig-formatter @@ -54,17 +54,21 @@ public class ECDSABouncyCastleProviderTests { //These tests add and use the BouncyCastle SecurityProvider to handle ECDSA algorithms - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setUp() throws Exception { //Set BC as the preferred bcProvider Security.insertProviderAt(bcProvider, 1); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { Security.removeProvider(bcProvider.getName()); } + @Test + public void shouldPreferBouncyCastleProvider() throws Exception { + assertThat(Security.getProviders()[0], is(equalTo(bcProvider))); + } // Verify