BCHelper { public static void registerProvider() { if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) Security.addProvider(new BouncyCastleProvider()); }  static void registerProvider(); static MessageDigest getMessageDigest(String algorithm);  }
@Test public void simpleRegisterProvider() { if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) != null) Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); Assert.assertNull(Security.getProvider(BouncyCastleProvider.PROVIDER_NAME)); BCHelper.registerProvider(); Provider provider = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME); Assert.assertNotNull(provider); BCHelper.registerProvider(); Assert.assertTrue(provider == Security.getProvider(BouncyCastleProvider.PROVIDER_NAME)); }