@Test
public void testCreateSecurePasswordWithRules() throws Exception {

  String password;
  //Default rules....
  password = securePasswordHelper.createSecurePassword(null, null, null, null, null, null);
  Assert.assertNotNull(password);
  Assert.assertEquals(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_LENGTH, password.length());
  assertMinLowercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_LOWERCASE_LETTERS, password);
  assertMinUppercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_UPPERCASE_LETTERS, password);
  assertMinDigits(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_DIGITS, password);
  assertMinPunctuation(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_PUNCTUATION, password);
  assertMinWhitespace(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_WHITESPACE, password);
  password = securePasswordHelper.createSecurePassword(10, null, null, null, null, null);
  Assert.assertNotNull(password);
  Assert.assertEquals(10, password.length());
  assertMinLowercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_LOWERCASE_LETTERS, password);
  assertMinUppercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_UPPERCASE_LETTERS, password);
  assertMinDigits(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_DIGITS, password);
  assertMinPunctuation(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_PUNCTUATION, password);
  assertMinWhitespace(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_WHITESPACE, password);
  password = securePasswordHelper.createSecurePassword(0, null, null, null, null, null);
  Assert.assertNotNull(password);
  Assert.assertEquals(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_LENGTH, password.length());
  assertMinLowercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_LOWERCASE_LETTERS, password);
  assertMinUppercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_UPPERCASE_LETTERS, password);
  assertMinDigits(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_DIGITS, password);
  assertMinPunctuation(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_PUNCTUATION, password);
  assertMinWhitespace(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_WHITESPACE, password);
  password = securePasswordHelper.createSecurePassword(-20, null, null, null, null, null);
  Assert.assertNotNull(password);
  Assert.assertEquals(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_LENGTH, password.length());
  assertMinLowercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_LOWERCASE_LETTERS, password);
  assertMinUppercaseLetters(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_UPPERCASE_LETTERS, password);
  assertMinDigits(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_DIGITS, password);
  assertMinPunctuation(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_PUNCTUATION, password);
  assertMinWhitespace(SecurePasswordHelper.DEFAULT_SECURE_PASSWORD_MIN_WHITESPACE, password);
  password = securePasswordHelper.createSecurePassword(100, 30, 20, 10, 5, 2);
  Assert.assertNotNull(password);
  Assert.assertEquals(100, password.length());
  assertMinLowercaseLetters(30, password);
  assertMinUppercaseLetters(20, password);
  assertMinDigits(10, password);
  assertMinPunctuation(5, password);
  assertMinWhitespace(2, password);
  password = securePasswordHelper.createSecurePassword(100, 20, 20, 20, 20, 0);
  Assert.assertNotNull(password);
  Assert.assertEquals(100, password.length());
  assertMinLowercaseLetters(20, password);
  assertMinUppercaseLetters(20, password);
  assertMinDigits(20, password);
  assertMinPunctuation(20, password);
  assertMinWhitespace(0, password);
}