package com.gentics.mesh.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;

import java.util.Arrays;
import java.util.List;

import org.junit.Test;

public class PasswordUtilTest {

	@Test
	public void testHumanPassword() {
		String pw = PasswordUtil.humanPassword(10);
		assertEquals(pw.length(), 10);
		System.out.println(pw);
		assertNotEquals(pw, PasswordUtil.humanPassword(10));
		assertEquals("", PasswordUtil.humanPassword(0));
	}

	@Test
	public void testExcludedChars() {
		List<Character> disallowedChars = Arrays.asList('0', 'O', 'o', '1', 'i', 'I', '5', 'S', 's');
		for (int i = 0; i < 10000; i++) {
			String pw = PasswordUtil.humanPassword(20);
			for (int e = 0; e < pw.length(); e++) {
				char pwChar = pw.charAt(e);
				assertFalse("Found disallowed character in pw {" + pw + "} - {" +  pwChar+ "}", disallowedChars.contains(pwChar));
			}
		}
	}
}

@@ -394,34 +394,8 @@
 0);%0A
-%09%09System.out.println(pw);%0A
 %09%09as

Update api/src/test/java/com/gentics/mesh/util/PasswordUtilTest.java