1 package net.pterodactylus.sone.web;
3 import static net.pterodactylus.sone.web.WebTestUtils.redirectsTo;
4 import static net.pterodactylus.util.web.Method.POST;
5 import static org.mockito.ArgumentMatchers.anyInt;
6 import static org.mockito.ArgumentMatchers.eq;
7 import static org.mockito.Mockito.when;
9 import net.pterodactylus.sone.data.PostReply;
11 import com.google.common.base.Optional;
12 import org.junit.Test;
15 * Unit test for {@link DeleteReplyPage}.
17 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
19 public class DeleteReplyPageTest extends WebPageTest {
21 private final DeleteReplyPage page = new DeleteReplyPage(template, webInterface);
24 public void tryingToDeleteAReplyWithAnInvalidIdResultsInNoPermissionPage() throws Exception {
26 when(httpRequest.getPartAsStringFailsafe(eq("reply"), anyInt())).thenReturn("id");
27 when(webInterface.getCore().getPostReply("id")).thenReturn(Optional.<PostReply>absent());
28 expectedException.expect(redirectsTo("noPermission.html"));
29 page.processTemplate(freenetRequest, templateContext);