// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }
// 
// Path: src/main/java/de/jformchecker/criteria/Criteria.java
// public class Criteria {
// 	private static final Email email = new Email();
// 	private static final ZipCode zipCode = new ZipCode();
// 	private static final PostcodeCA postcodeCA = new PostcodeCA();
// 
// 	public static Criterion and(Criterion... criteria) {
// 		return new And(criteria);
// 	}
// 
// 	public static Criterion or(Criterion... criteria) {
// 		return new Or(criteria);
// 	}
// 
// 	public static Criterion accept(String... values) {
// 		return new Accept(values);
// 	}
// 
// 	public static AcceptString acceptString(String... values) {
// 		return new AcceptString(values);
// 	}
// 
// 	public static Criterion min(int min) {
// 		return new Min(min);
// 	}
// 
// 	public static Criterion max(int max) {
// 		return new Max(max);
// 	}
// 	
// 	public static Criterion number() {
// 		return new Number();
// 	}
// 
// 	public static Criterion range(int min, int max) {
// 		return new Range(min, max);
// 	}
// 
// 	public static Criterion length(int min, int max) {
// 		return new Length(min, max);
// 	}
// 
// 	public static Criterion exactLength(int length) {
// 		return new ExactLength(length);
// 	}
// 
// 	public static Criterion minLength(int min) {
// 		return new MinLength(min);
// 	}
// 
// 	public static Criterion maxLength(int max) {
// 		return new MaxLength(max);
// 	}
// 
// 	public static Criterion regex(String pattern) {
// 		return new Regex(pattern);
// 	}
// 
// 	public static Criterion startsWith(String... prefix) {
// 		return new StartsWith(prefix);
// 	}
// 
// 	public static Criterion emailAddress() {
// 		return email;
// 	}
// 	
// 	public static Criterion strongPassword(int minLength) {
// 		return new StrongPassword(minLength);
// 	}
// 
// 	public static Criterion zipcode() {
// 		return zipCode;
// 	}
// 
// 	public static Criterion postcodeCA() {
// 		return postcodeCA;
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/elements/TextInput.java
// public class TextInput extends AbstractInput<TextInput> implements FormCheckerElement {
// 
// 	private String placeholderText = "";
// 
// 	public static TextInput build(String name) {
// 		TextInput i = new TextInput();
// 		i.name = name;
// 		return i;
// 	}
// 
// 	public TextInput setPlaceholerText(String placeholderText) {
// 		this.placeholderText = placeholderText;
// 		return this;
// 	}
// 
// 	@Override
// 	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation) {
// 		TagAttributes tagAttributes = new TagAttributes(attributes);
// 		tagAttributes.add(this.inputAttributes);
// 		return String.format("<input " + buildAllAttributes(tagAttributes, messageSource, html5Validation) + buildMaxLen()
// 				+ "type=\"text\" name=\"%s\" value=\"%s\"" + getPlaceholder() + ">", name,
// 				(value == null ? "" : getValueHtmlEncoded()));
// 	}
// 
// 	
// 	protected String getPlaceholder() {
// 		return StringUtils.isEmpty(placeholderText) ? ""
// 				: " placeholder=\"" + Escape.htmlText(placeholderText) + "\"";
// 	}
// 	
// 	@Override
// 	public String getType() {
// 		return "text";
// 	}
// 
// 
// }


import org.junit.Assert;
import org.junit.Test;
import de.jformchecker.Criterion;
import de.jformchecker.criteria.Criteria;
import de.jformchecker.elements.TextInput;
package de.jformchecker.test;



/**
 * Tests some criterias
 * 
 * @author jochen
 *
 */
public class CriteriaTests {

	@Test
	public void testMax() {
		Criterion c = Criteria.max(100);
		Assert.assertTrue("30 is smaller than 100. This should be true!", c.validate(buildSampleInput(30)).isValid());
	}

	@Test
	public void testMin() {
		Criterion c = Criteria.min(100);
		Assert.assertTrue("110 is bigger than 100. This should be true!", c.validate(buildSampleInput(110)).isValid());
	}

	@Test
	public void testStrongPassword() {
		Criterion c = Criteria.strongPassword(15);
		Assert.assertTrue("This password should be strong enough", 
				c.validate(buildSampleInput("abcAd4bcas!fegdt")).isValid());
	}
	
	@Test
	public void testEmail() {
// Path: src/main/java/de/jformchecker/Criterion.java
// @FunctionalInterface
// public interface Criterion {
// 	/**
// 	 * Tests whether the specified value satisfies this criterion.
// 	 * 
// 	 * @param value
// 	 *            to be tested against this criterion.
// 	 * @return a ValidationResult which holds true or false for validaton result
// 	 *         and a potential errormsg
// 	 */
// 	public ValidationResult validate(FormCheckerElement value);
// 
// }
// 
// Path: src/main/java/de/jformchecker/criteria/Criteria.java
// public class Criteria {
// 	private static final Email email = new Email();
// 	private static final ZipCode zipCode = new ZipCode();
// 	private static final PostcodeCA postcodeCA = new PostcodeCA();
// 
// 	public static Criterion and(Criterion... criteria) {
// 		return new And(criteria);
// 	}
// 
// 	public static Criterion or(Criterion... criteria) {
// 		return new Or(criteria);
// 	}
// 
// 	public static Criterion accept(String... values) {
// 		return new Accept(values);
// 	}
// 
// 	public static AcceptString acceptString(String... values) {
// 		return new AcceptString(values);
// 	}
// 
// 	public static Criterion min(int min) {
// 		return new Min(min);
// 	}
// 
// 	public static Criterion max(int max) {
// 		return new Max(max);
// 	}
// 	
// 	public static Criterion number() {
// 		return new Number();
// 	}
// 
// 	public static Criterion range(int min, int max) {
// 		return new Range(min, max);
// 	}
// 
// 	public static Criterion length(int min, int max) {
// 		return new Length(min, max);
// 	}
// 
// 	public static Criterion exactLength(int length) {
// 		return new ExactLength(length);
// 	}
// 
// 	public static Criterion minLength(int min) {
// 		return new MinLength(min);
// 	}
// 
// 	public static Criterion maxLength(int max) {
// 		return new MaxLength(max);
// 	}
// 
// 	public static Criterion regex(String pattern) {
// 		return new Regex(pattern);
// 	}
// 
// 	public static Criterion startsWith(String... prefix) {
// 		return new StartsWith(prefix);
// 	}
// 
// 	public static Criterion emailAddress() {
// 		return email;
// 	}
// 	
// 	public static Criterion strongPassword(int minLength) {
// 		return new StrongPassword(minLength);
// 	}
// 
// 	public static Criterion zipcode() {
// 		return zipCode;
// 	}
// 
// 	public static Criterion postcodeCA() {
// 		return postcodeCA;
// 	}
// 
// }
// 
// Path: src/main/java/de/jformchecker/elements/TextInput.java
// public class TextInput extends AbstractInput<TextInput> implements FormCheckerElement {
// 
// 	private String placeholderText = "";
// 
// 	public static TextInput build(String name) {
// 		TextInput i = new TextInput();
// 		i.name = name;
// 		return i;
// 	}
// 
// 	public TextInput setPlaceholerText(String placeholderText) {
// 		this.placeholderText = placeholderText;
// 		return this;
// 	}
// 
// 	@Override
// 	public String getInputTag(Map<String, String> attributes, MessageSource messageSource, boolean html5Validation) {
// 		TagAttributes tagAttributes = new TagAttributes(attributes);
// 		tagAttributes.add(this.inputAttributes);
// 		return String.format("<input " + buildAllAttributes(tagAttributes, messageSource, html5Validation) + buildMaxLen()
// 				+ "type=\"text\" name=\"%s\" value=\"%s\"" + getPlaceholder() + ">", name,
// 				(value == null ? "" : getValueHtmlEncoded()));
// 	}
// 
// 	
// 	protected String getPlaceholder() {
// 		return StringUtils.isEmpty(placeholderText) ? ""
// 				: " placeholder=\"" + Escape.htmlText(placeholderText) + "\"";
// 	}
// 	
// 	@Override
// 	public String getType() {
// 		return "text";
// 	}
// 
// 
// }


// Path: src/test/java/de/jformchecker/test/CriteriaTests.java
import org.junit.Assert;
import org.junit.Test;
import de.jformchecker.Criterion;
import de.jformchecker.criteria.Criteria;
import de.jformchecker.elements.TextInput;

package de.jformchecker.test;



/**
 * Tests some criterias
 * 
 * @author jochen
 *
 */
public class CriteriaTests {

	@Test
	public void testMax() {
		Criterion c = Criteria.max(100);
		Assert.assertTrue("30 is smaller than 100. This should be true!", c.validate(buildSampleInput(30)).isValid());
	}

	@Test
	public void testMin() {
		Criterion c = Criteria.min(100);
		Assert.assertTrue("110 is bigger than 100. This should be true!", c.validate(buildSampleInput(110)).isValid());
	}

	@Test
	public void testStrongPassword() {
		Criterion c = Criteria.strongPassword(15);
		Assert.assertTrue("This password should be strong enough", 
				c.validate(buildSampleInput("abcAd4bcas!fegdt")).isValid());
	}
	
	@Test
	public void testEmail() {
		Criterion c = Criteria.emailAddress();