@Test
public void testGenerateKeyStorePassword() throws Exception {

  // We can't possibly test every possible string, but we can at least verify
  // a few things about a few of the generated strings as a sanity check
  ProxyCA proxyCA = new ProxyCA();
  proxyCA.init();
  Set<String> passwords = new HashSet<>();
  for (int i = 0; i < 5; i++) {
    String password = proxyCA.generateKeyStorePassword();
    Assert.assertEquals(16, password.length());
    for (char c : password.toCharArray()) {
      Assert.assertFalse("Found character '" + c + "' in password '"
          + password + "' which is outside of the expected range", c < ' ');
      Assert.assertFalse("Found character '" + c + "' in password '"
          + password + "' which is outside of the expected range", c > 'z');
    }
    Assert.assertFalse("Password " + password
        + " was generated twice, which is _extremely_ unlikely"
        + " and shouldn't practically happen: " + passwords,
        passwords.contains(password));
    passwords.add(password);
  }
}