Simplify verifying that no redirect is called
[Sone.git] / src / test / java / net / pterodactylus / sone / web / pages / WebPageTest.java
index 9d77df7..c785e36 100644 (file)
@@ -309,6 +309,11 @@ public abstract class WebPageTest {
                when(webInterface.getCurrentSoneWithoutCreatingSession(toadletContext)).thenReturn(null);
        }
 
+       protected void setMethod(Method method) {
+               when(freenetRequest.getMethod()).thenReturn(method);
+               when(httpRequest.getMethod()).thenReturn(method.name());
+       }
+
        protected void request(String uri, Method method) {
                try {
                        when(httpRequest.getPath()).thenReturn(uri);
@@ -402,4 +407,13 @@ public abstract class WebPageTest {
                }
        }
 
+       protected void verifyNoRedirect(Runnable verification) throws RedirectException {
+               getPage().handleRequest(freenetRequest, templateContext);
+               verification.run();
+       }
+
+       protected void addTranslation(@Nonnull String key, @Nonnull String value) {
+               when(l10n.getString(key)).thenReturn(value);
+       }
+
 }