Author: janne
Date: Thu Mar 22 04:24:14 2007
New Revision: 521219

URL: http://svn.apache.org/viewvc?view=rev&rev=521219
Log:
WICKET-226:  WicketTester version which does not depend on junit


Modified:
    
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/FormTester.java
    
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/WicketTester.java
    
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/WicketTesterTest.java
    
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java

Modified: 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/FormTester.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/FormTester.java?view=diff&rev=521219&r1=521218&r2=521219
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/FormTester.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/FormTester.java
 Thu Mar 22 04:24:14 2007
@@ -25,7 +25,6 @@
 import java.util.List;
 import java.util.Map;
 
-import junit.framework.Assert;
 import wicket.Component;
 import wicket.WicketRuntimeException;
 import wicket.Component.IVisitor;
@@ -51,7 +50,7 @@
 
 /**
  * A helper for testing validation and submission of Form component.
- * 
+ *
  * @author Ingram Chen
  * @author Frank Bille (frankbille)
  */
@@ -60,7 +59,7 @@
        /**
         * A selector template for selecting seletable form component via index 
of
         * option, support RadioGroup, CheckGroup, and AbstractChoice family.
-        * 
+        *
         */
        protected abstract class ChoiceSelector
        {
@@ -100,7 +99,7 @@
 
                /**
                 * Construct.
-                * 
+                *
                 * @param formComponent
                 */
                protected ChoiceSelector(FormComponent formComponent)
@@ -110,14 +109,14 @@
 
                /**
                 * implement whether toggle or cumulate selection
-                * 
+                *
                 * @param formComponent
                 * @param value
                 */
                protected abstract void 
assignValueToFormComponent(FormComponent formComponent, String value);
 
                /**
-                * 
+                *
                 * @param index
                 */
                protected final void doSelect(final int index)
@@ -128,7 +127,7 @@
                                                new 
SearchOptionByIndexVisitor(index));
                                if (foundRadio == null)
                                {
-                                       Assert.fail("RadioGroup " + 
formComponent.getPath() + " does not has index:"
+                                       fail("RadioGroup " + 
formComponent.getPath() + " does not has index:"
                                                        + index);
                                }
                                assignValueToFormComponent(formComponent, 
foundRadio.getValue());
@@ -139,7 +138,7 @@
                                                new 
SearchOptionByIndexVisitor(index));
                                if (foundCheck == null)
                                {
-                                       Assert.fail("CheckGroup " + 
formComponent.getPath() + " does not have index:"
+                                       fail("CheckGroup " + 
formComponent.getPath() + " does not have index:"
                                                        + index);
                                }
 
@@ -150,7 +149,7 @@
                                String idValue = 
selectAbstractChoice(formComponent, index);
                                if (idValue == null)
                                {
-                                       Assert.fail(formComponent.getPath() + " 
is not selectable component.");
+                                       fail(formComponent.getPath() + " is not 
selectable component.");
                                }
                                else
                                {
@@ -209,13 +208,13 @@
        private class ChoiceSelectorFactory
        {
                /**
-                * 
+                *
                 */
                private final class MultipleChoiceSelector extends 
ChoiceSelector
                {
                        /**
                         * Construct.
-                        * 
+                        *
                         * @param formComponent
                         */
                        protected MultipleChoiceSelector(FormComponent 
formComponent)
@@ -223,13 +222,13 @@
                                super(formComponent);
                                if (!allowMultipleChoice(formComponent))
                                {
-                                       Assert.fail("Component:'" + 
formComponent.getPath()
-                                                       + "' Not support 
multiple selection.");
+                                       fail("Component:'" + 
formComponent.getPath()
+                                                       + "' Does not support 
multiple selection.");
                                }
                        }
 
                        /**
-                        * 
+                        *
                         * @see 
wicket.util.tester.FormTester.ChoiceSelector#assignValueToFormComponent(wicket.markup.html.form.FormComponent,
                         *      java.lang.String)
                         */
@@ -241,13 +240,13 @@
                }
 
                /**
-                * 
+                *
                 */
                private final class SingleChoiceSelector extends ChoiceSelector
                {
                        /**
                         * Construct.
-                        * 
+                        *
                         * @param formComponent
                         */
                        protected SingleChoiceSelector(FormComponent 
formComponent)
@@ -256,7 +255,7 @@
                        }
 
                        /**
-                        * 
+                        *
                         * @see 
wicket.util.tester.FormTester.ChoiceSelector#assignValueToFormComponent(wicket.markup.html.form.FormComponent,
                         *      java.lang.String)
                         */
@@ -268,7 +267,7 @@
                }
 
                /**
-                * 
+                *
                 * @param formComponent
                 * @return ChoiceSelector
                 */
@@ -285,14 +284,14 @@
                        }
                        else
                        {
-                               Assert.fail("Selecting on the component:'" + 
formComponent.getPath()
+                               fail("Selecting on the component:'" + 
formComponent.getPath()
                                                + "' is not supported.");
                                return null;
                        }
                }
 
                /**
-                * 
+                *
                 * @param formComponent
                 * @return ChoiceSelector
                 */
@@ -302,14 +301,14 @@
                }
 
                /**
-                * 
+                *
                 * @param formComponent
                 * @return boolean
                 */
                private boolean allowMultipleChoice(FormComponent formComponent)
                {
                        return formComponent instanceof CheckGroup
-                                       || formComponent instanceof 
ListMultipleChoice;
+                       || formComponent instanceof ListMultipleChoice;
                }
        }
 
@@ -332,7 +331,7 @@
 
        /**
         * @see WicketTester#newFormTester(String)
-        * 
+        *
         * @param path
         *            path to form component
         * @param workingForm
@@ -379,8 +378,8 @@
                                        }
                                }
                                else if ( (formComponent instanceof 
DropDownChoice) ||
-                                                 (formComponent instanceof 
RadioChoice) ||
-                                                 (formComponent instanceof 
CheckBox))
+                                               (formComponent instanceof 
RadioChoice) ||
+                                               (formComponent instanceof 
CheckBox))
                                {
                                        setFormComponentValue(formComponent, 
formComponent.getValue());
                                }
@@ -422,7 +421,7 @@
 
        /**
         * Gets value for text component with provided id.
-        * 
+        *
         * @param id
         *            Component's id
         * @return value text component
@@ -443,7 +442,7 @@
         * to interacting on the browser: For single choice, such as Radio or
         * DropDownList, the selection will toggle each other. For multiple 
choice,
         * such as Checkbox or ListMultipleChoice, the selection will cumulate.
-        * 
+        *
         * @param formComponentId
         *            relative path (from form) to selectable formComponent
         * @param index
@@ -477,9 +476,9 @@
        /**
         * A convenient method to select multiple options for the form 
component.
         * The method only support multiple selectable form component.
-        * 
+        *
         * @see #select(String, int)
-        * 
+        *
         * @param formComponentId
         *            relative path (from form) to selectable formComponent
         * @param indexes
@@ -490,7 +489,7 @@
                checkClosed();
 
                ChoiceSelector choiceSelector = choiceSelectorFactory
-                               
.createForMultiple((FormComponent)workingForm.get(formComponentId));
+               
.createForMultiple((FormComponent)workingForm.get(formComponentId));
 
                for (int i = 0; i < indexes.length; i++)
                {
@@ -500,7 +499,7 @@
 
        /**
         * simulate filling a field of a Form.
-        * 
+        *
         * @param formComponentId
         *            relative path (from form) to formComponent
         * @param value
@@ -516,7 +515,7 @@
 
        /**
         * Set the file on a [EMAIL PROTECTED] FileUploadField}.
-        * 
+        *
         * @param formComponentId
         *            relative path (from form) to formComponent. The form 
component
         *            must be of a type FileUploadField.
@@ -574,15 +573,15 @@
 
        /**
         * A convenient method to submit form with alternative button.
-        * 
+        *
         * Note that if the button associates with a model, it's better to use
         * setValue() instead:
-        * 
+        *
         * <pre>
         * formTester.setValue(&quot;to:my:button&quot;, &quot;value on the 
button&quot;);
         * formTester.submit();
         * </pre>
-        * 
+        *
         * @param buttonComponentId
         *            relative path (from form) to the button
         */
@@ -595,7 +594,7 @@
        /**
         * add additional formComponent's value into request parameter, this 
method
         * retain exist parameters but remove any duplicated parameters.
-        * 
+        *
         * @param formComponent
         * @param value
         */
@@ -633,7 +632,7 @@
        }
 
        /**
-        * 
+        *
         * @param formComponent
         * @return Boolean
         */
@@ -647,7 +646,7 @@
        /**
         * set formComponent's value into request parameter, this method 
overwrites
         * exist parameters.
-        * 
+        *
         * @param formComponent
         * @param value
         */
@@ -655,4 +654,46 @@
        {
                
wicketTester.getServletRequest().setParameter(formComponent.getInputName(), 
value);
        }
+
+
+       private Result isTrue(String message, boolean condition)
+       {
+               if (condition)
+               {
+                       return Result.pass();
+               }
+               return Result.fail(message);
+       }
+
+       private Result isEqual(Object expected, Object actual)
+       {
+               if (expected == null && actual == null)
+               {
+                       return Result.pass();
+               }
+               if (expected != null && expected.equals(actual))
+               {
+                       return Result.pass();
+               }
+               String message = "expected:<" + expected + "> but was:<" + 
actual + ">";
+               return Result.fail(message);
+       }
+
+       private void notNull(String message, Object object)
+       {
+               if (object == null) {
+                       fail(message);
+               }
+       }
+
+       private void fail(String message)
+       {
+               throw new WicketRuntimeException(message);
+       }
+
+       private void fail(String message, Throwable t)
+       {
+               throw new WicketRuntimeException(message, t);
+       }
+
 }

Modified: 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/WicketTester.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/WicketTester.java?view=diff&rev=521219&r1=521218&r2=521219
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/WicketTester.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/util/tester/WicketTester.java
 Thu Mar 22 04:24:14 2007
@@ -16,60 +16,32 @@
  */
 package wicket.util.tester;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
 import junit.framework.Assert;
+import junit.framework.AssertionFailedError;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import wicket.Component;
-import wicket.Page;
-import wicket.PageParameters;
-import wicket.RequestCycle;
-import wicket.WicketRuntimeException;
-import wicket.ajax.AjaxEventBehavior;
 import wicket.ajax.AjaxRequestTarget;
-import wicket.ajax.form.AjaxFormSubmitBehavior;
-import wicket.ajax.markup.html.AjaxFallbackLink;
-import wicket.ajax.markup.html.AjaxLink;
-import wicket.ajax.markup.html.form.AjaxSubmitLink;
-import wicket.behavior.AbstractAjaxBehavior;
-import wicket.behavior.IBehavior;
 import wicket.feedback.FeedbackMessage;
-import wicket.feedback.FeedbackMessages;
-import wicket.feedback.IFeedbackMessageFilter;
 import wicket.markup.html.basic.Label;
-import wicket.markup.html.form.Button;
-import wicket.markup.html.form.CheckGroup;
 import wicket.markup.html.form.Form;
-import wicket.markup.html.form.FormComponent;
-import wicket.markup.html.form.RadioGroup;
-import wicket.markup.html.link.BookmarkablePageLink;
-import wicket.markup.html.link.IPageLink;
-import wicket.markup.html.link.Link;
-import wicket.markup.html.link.PageLink;
 import wicket.markup.html.list.ListView;
-import wicket.markup.html.panel.Panel;
-import wicket.protocol.http.MockWebApplication;
 import wicket.protocol.http.WebApplication;
-import wicket.protocol.http.WebRequestCycle;
 import wicket.util.diff.DiffUtil;
-import wicket.util.lang.Classes;
-import wicket.util.string.Strings;
 
 /**
  * A helper to ease unit testing of Wicket applications without the need for a
  * servlet container. To start a test, either use startPage() or startPanel():
- * 
+ *
  * <pre>
- * // production page  
+ * // production page
  * public class MyPage extends WebPage
  * {
  *     public MyPage()
@@ -85,34 +57,34 @@
  *     }
  * }
  * </pre>
- * 
+ *
  * <pre>
  * // test code
  * private WicketTester tester;
- * 
+ *
  * public void setUp()
  * {
  *     tester = new WicketTester();
  * }
- * 
+ *
  * public void testRenderMyPage()
  * {
  *     //start and render the test page
  *     tester.startPage(MyPage.class);
- * 
+ *
  *     //assert rendered page class
  *     tester.assertRenderedPage(MyPage.class);
- * 
- *     //assert rendered label component 
+ *
+ *     //assert rendered label component
  *     tester.assertLabel(&quot;myMessage&quot;, &quot;Hello!&quot;);
  * }
  * </pre>
- * 
+ *
  * Above example is straight forward: start MyPage.class and assert Label it
  * rendered. Next, we try to navigate through link:
- * 
+ *
  * <pre>
- * // production page  
+ * // production page
  * public class YourPage extends WebPage
  * {
  *     public YourPage(String message)
@@ -121,25 +93,25 @@
  *             info(&quot;Wicket Rocks ;-)&quot;);
  *     }
  * }
- * 
+ *
  * //test code
  * public void testLinkToYourPage()
  * {
  *     tester.startPage(MyPage.class);
- * 
+ *
  *     //click link and render
  *     tester.clickLink(&quot;toYourPage&quot;);
- * 
+ *
  *     tester.assertRenderedPage(YourPage.class);
  *     tester.assertLabel(&quot;yourMessage&quot;, &quot;Hi!&quot;);
  * }
  * </pre>
- * 
+ *
  * <code>tester.clickLink(path);</code> will simulate user click on the
  * component (in this case, it's a <code>Link</code>) and render the response
  * page <code>YourPage</code>. Ok, unit test of <code>MyPage</code> is
  * completed. Now we test <code>YourPage</code> standalone:
- * 
+ *
  * <pre>
  * //test code
  * public void testRenderYourPage()
@@ -152,15 +124,15 @@
  *                     return new YourPage(&quot;mock message&quot;);
  *             }
  *     });
- * 
+ *
  *     tester.assertRenderedPage(YourPage.class);
  *     tester.assertLabel(&quot;yourMessage&quot;, &quot;mock message&quot;);
- * 
- *     // assert feedback messages in INFO Level 
+ *
+ *     // assert feedback messages in INFO Level
  *     tester.assertInfoMessages(new String[] { &quot;Wicket Rocks ;-)&quot; 
});
  * }
  * </pre>
- * 
+ *
  * Instead of <code>tester.startPage(pageClass)</code>, we define a
  * [EMAIL PROTECTED] wicket.util.tester.ITestPageSource} to provide testing 
page instance
  * for WicketTester. This is necessary because <code>YourPage</code> uses a
@@ -168,14 +140,14 @@
  * not be instantiated by reflection. Finally, we use
  * <code>assertInfoMessages</code> to assert there is a feedback message
  * "Wicket Rocks ;-)" in INFO level.
- * 
+ *
  * TODO General: Example usage of FormTester
- * 
+ *
  * @author Ingram Chen
  * @author Juergen Donnerstag
  * @author Frank Bille
  */
-public class WicketTester extends MockWebApplication
+public class WicketTester extends BaseWicketTester
 {
        /** log. */
        private static final Log log = LogFactory.getLog(WicketTester.class);
@@ -202,7 +174,7 @@
 
        /**
         * Create WicketTester and automatically create a WebApplication.
-        * 
+        *
         * @param homePage
         */
        public WicketTester(final Class homePage)
@@ -221,7 +193,7 @@
 
        /**
         * Create WicketTester
-        * 
+        *
         * @param application
         *            The wicket tester object
         */
@@ -232,13 +204,13 @@
 
        /**
         * Create WicketTester to help unit testing
-        * 
+        *
         * @param application
         *            The wicket tester object
         * @param path
         *            The absolute path on disk to the web application contents
         *            (e.g. war root) - may be null
-        * 
+        *
         * @see 
wicket.protocol.http.MockWebApplication#MockWebApplication(String)
         */
        public WicketTester(final WebApplication application, final String path)
@@ -246,224 +218,10 @@
                super(application, path);
        }
 
-       /**
-        * Render a page defined in <code>TestPageSource</code>. This is usually
-        * used when a page does not have default constructor. For example, a
-        * <code>ViewBook</code> page requires a <code>Book</code> instance:
-        * 
-        * <pre>
-        * tester.startPage(new TestPageSource()
-        * {
-        *      public Page getTestPage()
-        *      {
-        *              Book mockBook = new Book(&quot;myBookName&quot;);
-        *              return new ViewBook(mockBook);
-        *      }
-        * });
-        * </pre>
-        * 
-        * @param testPageSource
-        *            a page factory that creating test page instance
-        * @return Page rendered page
-        */
-       public final Page startPage(final ITestPageSource testPageSource)
-       {
-               startPage(DummyHomePage.class);
-               DummyHomePage page = (DummyHomePage)getLastRenderedPage();
-               page.setTestPageSource(testPageSource);
-
-               executeListener(page.getTestPageLink());
-               return getLastRenderedPage();
-       }
-
-       /**
-        * Builds and processes a request suitable for invoking a listener. The
-        * component must implement any of the known *Listener interfaces.
-        * 
-        * @param component the listener to invoke
-        */
-       public void executeListener(Component component)
-       {
-               setupRequestAndResponse();
-               getServletRequest().setRequestToComponent(component);
-               processRequestCycle();
-       }
-
-       /**
-        * Builds and processes a request suitable for executing an ajax 
behavior.
-        * 
-        * @param behavior the ajax behavior to execute
-        */
-       public void executeBehavior(final AbstractAjaxBehavior behavior)
-       {
-               setupRequestAndResponse();
-               WebRequestCycle cycle = createRequestCycle();
-               getServletRequest().setRequestToRedirectString(
-                               behavior.getCallbackUrl(false, 
false).toString());
-               processRequestCycle(cycle);
-       }
-
-       /**
-        * Render the page
-        * 
-        * @param page
-        * @return The page rendered
-        */
-       public final Page startPage(final Page page)
-       {
-               processRequestCycle(page);
-
-               Page last = getLastRenderedPage();
-               //
-               // createRequestCycle();
-               // getWicketSession().touch(page);
-               // if (page != last)
-               // {
-               // getWicketSession().touch(last);
-               // }
-               return last;
-       }
-
-       /**
-        * Render a page from its default constructor.
-        * 
-        * @param pageClass
-        *            a test page class with default constructor
-        * @return Page Rendered Page
-        */
-       public final Page startPage(Class pageClass)
-       {
-               setupRequestAndResponse();
-               processRequestCycle(pageClass);
-               return getLastRenderedPage();
-       }
-
-       /**
-        * Render a panel defined in <code>TestPanelSource</code>. The usage is
-        * similar with [EMAIL PROTECTED] #startPage(ITestPageSource)}. Please 
note that
-        * testing panel must use supplied <code>panelId<code> as component id.
-        * 
-        * <pre>
-        * tester.startPanel(new TestPanelSource()
-        * {
-        *      public Panel getTestPanel(String panelId)
-        *      {
-        *              MyData mockMyData = new MyData();
-        *              return new MyPanel(panelId, mockMyData);
-        *      }
-        * });
-        * </pre>
-        * 
-        * @param testPanelSource
-        *            a panel factory that creating test panel instance
-        * @return Panel rendered panel
-        */
-       public final Panel startPanel(final TestPanelSource testPanelSource)
-       {
-               return (Panel)startPage(new ITestPageSource()
-               {
-                       private static final long serialVersionUID = 1L;
-
-                       public Page getTestPage()
-                       {
-                               return new DummyPanelPage(testPanelSource);
-                       }
-               }).get(DummyPanelPage.TEST_PANEL_ID);
-       }
-
-       /**
-        * Render a panel from <code>Panel(String id)</code> constructor.
-        * 
-        * @param panelClass
-        *            a test panel class with <code>Panel(String id)</code>
-        *            constructor
-        * @return Panel rendered panel
-        */
-       public final Panel startPanel(final Class panelClass)
-       {
-               return (Panel)startPage(new ITestPageSource()
-               {
-                       private static final long serialVersionUID = 1L;
-
-                       public Page getTestPage()
-                       {
-                               return new DummyPanelPage(new TestPanelSource()
-                               {
-                                       private static final long 
serialVersionUID = 1L;
-
-                                       public Panel getTestPanel(String 
panelId)
-                                       {
-                                               try
-                                               {
-                                                       Constructor c = 
panelClass.getConstructor(new Class[] { String.class });
-                                                       return 
(Panel)c.newInstance(new Object[] { panelId });
-                                               }
-                                               catch (SecurityException e)
-                                               {
-                                                       throw 
convertoUnexpect(e);
-                                               }
-                                               catch (NoSuchMethodException e)
-                                               {
-                                                       throw 
convertoUnexpect(e);
-                                               }
-                                               catch (InstantiationException e)
-                                               {
-                                                       throw 
convertoUnexpect(e);
-                                               }
-                                               catch (IllegalAccessException e)
-                                               {
-                                                       throw 
convertoUnexpect(e);
-                                               }
-                                               catch 
(InvocationTargetException e)
-                                               {
-                                                       throw 
convertoUnexpect(e);
-                                               }
-                                       }
-                               });
-                       }
-               }).get(DummyPanelPage.TEST_PANEL_ID);
-       }
-
-       /**
-        * Throw "standard" WicketRuntimeException
-        * 
-        * @param e
-        * @return RuntimeException
-        */
-       private RuntimeException convertoUnexpect(Exception e)
-       {
-               return new WicketRuntimeException("tester: unexpected", e);
-       }
-
-       /**
-        * Gets the component with the given path from last rendered page. This
-        * method fails in case the component couldn't be found, and it will 
return
-        * null if the component was found, but is not visible.
-        * 
-        * @param path
-        *            Path to component
-        * @return The component at the path
-        * @see wicket.MarkupContainer#get(String)
-        */
-       public Component getComponentFromLastRenderedPage(String path)
-       {
-               final Component component = getLastRenderedPage().get(path);
-               if (component == null)
-               {
-                       Assert.fail("path: '" + path + "' does no exist for 
page: "
-                                       + 
Classes.simpleName(getLastRenderedPage().getClass()));
-                       return component;
-               }
-               if (component.isVisibleInHierarchy())
-               {
-                       return component;
-               }
-               return null;
-       }
 
        /**
         * assert the text of <code>Label</code> component.
-        * 
+        *
         * @param path
         *            path to <code>Label</code> component
         * @param expectedLabelText
@@ -477,7 +235,7 @@
 
        /**
         * assert <code>PageLink</code> link to page class.
-        * 
+        *
         * @param path
         *            path to <code>PageLink</code> component
         * @param expectedPageClass
@@ -485,31 +243,12 @@
         */
        public void assertPageLink(String path, Class expectedPageClass)
        {
-               PageLink pageLink = 
(PageLink)getComponentFromLastRenderedPage(path);
-               try
-               {
-                       Field iPageLinkField = 
pageLink.getClass().getDeclaredField("pageLink");
-                       iPageLinkField.setAccessible(true);
-                       IPageLink iPageLink = 
(IPageLink)iPageLinkField.get(pageLink);
-                       Assert.assertEquals(expectedPageClass, 
iPageLink.getPageIdentity());
-               }
-               catch (SecurityException e)
-               {
-                       throw convertoUnexpect(e);
-               }
-               catch (NoSuchFieldException e)
-               {
-                       throw convertoUnexpect(e);
-               }
-               catch (IllegalAccessException e)
-               {
-                       throw convertoUnexpect(e);
-               }
+               assertResult(isPageLink(path, expectedPageClass));
        }
 
        /**
         * assert component class
-        * 
+        *
         * @param path
         *            path to component
         * @param expectedComponentClass
@@ -517,57 +256,45 @@
         */
        public void assertComponent(String path, Class expectedComponentClass)
        {
-               Component component = getComponentFromLastRenderedPage(path);
-               Assert.assertTrue("component '" + 
Classes.simpleName(component.getClass())
-                               + "' is not type:" + 
Classes.simpleName(expectedComponentClass),
-                               
expectedComponentClass.isAssignableFrom(component.getClass()));
+               assertResult(isComponent(path, expectedComponentClass));
        }
 
        /**
         * assert component visible.
-        * 
+        *
         * @param path
         *            path to component
         */
        public void assertVisible(String path)
        {
-               Component component = getLastRenderedPage().get(path);
-               if (component == null)
-               {
-                       Assert.fail("path: '" + path + "' does no exist for 
page: "
-                                       + 
Classes.simpleName(getLastRenderedPage().getClass()));
-               }
-
-               Assert.assertTrue("component '" + path + "' is not visible", 
component.isVisible());
+               assertResult(isVisible(path));
        }
 
        /**
         * assert component invisible.
-        * 
+        *
         * @param path
         *            path to component
         */
        public void assertInvisible(String path)
        {
-               Assert.assertNull("component '" + path + "' is visible",
-                               getComponentFromLastRenderedPage(path));
+               assertResult(isInvisible(path));
        }
 
        /**
         * assert the content of last rendered page contains(matches) regex 
pattern.
-        * 
+        *
         * @param pattern
         *            reqex pattern to match
         */
        public void assertContains(String pattern)
        {
-               Assert.assertTrue("pattern '" + pattern + "' not found", 
getServletResponse().getDocument()
-                               .matches("(?s).*" + pattern + ".*"));
+               assertResult(ifContains(pattern));
        }
 
        /**
         * assert the model of [EMAIL PROTECTED] ListView} use expectedList
-        * 
+        *
         * @param path
         *            path to [EMAIL PROTECTED] ListView} component
         * @param expectedList
@@ -583,7 +310,7 @@
         * create a [EMAIL PROTECTED] FormTester} for the form at path, and 
fill all child
         * [EMAIL PROTECTED] wicket.markup.html.form.FormComponent}s with blank 
String
         * initially.
-        * 
+        *
         * @param path
         *            path to [EMAIL PROTECTED] Form} component
         * @return FormTester A FormTester instance for testing form
@@ -596,7 +323,7 @@
 
        /**
         * create a [EMAIL PROTECTED] FormTester} for the form at path.
-        * 
+        *
         * @param path
         *            path to [EMAIL PROTECTED] Form} component
         * @param fillBlankString
@@ -613,235 +340,14 @@
        }
 
        /**
-        * Click the [EMAIL PROTECTED] Link} in the last rendered Page.
-        * <p>
-        * Simulate that AJAX is enabled.
-        * 
-        * @see WicketTester#clickLink(String, boolean)
-        * @param path
-        *            Click the <code>Link</code> in the last rendered Page.
-        */
-       public void clickLink(String path)
-       {
-               clickLink(path, true);
-       }
-
-       /**
-        * Click the [EMAIL PROTECTED] Link} in the last rendered Page.
-        * <p>
-        * This method also works for [EMAIL PROTECTED] AjaxLink}, [EMAIL 
PROTECTED] AjaxFallbackLink}
-        * and [EMAIL PROTECTED] AjaxSubmitLink}.
-        * <p>
-        * On AjaxLinks and AjaxFallbackLinks the onClick method is invoked 
with a
-        * valid AjaxRequestTarget. In that way you can test the flow of your
-        * application when using AJAX.
-        * <p>
-        * When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is
-        * attached to is first submitted, and then the onSubmit method on
-        * AjaxSubmitLink is invoked. If you have changed some values in the 
form
-        * during your test, these will also be submitted. This should not be 
used
-        * as a replacement for the [EMAIL PROTECTED] FormTester} to test your 
forms. It should
-        * be used to test that the code in your onSubmit method in 
AjaxSubmitLink
-        * actually works.
-        * <p>
-        * This method is also able to simulate that AJAX (javascript) is 
disabled
-        * on the client. This is done by setting the isAjax parameter to 
false. If
-        * you have an AjaxFallbackLink you can then check that it doesn't fail 
when
-        * invoked as a normal link.
-        * 
-        * @param path
-        *            path to <code>Link</code> component
-        * @param isAjax
-        *            Whether to simulate that AJAX (javascript) is enabled or 
not.
-        *            If it's false then AjaxLink and AjaxSubmitLink will fail,
-        *            since it wouldn't work in real life. AjaxFallbackLink 
will be
-        *            invoked with null as the AjaxRequestTarget parameter.
-        */
-       public void clickLink(String path, boolean isAjax)
-       {
-               Component linkComponent = 
getComponentFromLastRenderedPage(path);
-
-               // if the link is an AjaxLink, we process it differently
-               // than a normal link
-               if (linkComponent instanceof AjaxLink)
-               {
-                       // If it's not ajax we fail
-                       if (isAjax == false)
-                       {
-                               Assert.fail("Link " + path + "is an AjaxLink 
and will "
-                                               + "not be invoked when AJAX 
(javascript) is disabled.");
-                       }
-
-                       AjaxLink link = (AjaxLink)linkComponent;
-
-                       setupRequestAndResponse();
-                       RequestCycle requestCycle = createRequestCycle();
-                       AjaxRequestTarget target = new AjaxRequestTarget();
-                       requestCycle.setRequestTarget(target);
-
-                       link.onClick(target);
-
-                       // process the request target
-                       target.respond(requestCycle);
-               }
-               // AjaxFallbackLinks is processed like an AjaxLink if isAjax is 
true
-               // If it's not handling of the linkComponent is passed through 
to the
-               // Link.
-               else if (linkComponent instanceof AjaxFallbackLink && isAjax)
-               {
-                       AjaxFallbackLink link = (AjaxFallbackLink)linkComponent;
-
-                       setupRequestAndResponse();
-                       RequestCycle requestCycle = createRequestCycle();
-                       AjaxRequestTarget target = new AjaxRequestTarget();
-                       requestCycle.setRequestTarget(target);
-
-                       link.onClick(target);
-
-                       // process the request target
-                       target.respond(requestCycle);
-               }
-               // if the link is an AjaxSubmitLink, we need to find the form
-               // from it using reflection so we know what to submit.
-               else if (linkComponent instanceof AjaxSubmitLink)
-               {
-                       // If it's not ajax we fail
-                       if (isAjax == false)
-                       {
-                               Assert.fail("Link " + path + "is an 
AjaxSubmitLink and "
-                                               + "will not be invoked when 
AJAX (javascript) is disabled.");
-                       }
-
-                       AjaxSubmitLink link = (AjaxSubmitLink)linkComponent;
-
-                       // We cycle through the attached behaviors and select 
the
-                       // LAST matching behavior as the one we handle.
-                       List behaviors = link.getBehaviors();
-                       AjaxFormSubmitBehavior ajaxFormSubmitBehavior = null;
-                       for (Iterator iter = behaviors.iterator(); 
iter.hasNext();)
-                       {
-                               Object behavior = iter.next();
-                               if (behavior instanceof AjaxFormSubmitBehavior)
-                               {
-                                       AjaxFormSubmitBehavior submitBehavior = 
(AjaxFormSubmitBehavior)behavior;
-                                       ajaxFormSubmitBehavior = submitBehavior;
-                               }
-                       }
-
-                       String failMessage = "No form submit behavior found on 
the submit link. Strange!!";
-                       Assert.assertNotNull(failMessage, 
ajaxFormSubmitBehavior);
-
-                       setupRequestAndResponse();
-                       RequestCycle requestCycle = createRequestCycle();
-
-                       submitAjaxFormSubmitBehavior(ajaxFormSubmitBehavior);
-
-                       // Ok, finally we "click" the link
-                       ajaxFormSubmitBehavior.onRequest();
-
-                       // process the request target
-                       requestCycle.getRequestTarget().respond(requestCycle);
-               }
-               // if the link is a normal link (or ResourceLink)
-               else if (linkComponent instanceof Link)
-               {
-                       Link link = (Link)linkComponent;
-
-                       /*
-                        * If the link is a bookmarkable link, then we need to 
transfer the
-                        * parameters to the next request.
-                        */
-                       if (link instanceof BookmarkablePageLink)
-                       {
-                               BookmarkablePageLink bookmarkablePageLink = 
(BookmarkablePageLink)link;
-                               try
-                               {
-                                       Field parametersField = 
BookmarkablePageLink.class
-                                                       
.getDeclaredField("parameters");
-                                       parametersField.setAccessible(true);
-                                       PageParameters parameters = 
(PageParameters)parametersField
-                                                       
.get(bookmarkablePageLink);
-                                       setParametersForNextRequest(parameters);
-                               }
-                               catch (Exception e)
-                               {
-                                       Assert.fail("Internal error in 
WicketTester. "
-                                                       + "Please report this 
in Wickets Issue Tracker.");
-                               }
-
-                       }
-
-                       executeListener(link);
-               }
-               else
-               {
-                       Assert.fail("Link " + path
-                                       + " is not a Link, AjaxLink, 
AjaxFallbackLink or AjaxSubmitLink");
-               }
-       }
-
-       /**
-        * submit the <code>Form</code> in the last rendered Page.
-        * 
-        * @param path
-        *            path to <code>Form</code> component
-        */
-       public void submitForm(String path)
-       {
-               Form form = (Form)getComponentFromLastRenderedPage(path);
-               executeListener(form);
-       }
-
-       /**
-        * Sets a parameter for the component with the given path to be used 
with
-        * the next request. NOTE: this method only works when a page was 
rendered
-        * first.
-        * 
-        * @param componentPath
-        *            path of the component
-        * @param value
-        *            the parameter value to set
-        */
-       public void setParameterForNextRequest(String componentPath, Object 
value)
-       {
-               if (getLastRenderedPage() == null)
-               {
-                       Assert.fail("before using this method, at least one 
page has to be rendered");
-               }
-
-               Component c = getComponentFromLastRenderedPage(componentPath);
-               if (c == null)
-               {
-                       Assert.fail("component " + componentPath + " was not 
found");
-                       return;
-               }
-
-               if (c instanceof FormComponent)
-               {
-                       
getParametersForNextRequest().put(((FormComponent)c).getInputName(), value);
-               }
-               else
-               {
-                       getParametersForNextRequest().put(c.getPath(), value);
-               }
-
-       }
-
-       /**
         * assert last rendered Page class
-        * 
-        * FIXME explain why the code is so complicated to compare two classes, 
or simplify
-        * 
+        *
         * @param expectedRenderedPageClass
         *            expected class of last renered page
         */
        public void assertRenderedPage(Class expectedRenderedPageClass)
        {
-               if 
(!getLastRenderedPage().getClass().isAssignableFrom(expectedRenderedPageClass))
-               {
-                       
Assert.assertEquals(Classes.simpleName(expectedRenderedPageClass), Classes
-                                       
.simpleName(getLastRenderedPage().getClass()));
-               }
+               assertResult(isRenderedPage(expectedRenderedPageClass));
        }
 
        /**
@@ -850,7 +356,7 @@
         * Use <code>-Dwicket.replace.expected.results=true</code> to
         * automatically replace the expected output file.
         * </p>
-        * 
+        *
         * @param pageClass
         *            Used to load the file (relative to clazz package)
         * @param filename
@@ -866,7 +372,7 @@
 
        /**
         * assert last rendered Page against an expected HTML document as a 
String
-        * 
+        *
         * @param expectedDocument
         *            Expected output
         * @throws Exception
@@ -900,7 +406,7 @@
 
        /**
         * assert error feedback messages
-        * 
+        *
         * @param expectedErrorMessages
         *            expected error messages
         */
@@ -917,7 +423,7 @@
 
        /**
         * assert info feedback message
-        * 
+        *
         * @param expectedInfoMessages
         *            expected info messages
         */
@@ -928,92 +434,6 @@
        }
 
        /**
-        * get feedback messages
-        * 
-        * @param level
-        *            level of feedback message, ex.
-        *            <code>FeedbackMessage.DEBUG or FeedbackMessage.INFO.. 
etc</code>
-        * @return List list of messages (in String)
-        * @see FeedbackMessage
-        */
-       public List getMessages(final int level)
-       {
-               FeedbackMessages feedbackMessages = 
getLastRenderedPage().getFeedbackMessages();
-               List allMessages = feedbackMessages.messages(new 
IFeedbackMessageFilter()
-               {
-                       private static final long serialVersionUID = 1L;
-
-                       public boolean accept(FeedbackMessage message)
-                       {
-                               return message.getLevel() == level;
-                       }
-               });
-               List actualMessages = new ArrayList();
-               for (Iterator iter = allMessages.iterator(); iter.hasNext();)
-               {
-                       
actualMessages.add(((FeedbackMessage)iter.next()).getMessage());
-               }
-               return actualMessages;
-       }
-
-       /**
-        * assert previous rendered page expired
-        * 
-        * TODO Post 1.2: General: This test is no longer valid because it 
depends
-        * on an implementation detail that just changed!
-        * 
-        * public void assertExpirePreviousPage() { IPageMap pageMap =
-        * getWicketSession().getPageMap(null); Field internalMapCacheField; 
try {
-        * internalMapCacheField = pageMap.getClass().getDeclaredField("pages");
-        * internalMapCacheField.setAccessible(true); MostRecentlyUsedMap mru =
-        * (MostRecentlyUsedMap)internalMapCacheField.get(pageMap);
-        * Assert.assertFalse("Previous Page '" +
-        * Classes.name(getPreviousRenderedPage().getClass()) + "' not expire", 
mru
-        * .containsValue(getPreviousRenderedPage())); } catch 
(SecurityException e) {
-        * throw convertoUnexpect(e); } catch (NoSuchFieldException e) { throw
-        * convertoUnexpect(e); } catch (IllegalAccessException e) { throw
-        * convertoUnexpect(e); } }
-        */
-
-       /**
-        * dump the source of last rendered page
-        */
-       public void dumpPage()
-       {
-               log.info(getServletResponse().getDocument());
-       }
-
-       /**
-        * dump component trees
-        */
-       public void debugComponentTrees()
-       {
-               debugComponentTrees("");
-       }
-
-
-       /**
-        * Dump the component trees to log.
-        * 
-        * @param filter
-        *            Show only the components, which path contains the
-        *            filterstring.
-        */
-       public void debugComponentTrees(String filter)
-       {
-               log.info("debugging 
----------------------------------------------");
-               for (Iterator iter = 
WicketTesterHelper.getComponentData(getLastRenderedPage()).iterator(); iter
-                               .hasNext();)
-               {
-                       WicketTesterHelper.ComponentData obj = 
(WicketTesterHelper.ComponentData)iter.next();
-                       if (obj.path.matches(".*" + filter + ".*"))
-                       {
-                               log.info("path\t" + obj.path + " \t" + obj.type 
+ " \t[" + obj.value + "]");
-                       }
-               }
-       }
-
-       /**
         * Test that a component has been added to a AjaxRequestTarget, using
         * [EMAIL PROTECTED] AjaxRequestTarget#addComponent(Component)}. This 
method actually
         * tests that a component is on the AJAX response sent back to the 
client.
@@ -1021,7 +441,7 @@
         * PLEASE NOTE! This method doesn't actually insert the component in the
         * client DOM tree, using javascript. But it shouldn't be needed 
because you
         * have to trust that the Wicket Ajax Javascript just works.
-        * 
+        *
         * @param componentPath
         *            The component path to the component to test whether it's 
on
         *            the response.
@@ -1039,210 +459,21 @@
         * PLEASE NOTE! This method doesn't actually insert the component in the
         * client DOM tree, using javascript. But it shouldn't be needed 
because you
         * have to trust that the Wicket Ajax Javascript just works.
-        * 
+        *
         * @param component
         *            The component to test whether it's on the response.
         */
        public void assertComponentOnAjaxResponse(Component component)
        {
-               String failMessage = "A component which is null could not have 
been added to the AJAX response";
-               Assert.assertNotNull(failMessage, component);
-
-               // Get the AJAX response
-               String ajaxResponse = getServletResponse().getDocument();
-
-               // Test that the previous response was actually a AJAX response
-               failMessage = "The Previous response was not an AJAX response. "
-                               + "You need to execute an AJAX event, using 
clickLink, before using this assert";
-               boolean isAjaxResponse = ajaxResponse
-                               .startsWith("<?xml version=\"1.0\" 
encoding=\"UTF-8\"?><ajax-response>");
-               Assert.assertTrue(failMessage, isAjaxResponse);
-
-               // See if the component has a markup id
-               String markupId = component.getMarkupId();
-
-               failMessage = "The component doesn't have a markup id, "
-                               + "which means that it can't have been added to 
the AJAX response";
-               Assert.assertFalse(failMessage, Strings.isEmpty(markupId));
-
-               // Look for that the component is on the response, using the 
markup id
-               boolean isComponentInAjaxResponse = 
ajaxResponse.matches(".*<component id=\"" + markupId
-                               + "\" ?>.*");
-               failMessage = "Component wasn't found in the AJAX response";
-               Assert.assertTrue(failMessage, isComponentInAjaxResponse);
-       }
-
-       /**
-        * Simulate that an AJAX event has been fired.
-        * 
-        * @see #executeAjaxEvent(Component, String)
-        * 
-        * @since 1.2.3
-        * @param componentPath
-        *            The component path.
-        * @param event
-        *            The event which we simulate is fired. If the event is 
null,
-        *            the test will fail.
-        */
-       public void executeAjaxEvent(String componentPath, String event)
-       {
-               Component component = 
getComponentFromLastRenderedPage(componentPath);
-               executeAjaxEvent(component, event);
-       }
-
-       /**
-        * Simulate that an AJAX event has been fired. You add an AJAX event to 
a
-        * component by using:
-        * 
-        * <pre>
-        *     ...
-        *     component.add(new AjaxEventBehavior(&quot;ondblclick&quot;) {
-        *         public void onEvent(AjaxRequestTarget) {}
-        *     });
-        *     ...
-        * </pre>
-        * 
-        * You can then test that the code inside onEvent actually does what 
it's
-        * supposed to, using the WicketTester:
-        * 
-        * <pre>
-        *     ...
-        *     tester.executeAjaxEvent(component, &quot;ondblclick&quot;);
-        * 
-        *     // Test that the code inside onEvent is correct.
-        *     ...
-        * </pre>
-        * 
-        * This also works with AjaxFormSubmitBehavior, where it will "submit" 
the
-        * form before executing the command.
-        * <p>
-        * PLEASE NOTE! This method doesn't actually insert the component in the
-        * client DOM tree, using javascript.
-        * 
-        * 
-        * @param component
-        *            The component which has the AjaxEventBehavior we wan't to
-        *            test. If the component is null, the test will fail.
-        * @param event
-        *            The event which we simulate is fired. If the event is 
null,
-        *            the test will fail.
-        */
-       public void executeAjaxEvent(Component component, String event)
-       {
-               String failMessage = "Can't execute event on a component which 
is null.";
-               Assert.assertNotNull(failMessage, component);
-
-               failMessage = "event must not be null";
-               Assert.assertNotNull(failMessage, event);
-
-               // Run through all the behavior and select the LAST ADDED 
behavior which
-               // matches the event parameter.
-               AjaxEventBehavior ajaxEventBehavior = null;
-               List behaviors = component.getBehaviors();
-               for (Iterator iter = behaviors.iterator(); iter.hasNext();)
-               {
-                       IBehavior behavior = (IBehavior)iter.next();
-
-                       // AjaxEventBehavior is the one to look for
-                       if (behavior instanceof AjaxEventBehavior)
-                       {
-                               AjaxEventBehavior tmp = 
(AjaxEventBehavior)behavior;
-
-                               if (event.equals(tmp.getEvent()))
-                               {
-                                       ajaxEventBehavior = tmp;
-                               }
-                       }
-               }
-
-               // If there haven't been found any event behaviors on the 
component
-               // which maches the parameters we fail.
-               failMessage = "No AjaxEventBehavior found on component: " + 
component.getId()
-                               + " which matches the event: " + 
event.toString();
-               Assert.assertNotNull(failMessage, ajaxEventBehavior);
-
-               setupRequestAndResponse();
-               RequestCycle requestCycle = createRequestCycle();
-
-               // If the event is an FormSubmitBehavior then also "submit" the 
form
-               if (ajaxEventBehavior instanceof AjaxFormSubmitBehavior)
-               {
-                       AjaxFormSubmitBehavior ajaxFormSubmitBehavior = 
(AjaxFormSubmitBehavior)ajaxEventBehavior;
-                       submitAjaxFormSubmitBehavior(ajaxFormSubmitBehavior);
-               }
-
-               ajaxEventBehavior.onRequest();
-
-               // process the request target
-               requestCycle.getRequestTarget().respond(requestCycle);
-       }
-
-       /**
-        * Get a TagTester based on a wicket:id. If more components exists with 
the
-        * same wicket:id in the markup only the first one is returned.
-        * 
-        * @param wicketId
-        *            The wicket:id to search for.
-        * @return The TagTester for the tag which has the given wicket:id.
-        */
-       public TagTester getTagByWicketId(String wicketId)
-       {
-               return 
TagTester.createTagByAttribute(getServletResponse().getDocument(), "wicket:id",
-                               wicketId);
-       }
-
-       /**
-        * Get a TagTester based on an dom id. If more components exists with 
the
-        * same id in the markup only the first one is returned.
-        * 
-        * @param id
-        *            The dom id to search for.
-        * @return The TagTester for the tag which has the given dom id.
-        */
-       public TagTester getTagById(String id)
-       {
-               return 
TagTester.createTagByAttribute(getServletResponse().getDocument(), "id", id);
+               Result result = isComponentOnAjaxResponse(component);
+               assertResult(result);
        }
 
-       /**
-        * Helper method for all the places where an AjaxCall should submit an
-        * associated form.
-        * 
-        * @param behavior
-        *            The AjaxFormSubmitBehavior with the form to "submit"
-        */
-       private void submitAjaxFormSubmitBehavior(AjaxFormSubmitBehavior 
behavior)
+       private void assertResult(Result result)
        {
-               // We need to get the form submitted, using reflection.
-               // It needs to be "submitted".
-               Form form = null;
-               try
-               {
-                       Field formField = 
AjaxFormSubmitBehavior.class.getDeclaredField("form");
-                       formField.setAccessible(true);
-                       form = (Form)formField.get(behavior);
-               }
-               catch (Exception e)
+               if(result.wasFailed())
                {
-                       Assert.fail(e.getMessage());
+                       throw new AssertionFailedError(result.getMessage());
                }
-
-               String failMessage = "No form attached to the submitlink.";
-               Assert.assertNotNull(failMessage, form);
-
-               form.visitFormComponents(new FormComponent.AbstractVisitor()
-               {
-                       public void onFormComponent(FormComponent formComponent)
-                       {
-                               if (!(formComponent instanceof Button) && 
!(formComponent instanceof RadioGroup)
-                                               && !(formComponent instanceof 
CheckGroup))
-                               {
-                                       String name = 
formComponent.getInputName();
-                                       String value = formComponent.getValue();
-
-                                       getServletRequest().setParameter(name, 
value);
-                               }
-                       }
-               });
        }
 }

Modified: 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/WicketTesterTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/WicketTesterTest.java?view=diff&rev=521219&r1=521218&r2=521219
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/WicketTesterTest.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/WicketTesterTest.java
 Thu Mar 22 04:24:14 2007
@@ -40,7 +40,7 @@
 import wicket.util.tester.apps_1.ViewBook;
 
 /**
- * 
+ *
  * @author Juergen Donnerstag
  */
 public class WicketTesterTest extends TestCase
@@ -60,7 +60,7 @@
        }
 
        /**
-        * 
+        *
         * @throws Exception
         */
        public void testViewBook() throws Exception
@@ -85,7 +85,7 @@
        }
 
        /**
-        * 
+        *
         * @throws Exception
         */
        public void testCreateBook_validateFail() throws Exception
@@ -106,7 +106,7 @@
        }
 
        /**
-        * 
+        *
         * @throws Exception
         */
        public void testCreateBook_validatePass() throws Exception
@@ -170,7 +170,7 @@
        }
 
        /**
-        * 
+        *
         */
        public void testAssertComponentOnAjaxResponse()
        {
@@ -303,7 +303,7 @@
                                + 
MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());
 
                assertEquals("Mock name", 
((TextField)tester.getComponentFromLastRenderedPage("form" + 
Component.PATH_SEPARATOR + "name")).getValue());
-               
+
                // The name of the pojo should still be the same. If the
                // executeAjaxEvent weren't submitting the form the name would 
have been
                // reset to null, because the form would have been updated but 
there
@@ -313,7 +313,7 @@
        }
 
        /**
-        * 
+        *
         */
        public void testRedirectWithPageParameters()
        {
@@ -333,7 +333,7 @@
        /**
         * Test that clickLink on a ResourceLink with a ResourceReference on it
         * works.
-        * 
+        *
         * <p>See also WICKET-280 Allow to access html resources</p>
         */
        public void testClickResourceLink()
@@ -345,9 +345,9 @@
                }
                catch(PackageResourceBlockedException e)
                {
-                       
+
                }
-               
+
                tester.startPage(MockResourceLinkPage.class);
                tester.clickLink("link");
                assertNull(getRequestCodingStrategy());

Modified: 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java?view=diff&rev=521219&r1=521218&r2=521219
==============================================================================
--- 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java
 (original)
+++ 
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java
 Thu Mar 22 04:24:14 2007
@@ -19,8 +19,8 @@
 import java.util.Arrays;
 import java.util.List;
 
-import junit.framework.AssertionFailedError;
 import wicket.Page;
+import wicket.WicketRuntimeException;
 import wicket.WicketTestCase;
 import wicket.util.tester.FormTester;
 import wicket.util.tester.ITestPageSource;
@@ -39,7 +39,7 @@
 
        /**
         * Construct.
-        * 
+        *
         * @param name
         */
        public FormTesterTest(String name)
@@ -110,18 +110,18 @@
                try
                {
                        formTester.selectMultiple("dropDownChoice", new int[] { 
0 });
-                       throw new RuntimeException("AssertionFailedError 
expected");
+                       throw new RuntimeException("WicketRuntimeException 
expected");
                }
-               catch (AssertionFailedError expected)
+               catch (WicketRuntimeException expected)
                {
                }
 
                try
                {
                        formTester.selectMultiple("radioGroup", new int[] { 2, 
1 });
-                       throw new RuntimeException("AssertionFailedError 
expected");
+                       throw new RuntimeException("WicketRuntimeException 
expected");
                }
-               catch (AssertionFailedError expected)
+               catch (WicketRuntimeException expected)
                {
                }
        }


Reply via email to