|
Struts example source code file (VisitorFieldValidatorModelTest.java)
The Struts VisitorFieldValidatorModelTest.java source code/* * Copyright 2002-2003,2009 The Apache Software Foundation. * * 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 com.opensymphony.xwork2.validator; import com.opensymphony.xwork2.*; import com.opensymphony.xwork2.config.entities.ActionConfig; import com.opensymphony.xwork2.test.TestBean2; import java.util.*; import org.easymock.EasyMock; /** * VisitorFieldValidatorModelTest * * @author Jason Carreira * Date: Mar 18, 2004 2:51:42 PM */ public class VisitorFieldValidatorModelTest extends XWorkTestCase { protected VisitorValidatorModelAction action; private Locale origLocale; @Override public void setUp() throws Exception { super.setUp(); origLocale = Locale.getDefault(); Locale.setDefault(Locale.US); action = new VisitorValidatorModelAction(); TestBean bean = action.getBean(); Calendar cal = new GregorianCalendar(1900, 01, 01); bean.setBirth(cal.getTime()); bean.setCount(-1); ActionConfig config = new ActionConfig.Builder("", "name", "").build(); ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class); ActionProxy proxy = EasyMock.createNiceMock(ActionProxy.class); EasyMock.expect(invocation.getProxy()).andReturn(proxy).anyTimes(); EasyMock.expect(invocation.getAction()).andReturn(null).anyTimes(); EasyMock.expect(invocation.invoke()).andReturn(Action.SUCCESS).anyTimes(); EasyMock.expect(proxy.getMethod()).andReturn("execute").anyTimes(); EasyMock.expect(proxy.getConfig()).andReturn(config).anyTimes(); EasyMock.replay(invocation); EasyMock.replay(proxy); ActionContext.getContext().setActionInvocation(invocation); } public void testModelFieldErrorsAddedWithoutFieldPrefix() throws Exception { container.getInstance(ActionValidatorManager.class).validate(action, null); assertTrue(action.hasFieldErrors()); Map<String, List Other Struts examples (source code examples)Here is a short list of links related to this Struts VisitorFieldValidatorModelTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.