Example usage for org.apache.commons.validator Var setName

List of usage examples for org.apache.commons.validator Var setName

Introduction

In this page you can find the example usage for org.apache.commons.validator Var setName.

Prototype

public void setName(String name) 

Source Link

Document

Sets the name of the variable.

Usage

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange17()/*from  ww  w .j av  a  2  s . com*/
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="abc"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePatternStrict??ttH?[}bgw?A
 * ?beanDate?AfieldstartDatet???A
 * G?[?bZ?[W?AfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange17() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("abc");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange18()/*from  ww w.ja  v  a 2 s  . c  o  m*/
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern="yyyy/MM/dd"<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="abc"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePattern?AdatePatternStrict??ttH?[}bgw?A
 * ?beanDate?AfieldstartDatet???A
 * G?[?bZ?[W?AfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange18() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("abc");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange19()//  www  .  j a v  a2 s  .co  m
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern="yyyy/MM/dd"<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2005/1/2"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * beant?AstartDatewtO???A
 * G?[?bZ?[W?AfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange19() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2005/1/2");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange30()/*from   w ww. j a  va 2  s.  c o m*/
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:Map:<br>
 *                ["field1"=<br>
 *                ?@"2005/01/02"]<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2005/01/01"<br>
 *                var:endDate="2005/01/03"<br>
 *                Msg("message","message")<br>
 *                property="field1"<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:true<br>
 *         (?) errors:not null<br>
 *                    (vf)<br>
 *
 * <br>
 * ?beanString^???AfieldOv?peB`FbN?smF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange30() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    Map<String, String> bean = new HashMap<String, String>();
    bean.put("field1", "2005/01/02");
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    field.setProperty("field1");
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2005/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("2005/01/03");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // truep?B
    assertTrue(result);
    // G?[??B
    assertTrue(errors.isEmpty());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange32()/*  w w  w.j a  va2 s.c om*/
 * <br><br>
 *
 * (??n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:Map:<br>
 *                ["field1"=<br>
 *                ?@"2005/01/05"]<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2005/01/01"<br>
 *                var:endDate="2005/01/03"<br>
 *                Msg("message","message")<br>
 *                property="field2"<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:true<br>
 *         (?) errors:not null<br>
 *                    (vf)<br>
 *
 * <br>
 * ?beanString^?AfieldOv?peB????AtruemF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange32() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    Map<String, String> bean = new HashMap<String, String>();
    bean.put("field1", "2005/01/05");
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    field.setProperty("field2");
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2005/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("2005/01/03");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // truep?B
    assertTrue(result);
    // G?[??B
    assertTrue(errors.isEmpty());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange03()//from  w  ww  .j  a  v a 2s  . c  o m
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"abc"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict=null<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                ActionMessage("testMessage")<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("testMessage")<br>
 *                    ActionMessage("message")<br>
 *
 * <br>
 * datePattern?AdatePatternStrictw?A
 * ?beanDate???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange03() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "abc";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue(null);
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    ActionMessage error = new ActionMessage("testMessage");
    errors.add(Globals.ERROR_KEY, error);
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?2??B
    assertEquals(2, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    List<String> list = new ArrayList<String>();
    while (it.hasNext()) {
        ActionMessage message = (ActionMessage) it.next();
        list.add(message.getKey());
    }
    assertTrue(list.contains("message"));
    assertTrue(list.contains("testMessage"));
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange20()/*from  w w  w . jav a2 s .c  o  m*/
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict=null<br>
 *                var:startDate="2004/01/01"<br>
 *                var.endDate="abc"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePattern?AdatePatternStrictnullendDatet???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange20() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2004/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("abc");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange21()//from   ww  w  . ja v a  2  s . co  m
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2004/01/01"<br>
 *                var:endDate="2005/02/29"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePatternnull?AdatePatternStrict??ttH?[}bg?A
 * endDate?t???AG?[?bZ?[Wfalse
 * pmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange21() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2004/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("2005/02/29");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange22()//from  ww w  . j  a v a2s .  c  o m
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2004/01/01"<br>
 *                var:endDate="2005/2/28"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePatternnull?AdatePatternStrict??ttH?[}bg?A
 * endDatettH?[}bgSv???A
 * G?[?bZ?[WfalsepmF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange22() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2004/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("2005/2/28");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}

From source file:jp.terasoluna.fw.web.struts.form.FieldChecksExTest09.java

/**
 * testValidateDateRange23()/*from w  w w .jav a 2  s.  c o m*/
 * <br><br>
 *
 * (?n)
 * <br>
 * _?FF
 * <br><br>
 * l?F(?) bean:"2005/01/01"<br>
 *         (?) va:not null<br>
 *         (?) field:not null<br>
 *                var:datePattern=null<br>
 *                var:datePatternStrict="yyyy/MM/dd"<br>
 *                var:startDate="2004/01/01"<br>
 *                var:endDate="abc"<br>
 *                Msg("message","message")<br>
 *         (?) errors:not null<br>
 *                (vf)<br>
 *         (?) validator:not null<br>
 *         (?) request:not null<br>
 *                Locale=JAPANESE<br>
 *
 * <br>
 * l?F(l) boolean:false<br>
 *         (?) errors:ActionMessage("message")<br>
 *
 * <br>
 * datePatternnull?AdatePatternStrict??ttH?[}bg?A
 * endDatet???AG?[?bZ?[Wfalsep
 * mF?B
 * <br>
 *
 * @throws Exception ?\bh?O
 */
public void testValidateDateRange23() throws Exception {
    //eXgf?[^?
    // ++++ beanIuWFNg ++++
    String bean = "2005/01/01";
    // ++++ ??IuWFNg
    ValidatorAction va = new ValidatorAction();
    va.setName("message");
    // ++++ ?tB?[h?
    Field field = new Field();
    Var var = new Var();
    var.setName("datePattern");
    var.setValue(null);
    field.addVar(var);
    var = new Var();
    var.setName("datePatternStrict");
    var.setValue("yyyy/MM/dd");
    field.addVar(var);
    var = new Var();
    var.setName("startDate");
    var.setValue("2004/01/01");
    field.addVar(var);
    var = new Var();
    var.setName("endDate");
    var.setValue("abc");
    field.addVar(var);
    // ?bZ?[W?
    Msg msg = new Msg();
    msg.setKey("message");
    msg.setName("message");
    msg.setResource(false);
    field.addMsg(msg);
    // G?[?
    ActionMessages errors = new ActionMessages();
    // [HTTPNGXg
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setLocale(Locale.JAPANESE);
    // ValidatorResourcesCX^X
    ValidatorResources validatorResources = new ValidatorResources();
    // ValidatorCX^X
    Validator validator = new Validator(validatorResources);

    // eXg?s
    boolean result = FieldChecksEx.validateDateRange(bean, va, field, errors, validator, request);
    // eXgmF
    // falsep?B
    assertFalse(result);
    // G?[?1??B
    assertEquals(1, errors.size());

    // ?bZ?[WIuWFNgmF
    Iterator it = errors.get();
    ActionMessage message = (ActionMessage) it.next();
    assertEquals("message", message.getKey());
}