You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2018/09/26 13:39:32 UTC

[02/45] wicket git commit: proper formatting of WicketTester.java

proper formatting of WicketTester.java


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/dcd29c0b
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/dcd29c0b
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/dcd29c0b

Branch: refs/heads/master
Commit: dcd29c0bee0c07731569267964089c7e46fdbd16
Parents: f5f1c26
Author: renoth <jo...@gmx.de>
Authored: Tue Jul 31 13:54:07 2018 +0200
Committer: Martin Tzvetanov Grigorov <mg...@apache.org>
Committed: Wed Sep 26 15:36:17 2018 +0300

----------------------------------------------------------------------
 .../wicket/util/tester/BaseWicketTester.java    |   3 -
 .../apache/wicket/util/tester/FormTester.java   |  69 ++--
 .../apache/wicket/util/tester/WicketTester.java | 362 +++++++++----------
 3 files changed, 212 insertions(+), 222 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/dcd29c0b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
index 54e7808..a835c6c 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
@@ -16,9 +16,6 @@
  */
 package org.apache.wicket.util.tester;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-
 import java.io.IOException;
 import java.io.Serializable;
 import java.lang.reflect.Constructor;

http://git-wip-us.apache.org/repos/asf/wicket/blob/dcd29c0b/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java
index 031aac4..d1780ea 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/FormTester.java
@@ -48,7 +48,8 @@ import org.apache.wicket.util.string.StringValue;
 import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.visit.IVisit;
 import org.apache.wicket.util.visit.IVisitor;
-import org.junit.Assert;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 /**
  * A helper class for testing validation and submission of <code>FormComponent</code>s.
@@ -108,7 +109,7 @@ public class FormTester
 
 		/**
 		 * Constructor.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 */
@@ -119,7 +120,7 @@ public class FormTester
 
 		/**
 		 * Implements whether toggle or accumulate the selection.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 * @param value
@@ -171,7 +172,7 @@ public class FormTester
 
 		/**
 		 * Selects a given index in a selectable <code>FormComponent</code>.
-		 * 
+		 *
 		 * @param index
 		 */
 		protected final void doSelect(final int index)
@@ -182,7 +183,7 @@ public class FormTester
 
 		/**
 		 * Selects a given index in a selectable <code>FormComponent</code>.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 * @param index
@@ -242,7 +243,7 @@ public class FormTester
 		{
 			/**
 			 * Constructor.
-			 * 
+			 *
 			 * @param formComponent
 			 *            a <code>FormComponent</code>
 			 */
@@ -271,7 +272,7 @@ public class FormTester
 		{
 			/**
 			 * Constructor.
-			 * 
+			 *
 			 * @param formComponent
 			 *            a <code>FormComponent</code>
 			 */
@@ -290,7 +291,7 @@ public class FormTester
 
 		/**
 		 * Creates a <code>ChoiceSelector</code>.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 * @return ChoiceSelector a <code>ChoiceSelector</code>
@@ -321,7 +322,7 @@ public class FormTester
 
 		/**
 		 * Creates a <code>MultipleChoiceSelector</code>.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 * @return ChoiceSelector a <code>ChoiceSelector</code>
@@ -333,7 +334,7 @@ public class FormTester
 
 		/**
 		 * Tests if a given <code>FormComponent</code> allows multiple choice.
-		 * 
+		 *
 		 * @param formComponent
 		 *            a <code>FormComponent</code>
 		 * @return <code>true</code> if the given FormComponent allows multiple choice
@@ -366,7 +367,7 @@ public class FormTester
 
 	/**
 	 * @see WicketTester#newFormTester(String)
-	 * 
+	 *
 	 * @param path
 	 *            path to <code>FormComponent</code>
 	 * @param workingForm
@@ -416,7 +417,7 @@ public class FormTester
 
 	/**
 	 * Gets request parameter values for the form component that represents its current model value
-	 * 
+	 *
 	 * @param formComponent
 	 * @return array containing parameter values
 	 */
@@ -458,7 +459,7 @@ public class FormTester
 
 	/**
 	 * Retrieves the current <code>Form</code> object.
-	 * 
+	 *
 	 * @return the working <code>Form</code>
 	 */
 	public Form<?> getForm()
@@ -468,7 +469,7 @@ public class FormTester
 
 	/**
 	 * Gets the value for an <code>AbstractTextComponent</code> with the provided id.
-	 * 
+	 *
 	 * @param id
 	 *            <code>Component</code> id
 	 * @return the value of the text component
@@ -490,7 +491,7 @@ public class FormTester
 	 * as <code>Radio</code> or <code>DropDownList</code>, the selection will toggle each other. For
 	 * multiple choice, such as <code>Checkbox</code> or <code>ListMultipleChoice</code>, the
 	 * selection will accumulate.
-	 * 
+	 *
 	 * @param formComponentId
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code>
@@ -516,9 +517,9 @@ public class FormTester
 	/**
 	 * A convenience method to select multiple options for the <code>FormComponent</code>. The
 	 * method only support multiple selectable <code>FormComponent</code>s.
-	 * 
+	 *
 	 * @see #select(String, int)
-	 * 
+	 *
 	 * @param formComponentId
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code>
@@ -534,9 +535,9 @@ public class FormTester
 	/**
 	 * A convenience method to select multiple options for the <code>FormComponent</code>. The
 	 * method only support multiple selectable <code>FormComponent</code>s.
-	 * 
+	 *
 	 * @see #select(String, int)
-	 * 
+	 *
 	 * @param formComponentId
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code>
@@ -569,7 +570,7 @@ public class FormTester
 
 	/**
 	 * Simulates filling in a field on a <code>Form</code>.
-	 * 
+	 *
 	 * @param formComponentId
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code> or <code>IFormSubmittingComponent</code>
@@ -580,14 +581,14 @@ public class FormTester
 	public FormTester setValue(final String formComponentId, final String value)
 	{
 		Component component = workingForm.get(formComponentId);
-		Assert.assertNotNull("Unable to set value. Couldn't find component with name: " +
+		assertNotNull("Unable to set value. Couldn't find component with name: " +
 			formComponentId, component);
 		return setValue(component, value);
 	}
 
 	/**
 	 * Simulates filling in a field on a <code>Form</code>.
-	 * 
+	 *
 	 * @param formComponent
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code> or <code>IFormSubmittingComponent</code>
@@ -629,7 +630,7 @@ public class FormTester
 
 	/**
 	 * Sets the <code>File</code> on a {@link FileUploadField}.
-	 * 
+	 *
 	 * @param formComponentId
 	 *            relative path (from <code>Form</code>) to the selectable
 	 *            <code>FormComponent</code>. The <code>FormComponent</code> must be of a type
@@ -670,7 +671,7 @@ public class FormTester
 
 	/**
 	 * Submits the <code>Form</code>. Note that <code>submit</code> can be executed only once.
-	 * 
+	 *
 	 * @return This
 	 */
 	public FormTester submit()
@@ -709,12 +710,12 @@ public class FormTester
 	 * <p>
 	 * Note that if the button is associated with a model, it's better to use the
 	 * <code>setValue</code> method instead:
-	 * 
+	 *
 	 * <pre>
 	 * formTester.setValue(&quot;to:my:button&quot;, &quot;value on the button&quot;);
 	 * formTester.submit();
 	 * </pre>
-	 * 
+	 *
 	 * @param buttonComponentId
 	 *            relative path (from <code>Form</code>) to the button
 	 * @return This
@@ -735,12 +736,12 @@ public class FormTester
 	 * <p>
 	 * Note that if the button is associated with a model, it's better to use the
 	 * <code>setValue</code> method instead:
-	 * 
+	 *
 	 * <pre>
 	 * formTester.setValue(myButton, &quot;value on the button&quot;);
 	 * formTester.submit();
 	 * </pre>
-	 * 
+	 *
 	 * @param buttonComponent
 	 *            relative path (from <code>Form</code>) to the button
 	 * @return This
@@ -770,7 +771,7 @@ public class FormTester
 	/**
 	 * A convenience method to submit the Form via a SubmitLink which may inside or outside of the
 	 * Form.
-	 * 
+	 *
 	 * @param path
 	 *            The path to the SubmitLink
 	 * @param pageRelative
@@ -796,7 +797,7 @@ public class FormTester
 	/**
 	 * Adds an additional <code>FormComponent</code>'s value into request parameter -- this method
 	 * retains existing parameters but removes any duplicate parameters.
-	 * 
+	 *
 	 * @param formComponent
 	 *            a <code>FormComponent</code>
 	 * @param value
@@ -851,7 +852,7 @@ public class FormTester
 
 	/**
 	 * Returns <code>true</code> if the parameter exists in the <code>FormComponent</code>.
-	 * 
+	 *
 	 * @param formComponent
 	 *            a <code>FormComponent</code>
 	 * @return <code>true</code> if the parameter exists in the <code>FormComponent</code>
@@ -868,7 +869,7 @@ public class FormTester
 
 	/**
 	 * Set formComponent's value into request parameter, this method overwrites existing parameters.
-	 * 
+	 *
 	 * @param formComponent
 	 *            a <code>FormComponent</code>
 	 * @param value
@@ -883,7 +884,7 @@ public class FormTester
 
 	/**
 	 * Set component's value into request parameter, this method overwrites existing parameters.
-	 * 
+	 *
 	 * @param component
 	 *            an {@link IFormSubmittingComponent}
 	 * @param value
@@ -895,7 +896,7 @@ public class FormTester
 	}
 
 	/**
-	 * 
+	 *
 	 * @param message
 	 */
 	private void fail(String message)

http://git-wip-us.apache.org/repos/asf/wicket/blob/dcd29c0b/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java b/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java
index a35aa0d..f94304f 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/tester/WicketTester.java
@@ -49,8 +49,10 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Locale;
 
-import static org.junit.jupiter.api.Assertions.*;
-
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
  * A helper class to ease unit testing of Wicket applications without the need for a servlet
@@ -145,14 +147,16 @@ import static org.junit.jupiter.api.Assertions.*;
  *
  * Cookie handling:
  *
- * There are some expectations about wicket tester cookie handling which should match as best as it
- * can be with a real client server request response cycle: - all valid cookies set before a request
- * is made (tester.getRequest().addCookie()) should appear in the page request - all cookies set in
- * the response should appear in the last response (tester.getLastResponse()) after the request is
- * made (expired cookies and others) - all cookies set in the response should appear even after a
- * redirect response is made until the final response (tester.getLastResponse()) is written to the
- * client (wicket tester) - all valid cookies (maxAge!=0) from the last response should be added to
- * the next request cookies (tester.getRequest().getCookies())
+ * There are some expectations about wicket tester cookie handling which should match as best as
+ * it can be with a real client server request response cycle:
+ * - all valid cookies set before a request is made (tester.getRequest().addCookie()) should
+ *   appear in the page request
+ * - all cookies set in the response should appear in the last response (tester.getLastResponse())
+ *   after the request is made (expired cookies and others)
+ * - all cookies set in the response should appear even after a redirect response is made
+ *   until the final response (tester.getLastResponse()) is written to the client (wicket tester)
+ * - all valid cookies (maxAge!=0) from the last response should be added to
+ *   the next request cookies (tester.getRequest().getCookies())
  *
  *
  * TODO General: Example usage of FormTester
@@ -255,41 +259,19 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Returns the current Maven build directory taken from the <tt>basedir</tt> system property, or
-	 * null if not set
-	 *
-	 * @return path with a trailing slash
-	 */
-	public static String getBasedir()
-	{
-		String basedir = System.getProperty("basedir");
-		if (basedir != null)
-		{
-			basedir = basedir + "/";
-		}
-		else
-		{
-			basedir = "";
-		}
-		return basedir;
-	}
-
-	/**
 	 * Asserts that the Ajax location header is present.
 	 */
 	public void assertAjaxLocation()
 	{
 		if (null != getLastResponse().getHeader("Location"))
 		{
-			throw new AssertionFailedError(
-				"Location header should *not* be present when using Ajax");
+			throw new AssertionFailedError("Location header should *not* be present when using Ajax");
 		}
 
 		String ajaxLocation = getLastResponse().getHeader("Ajax-Location");
 		if (null == ajaxLocation)
 		{
-			throw new AssertionFailedError(
-				"Ajax-Location header should be present when using Ajax");
+			throw new AssertionFailedError("Ajax-Location header should be present when using Ajax");
 		}
 
 		int statusCode = getLastResponse().getStatus();
@@ -313,19 +295,8 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 *
-	 * @param result
-	 */
-	private void assertResult(Result result)
-	{
-		if (result.wasFailed())
-		{
-			throw new AssertionFailedError(result.getMessage());
-		}
-	}
-
-	/**
-	 * Asserts that the <code>Component</code> a the given path has a behavior of the given type.
+	 * Asserts that the <code>Component</code> a the given path has a behavior
+	 * of the given type.
 	 *
 	 * @param path
 	 *            path to <code>Component</code>
@@ -339,44 +310,44 @@ public class WicketTester extends BaseWicketTester
 		Component component = assertExists(path);
 		List<? extends Behavior> behaviors = component.getBehaviors(expectedBehaviorClass);
 		final String message = String.format("Component '%s' has no behaviors of type '%s'",
-			component.getPageRelativePath(), expectedBehaviorClass);
+				component.getPageRelativePath(), expectedBehaviorClass);
 		assertResult(new Result(CollectionUtils.isEmpty(behaviors), message));
 	}
 
 	/**
 	 * Tests that a <code>Component</code> has been added to a <code>AjaxRequestTarget</code>, using
-	 * {@link org.apache.wicket.ajax.AjaxRequestTarget#add(Component...)}. This method actually
-	 * tests that a <code>Component</code> is on the Ajax response sent back to the client.
+	 * {@link org.apache.wicket.ajax.AjaxRequestTarget#add(Component...)}. This method actually tests that a
+	 * <code>Component</code> is on the Ajax response sent back to the client.
 	 * <p>
 	 * PLEASE NOTE! This method doesn't actually insert the <code>Component</code> in the client DOM
 	 * tree, using JavaScript. But it shouldn't be needed because you just have to trust that Wicket
 	 * Ajax JavaScript works.
 	 *
-	 * @param componentPath
-	 *            a <code>Component</code> path to test
+	 * @param component
+	 *            a <code>Component</code> to be tested
 	 */
-	public void assertComponentOnAjaxResponse(String componentPath)
+	public void assertComponentOnAjaxResponse(Component component)
 	{
-		Component component = getComponentFromLastRenderedPage(componentPath, false);
-		assertComponentOnAjaxResponse(component);
+		Result result = isComponentOnAjaxResponse(component);
+		assertResult(result);
 	}
 
 	/**
 	 * Tests that a <code>Component</code> has been added to a <code>AjaxRequestTarget</code>, using
-	 * {@link org.apache.wicket.ajax.AjaxRequestTarget#add(Component...)}. This method actually
-	 * tests that a <code>Component</code> is on the Ajax response sent back to the client.
+	 * {@link org.apache.wicket.ajax.AjaxRequestTarget#add(Component...)}. This method actually tests that a
+	 * <code>Component</code> is on the Ajax response sent back to the client.
 	 * <p>
 	 * PLEASE NOTE! This method doesn't actually insert the <code>Component</code> in the client DOM
 	 * tree, using JavaScript. But it shouldn't be needed because you just have to trust that Wicket
 	 * Ajax JavaScript works.
 	 *
-	 * @param component
-	 *            a <code>Component</code> to be tested
+	 * @param componentPath
+	 *            a <code>Component</code> path to test
 	 */
-	public void assertComponentOnAjaxResponse(Component component)
+	public void assertComponentOnAjaxResponse(String componentPath)
 	{
-		Result result = isComponentOnAjaxResponse(component);
-		assertResult(result);
+		Component component = getComponentFromLastRenderedPage(componentPath, false);
+		assertComponentOnAjaxResponse(component);
 	}
 
 	/**
@@ -405,9 +376,9 @@ public class WicketTester extends BaseWicketTester
 	 * Asserts that a component's markup has loaded with the given variation
 	 *
 	 * @param component
-	 *            The component which markup to check
+	 *              The component which markup to check
 	 * @param expectedVariation
-	 *            The expected variation of the component's markup
+	 *              The expected variation of the component's markup
 	 */
 	public void assertMarkupVariation(Component component, String expectedVariation)
 	{
@@ -417,44 +388,21 @@ public class WicketTester extends BaseWicketTester
 		String actualVariation = markup.getMarkupResourceStream().getVariation();
 		if (Objects.equal(expectedVariation, actualVariation) == false)
 		{
-			result = Result.fail(
-				String.format("Wrong variation for component '%s'. Actual: '%s', expected: '%s'",
+			result = Result.fail(String.format("Wrong variation for component '%s'. Actual: '%s', expected: '%s'",
 					component.getPageRelativePath(), actualVariation, expectedVariation));
 		}
 
 		assertResult(result);
 	}
 
-	private IMarkupFragment getMarkupFragment(Component component)
-	{
-		IMarkupFragment markup = null;
-		if (component instanceof MarkupContainer)
-		{
-			markup = ((MarkupContainer)component).getAssociatedMarkup();
-		}
-
-		if (markup == null)
-		{
-			markup = component.getMarkup();
-		}
-
-		if (markup == null)
-		{
-			throw new AssertionFailedError(String.format("Cannot find the markup of component: %s",
-				component.getPageRelativePath()));
-		}
-
-		return markup;
-	}
-
 	/**
 	 * Asserts that a component's markup has loaded with the given style.
 	 *
 	 * @param component
-	 *            The component which markup to check
+	 *              The component which markup to check
 	 * @param expectedStyle
-	 *            The expected style of the component's markup. For example: <em>green</em> in
-	 *            <code>MyPanel_green.html</code>
+	 *              The expected style of the component's markup.
+	 *              For example: <em>green</em> in <code>MyPanel_green.html</code>
 	 */
 	public void assertMarkupStyle(Component component, String expectedStyle)
 	{
@@ -464,8 +412,7 @@ public class WicketTester extends BaseWicketTester
 		String actualStyle = markup.getMarkupResourceStream().getStyle();
 		if (Objects.equal(expectedStyle, actualStyle) == false)
 		{
-			result = Result
-				.fail(String.format("Wrong style for component '%s'. Actual: '%s', expected: '%s'",
+			result = Result.fail(String.format("Wrong style for component '%s'. Actual: '%s', expected: '%s'",
 					component.getPageRelativePath(), actualStyle, expectedStyle));
 		}
 
@@ -476,9 +423,9 @@ public class WicketTester extends BaseWicketTester
 	 * Asserts that a component's markup has loaded with the given locale
 	 *
 	 * @param component
-	 *            The component which markup to check
+	 *              The component which markup to check
 	 * @param expectedLocale
-	 *            The expected locale of the component's markup
+	 *              The expected locale of the component's markup
 	 */
 	public void assertMarkupLocale(Component component, Locale expectedLocale)
 	{
@@ -488,14 +435,34 @@ public class WicketTester extends BaseWicketTester
 		Locale actualLocale = markup.getMarkupResourceStream().getLocale();
 		if (Objects.equal(expectedLocale, actualLocale) == false)
 		{
-			result = Result
-				.fail(String.format("Wrong locale for component '%s'. Actual: '%s', expected: '%s'",
+			result = Result.fail(String.format("Wrong locale for component '%s'. Actual: '%s', expected: '%s'",
 					component.getPageRelativePath(), actualLocale, expectedLocale));
 		}
 
 		assertResult(result);
 	}
 
+	private IMarkupFragment getMarkupFragment(Component component)
+	{
+		IMarkupFragment markup = null;
+		if (component instanceof MarkupContainer)
+		{
+			markup = ((MarkupContainer) component).getAssociatedMarkup();
+		}
+
+		if (markup == null)
+		{
+			markup = component.getMarkup();
+		}
+
+		if (markup == null)
+		{
+			throw new AssertionFailedError(String.format("Cannot find the markup of component: %s", component.getPageRelativePath()));
+		}
+
+		return markup;
+	}
+
 	/**
 	 * Asserts error-level feedback messages.
 	 *
@@ -504,8 +471,18 @@ public class WicketTester extends BaseWicketTester
 	 */
 	public void assertErrorMessages(Serializable... expectedErrorMessages)
 	{
-		assertFeedbackMessages(new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR),
-			expectedErrorMessages);
+		assertFeedbackMessages(new ExactLevelFeedbackMessageFilter(FeedbackMessage.ERROR), expectedErrorMessages);
+	}
+
+	/**
+	 * Assert info-level feedback messages.
+	 *
+	 * @param expectedInfoMessages
+	 *            expected info messages
+	 */
+	public void assertInfoMessages(Serializable... expectedInfoMessages)
+	{
+		assertFeedbackMessages(new ExactLevelFeedbackMessageFilter(FeedbackMessage.INFO), expectedInfoMessages);
 	}
 
 	/**
@@ -516,8 +493,7 @@ public class WicketTester extends BaseWicketTester
 	 * @param expectedMessages
 	 *            expected feedback messages
 	 */
-	public void assertFeedbackMessages(IFeedbackMessageFilter filter,
-		Serializable... expectedMessages)
+	public void assertFeedbackMessages(IFeedbackMessageFilter filter, Serializable... expectedMessages)
 	{
 		List<FeedbackMessage> feedbackMessages = getFeedbackMessages(filter);
 		List<Serializable> actualMessages = getActualFeedbackMessages(feedbackMessages);
@@ -525,8 +501,34 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Extracts the actual messages from the passed feedback messages. Specially handles
-	 * ValidationErrorFeedback messages by extracting their String message
+	 * Asserts that there is a feedback message provided by a given component
+	 *
+	 * @param component
+	 *          the component that provided the expected feedback message. Optional.
+	 * @param key
+	 *          the resource key for the feedback message. Mandatory.
+	 * @param model
+	 *          the model used for interpolating the feedback message. Optional.
+	 * @param filter
+	 *          the filter that decides in which messages to look in. E.g. with a specific
+	 *          level, rendered or not, etc.
+	 */
+	public void assertComponentFeedbackMessage(Component component, String key, IModel<?> model, IFeedbackMessageFilter filter)
+	{
+		Args.notNull(key, "key");
+
+		String expectedMessage = getApplication().getResourceSettings().getLocalizer().getString(key, component, model);
+
+		List<FeedbackMessage> feedbackMessages = getFeedbackMessages(filter);
+		List<Serializable> actualMessages = getActualFeedbackMessages(feedbackMessages);
+
+		assertTrue(actualMessages.contains(expectedMessage),
+				   String.format("Feedback message with key '%s' cannot be found in %s", key, actualMessages));
+	}
+
+	/**
+	 * Extracts the actual messages from the passed feedback messages.
+	 * Specially handles ValidationErrorFeedback messages by extracting their String message
 	 *
 	 * @param feedbackMessages
 	 *            the feedback messages
@@ -551,46 +553,6 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Assert info-level feedback messages.
-	 *
-	 * @param expectedInfoMessages
-	 *            expected info messages
-	 */
-	public void assertInfoMessages(Serializable... expectedInfoMessages)
-	{
-		assertFeedbackMessages(new ExactLevelFeedbackMessageFilter(FeedbackMessage.INFO),
-			expectedInfoMessages);
-	}
-
-	/**
-	 * Asserts that there is a feedback message provided by a given component
-	 *
-	 * @param component
-	 *            the component that provided the expected feedback message. Optional.
-	 * @param key
-	 *            the resource key for the feedback message. Mandatory.
-	 * @param model
-	 *            the model used for interpolating the feedback message. Optional.
-	 * @param filter
-	 *            the filter that decides in which messages to look in. E.g. with a specific level,
-	 *            rendered or not, etc.
-	 */
-	public void assertComponentFeedbackMessage(Component component, String key, IModel<?> model,
-		IFeedbackMessageFilter filter)
-	{
-		Args.notNull(key, "key");
-
-		String expectedMessage = getApplication().getResourceSettings().getLocalizer().getString(
-			key, component, model);
-
-		List<FeedbackMessage> feedbackMessages = getFeedbackMessages(filter);
-		List<Serializable> actualMessages = getActualFeedbackMessages(feedbackMessages);
-
-		assertTrue(actualMessages.contains(expectedMessage), String
-			.format("Feedback message with key '%s' cannot be found in %s", key, actualMessages));
-	}
-
-	/**
 	 * Assert that a particular feedback panel is rendering certain messages.
 	 *
 	 * NOTE: this casts the component at the specified path to a {@link FeedbackPanel}, so it will
@@ -609,13 +571,12 @@ public class WicketTester extends BaseWicketTester
 		final List<FeedbackMessage> renderedMessages = model.getObject();
 		if (renderedMessages == null)
 		{
-			fail(String.format("feedback panel at path [%s] returned null messages", path));
+			throw new AssertionFailedError(String.format("feedback panel at path [%s] returned null messages", path));
 		}
 		if (messages.length != renderedMessages.size())
 		{
-			fail(String.format(
-				"you expected '%d' messages for the feedback panel [%s], but there were actually '%d'",
-				messages.length, path, renderedMessages.size()));
+			throw new AssertionFailedError(String.format("you expected '%d' messages for the feedback panel [%s], but there were actually '%d'",
+					messages.length, path, renderedMessages.size()));
 		}
 		for (int i = 0; i < messages.length && i < renderedMessages.size(); i++)
 		{
@@ -694,30 +655,19 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Asserts last-rendered <code>Page</code> against an expected HTML document.
-	 * <p>
-	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
-	 * output file.
-	 *
-	 * @param clazz
-	 *            <code>Class</code> used to load the file (relative to <code>clazz</code> package)
-	 * @param filename
-	 *            expected output filename <code>String</code>
-	 * @throws Exception
+	 * Asserts no error-level feedback messages.
 	 */
-	@Override
-	public void assertResultPage(final Class<?> clazz, final String filename) throws Exception
+	public void assertNoErrorMessage()
 	{
-		String document = getLastResponseAsString();
-		DiffUtil.validatePage(document, clazz, filename, true);
+		assertNoFeedbackMessage(FeedbackMessage.ERROR);
 	}
 
 	/**
-	 * Asserts no error-level feedback messages.
+	 * Asserts no info-level feedback messages.
 	 */
-	public void assertNoErrorMessage()
+	public void assertNoInfoMessage()
 	{
-		assertNoFeedbackMessage(FeedbackMessage.ERROR);
+		assertNoFeedbackMessage(FeedbackMessage.INFO);
 	}
 
 	/**
@@ -733,11 +683,33 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Asserts no info-level feedback messages.
+	 * Asserts a last-rendered <code>Page</code> class.
+	 *
+	 * @param expectedRenderedPageClass
+	 *            expected class of last rendered <code>Page</code>
 	 */
-	public void assertNoInfoMessage()
+	public void assertRenderedPage(Class<? extends Page> expectedRenderedPageClass)
 	{
-		assertNoFeedbackMessage(FeedbackMessage.INFO);
+		assertResult(isRenderedPage(expectedRenderedPageClass));
+	}
+
+	/**
+	 * Asserts last-rendered <code>Page</code> against an expected HTML document.
+	 * <p>
+	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
+	 * output file.
+	 *
+	 * @param clazz
+	 *            <code>Class</code> used to load the file (relative to <code>clazz</code> package)
+	 * @param filename
+	 *            expected output filename <code>String</code>
+	 * @throws Exception
+	 */
+	@Override
+	public void assertResultPage(final Class<?> clazz, final String filename) throws Exception
+	{
+		String document = getLastResponseAsString();
+		DiffUtil.validatePage(document, clazz, filename, true);
 	}
 
 	/**
@@ -812,6 +784,18 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
+	 *
+	 * @param result
+	 */
+	private void assertResult(Result result)
+	{
+		if (result.wasFailed())
+		{
+			throw new AssertionFailedError(result.getMessage());
+		}
+	}
+
+	/**
 	 * Checks whether a component is visible and/or enabled before usage
 	 *
 	 * @param component
@@ -848,16 +832,15 @@ public class WicketTester extends BaseWicketTester
 		}
 		catch (ClassCastException e)
 		{
-			throw new IllegalArgumentException(
-				"Component with id:" + id + " is not a BookmarkablePageLink");
+			throw new IllegalArgumentException("Component with id:" + id +
+				" is not a BookmarkablePageLink");
 		}
 
-		assertEquals(pageClass, pageLink.getPageClass(),
-			"BookmarkablePageLink: " + id + " is pointing to the wrong page");
+		assertEquals(pageClass,
+			pageLink.getPageClass(), "BookmarkablePageLink: " + id + " is pointing to the wrong page");
 
-		assertEquals(parameters, pageLink.getPageParameters(),
-			"One or more of the parameters associated with the BookmarkablePageLink: " + id +
-				" do not match");
+		assertEquals(parameters, pageLink.getPageParameters(), "One or more of the parameters associated with the BookmarkablePageLink: " +
+				id + " do not match");
 	}
 
 	/**
@@ -881,17 +864,6 @@ public class WicketTester extends BaseWicketTester
 	}
 
 	/**
-	 * Asserts a last-rendered <code>Page</code> class.
-	 *
-	 * @param expectedRenderedPageClass
-	 *            expected class of last rendered <code>Page</code>
-	 */
-	public void assertRenderedPage(Class<? extends Page> expectedRenderedPageClass)
-	{
-		assertResult(isRenderedPage(expectedRenderedPageClass));
-	}
-
-	/**
 	 * Use <code>-Dwicket.replace.expected.results=true</code> to automatically replace the expected
 	 * output file.
 	 *
@@ -996,4 +968,24 @@ public class WicketTester extends BaseWicketTester
 		String actualRedirectUrl = getLastResponse().getRedirectLocation();
 		assertEquals(expectedRedirectUrl, actualRedirectUrl);
 	}
+
+	/**
+	 * Returns the current Maven build directory taken from the <tt>basedir</tt> system property, or
+	 * null if not set
+	 *
+	 * @return path with a trailing slash
+	 */
+	public static String getBasedir()
+	{
+		String basedir = System.getProperty("basedir");
+		if (basedir != null)
+		{
+			basedir = basedir + "/";
+		}
+		else
+		{
+			basedir = "";
+		}
+		return basedir;
+	}
 }