public SecureRandom createSecureRandom() throws NoSuchProviderException,
      NoSuchAlgorithmException {
    try {
      return getProvider() != null ?
          SecureRandom.getInstance(getAlgorithm(), getProvider())
          : SecureRandom.getInstance(getAlgorithm());
    }
    catch (NoSuchProviderException ex) {
      throw new NoSuchProviderException("no such secure random provider: "
          + getProvider());
    }
    catch (NoSuchAlgorithmException ex) {
      throw new NoSuchAlgorithmException("no such secure random algorithm: "
          + getAlgorithm());
    }
  }
@Test
  public void testDefaults() throws Exception {
    assertNotNull(factoryBean.createSecureRandom());
  }