@Test(timeout=120000)
public void testGetInstance() throws Exception {

  Assume.assumeTrue(OpensslCipher.getLoadingFailureReason() == null);
  OpensslCipher cipher = OpensslCipher.getInstance("AES/CTR/NoPadding");
  Assert.assertTrue(cipher != null);
  
  try {
    cipher = OpensslCipher.getInstance("AES2/CTR/NoPadding");
    Assert.fail("Should specify correct algorithm.");
  } catch (NoSuchAlgorithmException e) {
    // Expect NoSuchAlgorithmException
  }
  
  try {
    cipher = OpensslCipher.getInstance("AES/CTR/NoPadding2");
    Assert.fail("Should specify correct padding.");
  } catch (NoSuchPaddingException e) {
    // Expect NoSuchPaddingException
  }
}