PasswordHelper { public static String createPass(final int length) { SecureRandom rnd = new SecureRandom(); char[] chs = new char[length]; for (int i = 0; i < length; i++) chs[i] = PASSWORD_CHARS[rnd.nextInt(PASSWORD_CHARS.length)]; final String val = new String(chs); return val; } private  PasswordHelper(); static String createPass(final int length); static String encodePassword(String password, String seed); static String hexEncode(byte[] aData);  }
@Test public void testCreatePass() { for (int i = 0; i < 100; i++) { String password = PasswordHelper.createPass(LENGTH); assertEquals("Unerwartete Passwortlänge", LENGTH, password.length()); for (int j = 0; j < FORBIDDEN.length; j++) { assertFalse("Unerlaubtes Zeichen " + FORBIDDEN[j] + " enthalten: " + password, password.contains(FORBIDDEN[j])); } } }