@@ -0,0 +1,1559 @@
+import org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport static play.data.Form.form;%0A%0Aimport java.util.List;%0A%0Aimport play.data.Form;%0Aimport play.data.validation.Constraints.Email;%0Aimport play.data.validation.Constraints.Required;%0Aimport play.data.validation.ValidationError;%0A%0Aimport com.google.common.collect.ImmutableList;%0Aimport com.google.common.collect.ImmutableMap;%0A%0Apublic class FormTest %7B%0A%0A  @Test%0A  public void testFormValidation() %7B%0A    Form%3CRegistration%3E form = form(Registration.class).bind(%0A        ImmutableMap.of(%22email%22, %22test@benmccann.com%22, %22password1%22, %22changeme%22, %22password2%22, %22alskjfd%22));%0A    Assert.assertTrue(form.hasErrors());%0A    Assert.assertTrue(form.errors().containsKey(%22password%22));%0A  %7D%0A%0A  public static class Registration %7B%0A    @Required @Email public String email;%0A    @Required public String password1;%0A    @Required public String password2;%0A%0A    public String getEmail() %7B%0A      return email;%0A    %7D%0A%0A    public void setEmail(String email) %7B%0A      this.email = email;%0A    %7D%0A%0A    public String getPassword1() %7B%0A      return password1;%0A    %7D%0A%0A    public void setPassword1(String password1) %7B%0A      this.password1 = password1;%0A    %7D%0A%0A    public String getPassword2() %7B%0A      return password2;%0A    %7D%0A%0A    public void setPassword2(String password2) %7B%0A      this.password2 = password2;%0A    %7D%0A%0A    public List%3CValidationError%3E validate() %7B%0A      if (!password1.equals(password2)) %7B%0A        return ImmutableList.of(new ValidationError(%22password%22, %22Passwords do not match.%22, ImmutableList.of()));%0A      %7D%0A      return null;%0A    %7D%0A  %7D%0A%0A%7D%0A

Add a test for form validation