Package javango.forms

Examples of javango.forms.Form


    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"foo@example.com"});
    m.put("ccMyself", new String[] {"true"});
    m.put("value", new String[] {"1234"});
    Form f = injector.getInstance(ContactForm.class).bind(m);
    assertTrue(f.isValid());
  }
View Full Code Here


    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"fooample.com"});
    m.put("cc_myself", new String[] {"true"});
    m.put("value", new String[] {"12asdf34"});
    Form f = injector.getInstance(ContactForm.class).bind(m);
    assertFalse(f.isValid());
    Map errors = f.getErrors();
    assertTrue(errors.containsKey("sender"));
    assertTrue(errors.containsKey("value"));
  }
View Full Code Here

    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"foo@example.com"});
    m.put("ccMyself", new String[] {"true"});
    m.put("value", new String[] {"1234"});
    Form f = formFactory.forModel(ContactBean.class).bind(m);
    assertTrue(f.isValid());
    ContactBean bean = (ContactBean)f.clean(ContactBean.class);
    assertEquals(bean.getSubject(), "hello");
    assertEquals(bean.getMessage(), "Hi there");
    assertEquals(bean.getSender(), "foo@example.com");
    assertEquals(bean.getCcMyself(), Boolean.TRUE);
    assertEquals(bean.getValue(), new Long(1234));
View Full Code Here

  }
 
  public void testRequireByDefault() throws Exception {
    Map<String, String[]> m = new HashMap<String, String[]>();
    m.put("message", new String[] {"Hi there"});       
    Form f = formFactory.forModel(ContactBean.class);
    f.bind(m);   
    assertFalse(f.isValid());
    Map errors = f.getErrors();
    assertTrue(errors.containsKey("subject"));
    assertTrue(errors.containsKey("sender"));
    assertTrue(errors.containsKey("value"));
  }
View Full Code Here

      setModel(ContactBean.class);
    }
   
  }
  public void testModelFormAddField() throws Exception {
    Form form = injector.getInstance(EnhancedContactForm.class);
//    Form form = new EnhancedContactForm();
    assertTrue(form.getFields().containsKey("newField"));
    assertTrue(form.getFields().containsKey("ccMyself"));
    Field ccField = form.getFields().get("ccMyself");
    assertEquals(LongField.class, ccField.getClass());
  }
View Full Code Here

      init();
    }    
  }
 
  public void testNewContextForm() throws Exception {
    Form form = injector.getInstance(NewContactForm.class);
//    Form form = new EnhancedContactForm();
    assertTrue(form.getFields().containsKey("newField"));
    assertTrue(form.getFields().containsKey("ccMyself"));
    assertTrue(!form.getFields().containsKey("subject"));
    Field ccField = form.getFields().get("ccMyself");
    assertEquals(LongField.class, ccField.getClass());
  }
View Full Code Here

      init();
    }    
  }
 
  public void testIncludeField() throws Exception {
    Form form = injector.getInstance(IncludeTestContactForm.class);
    assertEquals(3, form.getFields().size());
    assertTrue(form.getFields().containsKey("newField"));
    assertTrue(form.getFields().containsKey("ccMyself"));
    assertTrue(form.getFields().containsKey("subject"));
    assertTrue(!form.getFields().containsKey("sender"));

  }
View Full Code Here

    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"foo@example.com"});
    m.put("cc_myself", new String[] {"true"});
    m.put("value", new String[] {"1234"});
    Form f = injector.getInstance(ContactForm.class);
    assertFalse(f.isBound());
    f = injector.getInstance(ContactForm.class).bind(m);
    assertTrue(f.isBound());
  }
View Full Code Here

    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"foo@example.com"});
    m.put("ccMyself", new String[] {"true"});
    m.put("value", new String[] {"1234"});
    Form f = injector.getInstance(ContactForm.class).bind(m);
    assertTrue(f.isValid());
  }
View Full Code Here

    m.put("subject", new String[] {"hello"});
    m.put("message", new String[] {"Hi there"});
    m.put("sender", new String[] {"fooample.com"});
    m.put("cc_myself", new String[] {"true"});
    m.put("value", new String[] {"12asdf34"});
    Form f = injector.getInstance(ContactForm.class).bind(m);
    assertFalse(f.isValid());
    Map errors = f.getErrors();
    assertTrue(errors.containsKey("sender"));
    assertTrue(errors.containsKey("value"));
  }
View Full Code Here

TOP

Related Classes of javango.forms.Form

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.