You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by ja...@apache.org on 2007/06/19 17:54:48 UTC

svn commit: r548774 - /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java

Author: janne
Date: Tue Jun 19 08:54:47 2007
New Revision: 548774

URL: http://svn.apache.org/viewvc?view=rev&rev=548774
Log:
added a helper method for initializing components without adding them to pages

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java?view=diff&rev=548774&r1=548773&r2=548774
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java Tue Jun 19 08:54:47 2007
@@ -384,6 +384,30 @@
 		}).get(DummyPanelPage.TEST_PANEL_ID);
 	}
 
+    /**
+     * A helper method for starting a component for a test without attaching it to a Page.
+     *
+     * Components which are somehow dependent on the page structure can not be currently tested
+     * with this method.
+     *
+     * Example:
+     *
+     * UserDataView view = new UserDataView("view", new ListDataProvider(userList));
+     * tester.startComponent(view);
+     * assertEquals(4, view.size());
+     *
+     * @param component
+     */
+    public void startComponent(Component component)
+    {
+        component.attach();
+        if (component instanceof FormComponent)
+        {
+                ((FormComponent) component).processInput();
+        }
+        component.beforeRender();
+    }
+
 	/**
 	 * Throw "standard" WicketRuntimeException
 	 *