Commits

Anonymous committed df44766

Issue number: XW-345
Obtained from:
Submitted by: Claus Ibsen
Reviewed by: Rene Gielen
test for prepare interceptor

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@848e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/test/com/opensymphony/xwork/interceptor/PrepareInterceptorTest.java

+package com.opensymphony.xwork.interceptor;
+
+import com.mockobjects.dynamic.Mock;
+import com.opensymphony.xwork.*;
+import junit.framework.TestCase;
+
+/**
+ * Unit test for PrepareInterceptor.
+ *
+ * @author Claus Ibsen
+ */
+public class PrepareInterceptorTest extends TestCase {
+
+    private Mock mock;
+    private PrepareInterceptor interceptor;
+
+    public void testPrepareCalled() throws Exception {
+        MockActionInvocation mai = new MockActionInvocation();
+        mai.setAction(mock.proxy());
+        mock.expect("prepare");
+
+        interceptor.before(mai);
+        interceptor.after(mai, Action.SUCCESS); // to have higher code coverage
+    }
+
+    protected void setUp() throws Exception {
+        mock = new Mock(Preparable.class);
+        interceptor = new PrepareInterceptor();
+    }
+
+    protected void tearDown() throws Exception {
+        mock.verify();
+    }
+
+}