Java tutorial
/* * Copyright (c) 2007 NTT DATA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package jp.terasoluna.fw.web.struts.form; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import jp.terasoluna.utlib.LogUTUtil; import jp.terasoluna.utlib.MockHttpServletRequest; import jp.terasoluna.utlib.PropertyTestCase; import org.apache.commons.validator.Field; import org.apache.commons.validator.Msg; import org.apache.commons.validator.Validator; import org.apache.commons.validator.ValidatorAction; import org.apache.commons.validator.ValidatorResources; import org.apache.commons.validator.Var; import org.apache.struts.Globals; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; /** * {@link jp.terasoluna.fw.web.struts.form.FieldChecksEx} * NXubN{bNXeXg?B * * <p> * <h4>?yNXTv?z</h4> * Validator?[NX?B * <p> * * @see jp.terasoluna.fw.web.struts.form.FieldChecksEx */ public class FieldChecksExTest09 extends PropertyTestCase { /** * eXgP?[X?s * GUI AvP?[VN?B * * @param args java R}h?p??[^ */ public static void main(String[] args) { junit.swingui.TestRunner.run(FieldChecksExTest09.class); } /** * ????s?B * * @throws Exception ?\bh?O * @see jp.terasoluna.utlib.spring.PropertyTestCase#setUpData() */ @Override protected void setUpData() throws Exception { LogUTUtil.flush(); deleteProperty("validation.hankaku.kana.list"); deleteProperty("validation.zenkaku.kana.list"); } /** * ?I???s?B * * @throws Exception ?\bh?O * @see jp.terasoluna.utlib.spring.PropertyTestCase#cleanUpData() */ @Override protected void cleanUpData() throws Exception { } /** * RXgN^?B * * @param name eXgP?[XO?B */ public FieldChecksExTest09(String name) { super(name); } /** * testValidateDateRange01() * <br><br> * * (??n) * <br> * _?FC,F * <br><br> * l?F(?) bean:null<br> * (?) va:not null<br> * (?) field:not null<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:true<br> * (?) ?O:?Ox?F<br> * G?[<br> * ?bZ?[W?F<br> * bean is null.<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ?beannull?AG?[?O?otruep * mF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange01() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = null; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); // ++++ ?tB?[h? Field field = new Field(); // ?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()); // G?[?OmF assertTrue(LogUTUtil.checkError("bean is null.")); } /** * testValidateDateRange02() * <br><br> * * (??n) * <br> * _?FC,F * <br><br> * l?F(?) bean:""<br> * (?) va:not null<br> * (?) field:not null<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * ?bean?AtruepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange02() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = ""; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); // ++++ ?tB?[h? Field field = new Field(); // ?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()); } /** * testValidateDateRange03() * <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")); } /** * testValidateDateRange04() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"abc"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=""<br> * var:datePatternStrict=""<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?AdatePatternStrictw?A * ?beanDate???A * G?[?bZ?[WfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange04() 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(""); field.addVar(var); var = new Var(); var.setName("datePatternStrict"); var.setValue(""); 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()); } /** * testValidateDateRange05() * <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="yyyy/MM/dd"<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> * datePatternw?AdatePatternStrict??ttH?[}bg * w?A?beanDate???A * G?[?bZ?[WfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange05() 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("yyyy/MM/dd"); 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()); } /** * testValidateDateRange06() * <br><br> * * (?n) * <br> * _?FC * <br><br> * l?F(?) bean:"2005/10/24"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="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> * (?) ?O:?Ox?F<br> * G?[<br> * ?bZ?[W?F<br> * Illegal pattern character 'b'<br> * O?F<br> * IllegalArgumentException<br> * (?) errors:ActionMessage("message")<br> * * <br> * ?bean??t\?AdatePatternw?A * datePatternStricts?ttH?[}bgw???A * G?[?bZ?[WfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange06() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/10/24"; // ++++ ??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("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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Illegal pattern character 'b'", new IllegalArgumentException())); } /** * testValidateDateRange07() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/02/29"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="yyyy/MM/dd"<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> * ?bean?t\?AdatePatternw?A * datePatternStricts?ttH?[}bgw???A * G?[?bZ?[WfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange07() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/02/29"; // ++++ ??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); // ?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()); } /** * testValidateDateRange08() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/2/28"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict="yyyy/MM/dd"<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> * ?bean??t\?AdatePatternw?A * datePatternStrictwttH?[}bgbeantH?[}bg * Sv???AG?[?bZ?[Wfalsep * mF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange08() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/2/28"; // ++++ ??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); // ?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()); } /** * testValidateDateRange09() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"abc"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="yyyy/MM/dd"<br> * var:datePatternStrict=null<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??ttH?[}bgw?A * ?beanDate???AG?[?bZ?[Wfalse * pmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange09() 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("yyyy/MM/dd"); 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(); // [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()); } /** * testValidateDateRange10() * <br><br> * * (?n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/10/24"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="abc"<br> * var:datePatternStrict=null<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> * (?) ?O:?Ox?F<br> * G?[<br> * ?bZ?[W?F<br> * Illegal pattern character 'b'<br> * O?F<br> * IllegalArgumentException<br> * (?) errors:ActionMessage("message")<br> * * <br> * ?bean??t\?AdatePatterns? * ttH?[}bgw???AG?[?bZ?[Wfalse * pmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange10() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/10/24"; // ++++ ??IuWFNg ValidatorAction va = new ValidatorAction(); va.setName("message"); // ++++ ?tB?[h? Field field = new Field(); Var var = new Var(); var.setName("datePattern"); var.setValue("abc"); 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(); // [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()); // G?[?O`FbN assertTrue(LogUTUtil.checkError("Illegal pattern character 'b'", new IllegalArgumentException())); } /** * testValidateDateRange11() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/02/29"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="yyyy/MM/dd"<br> * var:datePatternStrict=null<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> * ?bean?t\?AdatePatterns? * ttH?[}bgw???AG?[?bZ?[W * falsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange11() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/02/29"; // ++++ ??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(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(); // [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()); } /** * testValidateDateRange12() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/2/28"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="yyyy/MM/dd"<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate=null<br> * var:endDate=null<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * datePatterndatePatternStrictw???A * datePatternwtH?[}bgD??A<br> * fieldstartDateendDatenull???Atrue?AmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange12() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/2/28"; // ++++ ??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(null); field.addVar(var); var = new Var(); var.setName("endDate"); 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(); // [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()); } /** * testValidateDateRange13() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/2/28"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="yyyy/MM/dd"<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate=""<br> * var:endDate=""<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * datePatterndatePatternStrictw???A * datePatternwtH?[}bgD??A<br> * fieldstartDateendDate???Atrue?A * mF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange13() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/2/28"; // ++++ ??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(""); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue(""); 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()); } /** * testValidateDateRange14() * <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="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?AdatePatternStrictw?A * ?beanDate?AfieldstartDatet???A * G?[?bZ?[W?AfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange14() 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("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()); } /** * testValidateDateRange15() * <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="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> * datePatternStrict??ttH?[}bgw?A * ?beanDate?AfieldstartDatet???A * G?[?bZ?[W?AfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange15() 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("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()); } /** * testValidateDateRange16() * <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="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> * datePatternStrict??ttH?[}bgw?A * ?beanDate?AfieldstartDatet???A * G?[?bZ?[W?AfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange16() 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("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()); } /** * testValidateDateRange17() * <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()); } /** * testValidateDateRange18() * <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()); } /** * testValidateDateRange19() * <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()); } /** * testValidateDateRange20() * <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()); } /** * testValidateDateRange21() * <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()); } /** * testValidateDateRange22() * <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()); } /** * testValidateDateRange23() * <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()); } /** * testValidateDateRange24() * <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="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?AdatePatternStrict??ttH?[}bgw?A * fieldendDatet???AG?[?bZ?[W?A * falsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange24() 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("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()); } /** * testValidateDateRange25() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/01/02"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern="yyyy/MM/dd"<br> * var:datePatternStrict="yyyy/MM/dd"<br> * var:startDate="2004/01/01"<br> * var:endDate="2005/1/1"<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?AendDatewt???A * G?[?bZ?[W?AfalsepmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange25() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/01/02"; // ++++ ??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("2004/01/01"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/1/1"); 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()); } /** * testValidateDateRange26() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/01/02"<br> * (?) va:not null<br> * (?) field:not null<br> * var:datePattern=null<br> * var:datePatternStrict=null<br> * var:startDate="2005/1/1"<br> * var:endDate="2005/1/3"<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * datePattern?AdatePatternStrictnullbeantstartDateendDate * ???AtruemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange26() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/01/02"; // ++++ ??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("2005/1/1"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/1/3"); 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()); } /** * testValidateDateRange27() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"2005/1/2"<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/1"<br> * var:endDate="2005/1/3"<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * datePattern?AdatePatternStricttH?[}bgw???A * datePatterntH?[}bgKpmF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange27() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/1/2"; // ++++ ??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/1"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/1/3"); 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()); } /** * testValidateDateRange28() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:"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> * (?) 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> * datePatternnull?AdatePatternStrict??tH?[}bgw * ???AbeantstartDateendDate???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange28() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ String bean = "2005/01/02"; // ++++ ??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("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()); } /** * testValidateDateRange29() * <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="2005/1/1"<br> * var:end]Date="2005/1/1"<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:true<br> * (?) errors:not null<br> * (vf)<br> * * <br> * beant?AstartDate?AendDatev???A * truemF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange29() 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("2005/1/1"); field.addVar(var); var = new Var(); var.setName("endDate"); var.setValue("2005/1/1"); 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()); } /** * testValidateDateRange30() * <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()); } /** * testValidateDateRange31() * <br><br> * * (??n) * <br> * _?FF * <br><br> * l?F(?) bean:Map:<br> * ["field1"=<br> * ?@"2005/01/04"]<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:false<br> * (?) errors:ActionMessage("message")<br> * * <br> * ?beanString^???AfieldOv?peB`FbN?smF?B * <br> * * @throws Exception ?\bh?O */ public void testValidateDateRange31() throws Exception { //eXgf?[^? // ++++ beanIuWFNg ++++ Map<String, String> bean = new HashMap<String, String>(); bean.put("field1", "2005/01/04"); // ++++ ??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 assertFalse(result); // G?[???B assertEquals(1, errors.size()); Iterator it = errors.get(); ActionMessage message = (ActionMessage) it.next(); assertEquals("message", message.getKey()); } /** * testValidateDateRange32() * <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()); } }