KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > dispatcher > ServletDispatchedTestAssertInterceptor


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 /*
6  * Created on 2/10/2003
7  *
8  */

9 package com.opensymphony.webwork.dispatcher;
10
11 import com.opensymphony.webwork.TestAction;
12 import com.opensymphony.xwork.ActionInvocation;
13 import com.opensymphony.xwork.interceptor.Interceptor;
14 import junit.framework.Assert;
15
16
17 /**
18  * @author CameronBraid
19  */

20 public class ServletDispatchedTestAssertInterceptor implements Interceptor {
21     //~ Constructors ///////////////////////////////////////////////////////////
22

23     /**
24      *
25      */

26     public ServletDispatchedTestAssertInterceptor() {
27         super();
28     }
29
30     //~ Methods ////////////////////////////////////////////////////////////////
31

32     /* (non-Javadoc)
33      * @see com.opensymphony.xwork.interceptor.Interceptor#destroy()
34      */

35     public void destroy() {
36     }
37
38     /* (non-Javadoc)
39      * @see com.opensymphony.xwork.interceptor.Interceptor#init()
40      */

41     public void init() {
42     }
43
44     /* (non-Javadoc)
45      * @see com.opensymphony.xwork.interceptor.Interceptor#intercept(com.opensymphony.xwork.ActionInvocation)
46      */

47     public String JavaDoc intercept(ActionInvocation invocation) throws Exception JavaDoc {
48         Assert.assertTrue(invocation.getAction() instanceof TestAction);
49
50         TestAction testAction = (TestAction) invocation.getAction();
51
52         Assert.assertEquals("bar", testAction.getFoo());
53
54         String JavaDoc result = invocation.invoke();
55
56         return result;
57     }
58 }
59
Popular Tags