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 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
16 public class WebTestUtils {
19 public static Matcher<RedirectException> redirectsTo(@Nonnull final String page) {
20 return new TypeSafeDiagnosingMatcher<RedirectException>() {
22 protected boolean matchesSafely(RedirectException exception, Description mismatchDescription) {
23 if (!exception.getTarget().equals(page)) {
24 mismatchDescription.appendText("target is ").appendValue(exception.getTarget());
31 public void describeTo(Description description) {
32 description.appendText("target is ").appendValue(page);