01: /*
02: * Copyright (c) 2002-2006 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.xwork;
06:
07: import com.opensymphony.xwork.config.ConfigurationManager;
08: import com.opensymphony.xwork.util.LocalizedTextUtil;
09: import com.opensymphony.xwork.util.OgnlValueStack;
10: import com.opensymphony.xwork.util.XWorkConverter;
11: import junit.framework.TestCase;
12:
13: /**
14: * Base JUnit TestCase to extend for XWork specific unit tests.
15: *
16: * @author plightbo
17: * @author tmjee
18: *
19: * @version $Date: 2007-06-02 11:01:04 +0200 (Sat, 02 Jun 2007) $ $Id: XWorkTestCase.java 1533 2007-06-02 09:01:04Z tm_jee $
20: */
21: public abstract class XWorkTestCase extends TestCase {
22:
23: protected void setUp() throws Exception {
24: // Reset the value stack
25: OgnlValueStack stack = new OgnlValueStack();
26: ActionContext.setContext(new ActionContext(stack.getContext()));
27:
28: // clear out configuration
29: ConfigurationManager.destroyConfiguration();
30: ConfigurationManager.setConfiguration(null);
31:
32: // clear out localization
33: LocalizedTextUtil.reset();
34:
35: // type conversion
36: XWorkConverter.resetInstance();
37:
38: // reset ognl
39: OgnlValueStack.reset();
40: }
41:
42: protected void tearDown() throws Exception {
43: // reset the old object factory
44: ObjectFactory.setObjectFactory(new ObjectFactory());
45:
46: // clear out configuration
47: ConfigurationManager.destroyConfiguration();
48: ConfigurationManager.setConfiguration(null);
49: }
50: }
|