Package javango.forms.fields

Examples of javango.forms.fields.PercentField.clean()


    PercentField field = injector.getInstance(PercentField.class);
    field.setName("fieldName");

    Map<String, String> errors = new HashMap<String, String>();
   
    Double value = field.clean(new String[]{""}, errors);
    assertFalse(errors.isEmpty());
    assertTrue(errors.containsKey(field.getName()));
    assertEquals(AbstractField.REQUIRED_ERROR, errors.get(field.getName()));
  }
 
View Full Code Here


    field.setName("fieldName");
    field.setRequired(false);
   
    Map<String, String> errors = new HashMap<String, String>();
   
    Double value = field.clean(new String[]{""}, errors);
    assertTrue(errors.isEmpty());
  }

  public void testInvalid() throws Exception {
    PercentField field = injector.getInstance(PercentField.class);
View Full Code Here

    PercentField field = injector.getInstance(PercentField.class);
    field.setName("fieldName");
   
    Map<String, String> errors = new HashMap<String, String>();
   
    Double value = field.clean(new String[]{"qwert"}, errors);
    assertFalse(errors.isEmpty());
    assertTrue(errors.containsKey("fieldName"));
    assertEquals(PercentField.ERROR_NUMBER_NOT_VALID, errors.get("fieldName"));
  }
View Full Code Here

    PercentField field = injector.getInstance(PercentField.class);
    field.setName("fieldName");
   
    Map<String, String> errors = new HashMap<String, String>();
   
    Double value = field.clean(new String[]{"12"}, errors);
    assertTrue(errors.isEmpty());
    assertEquals(new Double(.12), value);
  }

  public void testHtmlNull() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.