1 package net.pterodactylus.sone.web;
3 import javax.annotation.Nonnull;
5 import net.pterodactylus.sone.web.page.FreenetTemplatePage.RedirectException;
7 import org.hamcrest.Description;
8 import org.hamcrest.Matcher;
9 import org.hamcrest.TypeSafeDiagnosingMatcher;
12 * Utilities for testing the <code>web</code> package.
14 public class WebTestUtils {
17 public static Matcher<RedirectException> redirectsTo(@Nonnull final String page) {
18 return new TypeSafeDiagnosingMatcher<RedirectException>() {
20 protected boolean matchesSafely(RedirectException exception, Description mismatchDescription) {
21 if (!exception.getTarget().equals(page)) {
22 mismatchDescription.appendText("target is ").appendValue(exception.getTarget());
29 public void describeTo(Description description) {
30 description.appendText("target is ").appendValue(page);